Create databases and tables for MySQL in PHP
The database has one or more tables.Create a databaseThe create database statement is used to CREATE a DATABASE MySQL.Syntax
CREATE DATABASE database_name
For more information about SQL, see our SQL
Connect to the MySQL database
Create a connection to the MySQL databaseWhen you can access the data in the database, you must create a connection to the database.In PHP, this is similar to the mysql_connect ()
How to use SQL in statements
InIn allows you to specify multiple values In the WHERE clause.SQL syntax
SELECT column_name(s)FROM table_nameWHERE column_name IN (value1,value2,...)
Let's take a look at an instance. below is the data
_Id
Now MySQL is used more and more, and I also use it to make my own message board. During use,SlowlyWe need to manage it.The function requires a step-by-step grasp, not only me, but also the requirements of many netizens. Now there are some
It is very sad to lose the password, especially the root password :(. I lost my own installation and play, but it would be too much trouble if the server crashes! It is assumed that the root password is lost due to intrusion. Here I will talk about
Since I have been in school for so many years, I have come to the conclusion that learning from an example is the fastest and most effective, and can cultivate a strong practical ability. This is a good way to learn. Try not to access. For example,
How to Use php to export and import data to a large database,Today, when the network speed is very slow, you can't write or use php to write an exported and imported data to a large database. I think many people often use phpmyadmin to import and
I personally think that the methods for changing the mysql root Password are similar in both linux and windows systems. Next I will explain how to reset the MySQL ROOT Password in Linux, for more information, see.
Restart mysql root Password
Method 1
We will use the delete command to delete records in the database in SQL. If you accidentally delete the records, it will be difficult to restore them. Next I will summarize some methods for deleting data but not deleting the database.
Method 1: My
In mysql, the update statement is used to update the records of tables in the specified database. It can also be updated in batches. It can be used with the mysql update where condition to specify the data to be updated, next I will introduce you to
I have been using PHP for a project over the past few days. The project involves MySQL operations. When optimizing the query statement, we encountered the following problem: how to return several rows of data in a table.
My initial idea was to use
There are many ways to implement automatic mysql backup. The most common method is mysql master-slave synchronization for data backup. below I will introduce to you a detailed explanation of mysql master-slave configuration for database
This article briefly introduces the mysql database creation and table creation instances.
A database creation and table creation instance
The Code is as follows:
Copy code
Drop database if exists school; // Delete if SCHOOL
Generally, the server IP address cannot be changed at will. If the mysql Master/Slave fails to be changed, I will introduce the process of changing the IP address of the master server under MySQL Master/Slave replication.
All the servers of the
This article will introduce you to a more useful function, that is, to record the SQL statements executed by MySQL in real time, so that we can easily troubleshoot various injection problems.
The method is simple: edit/etc/my. in the cnf file, add
In addition to the where clause, we can use the if case Method to Determine the query result. This is more advanced than the where clause. I will introduce several conditional query instances.
Where condition Query
The Code is as follows:
In the previous section, I talked about the SQL statement used to query a specified mysql date. Next I will summarize all the statements used to query mysql date.
Description: There is a member table, there is a birthday field, the value is 'yyyy-MM-
The following describes how to use commands to quickly delete MySQL binary logs. Because sometimes the binary files are too large, we need to clear them. The following describes the specific operation steps.
120 gb ssd space is used on the server.
Generally, if we use the ID auto-incrementing primary key and delete the key, we cannot simply rank the ID again. Here are some operation tips.
The IDS of the auto-incrementing primary keys in Mysql database tables are messy and need to be
Sometimes we have configured MySQL master-slave replication, but there are new projects and databases coming in. We also hope that this data will allow mysql to achieve master-slave replication, next, we will introduce how to add a new database to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service