1. Direct Reset Automatic increment value
The ALTER table syntax provides a way to reset AutoIncrement columns. Take a look at the example below.
ALTER TABLE table_name auto_increment = 1;
Note that you cannot reset the counter's value less than
When MySQL is sorted, if it needs to be sorted in the original order, you can use the ordering by Find_in_set () method, as follows:
The code is as follows
Copy Code
SELECT * from Ecs_goods where goods_id into ($idList)
A, what view View is an interface for storing data, or it can be said to be a virtual table. This data can be from one or several basic tables (or views) of data. It can also be data that the user has defined from. In fact, the view does not
PHP's MySQL creation database and table
The database has one or more tables.Creating a DatabaseThe Create DB statement is used to build a database in MySQL.Grammar
CREATE DATABASE database_name
To learn more about SQL, please
Connect to 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 the point with the mysql_connect () function.Grammar
Mysql_connect
1. FOREIGN KEY constraints
A non-primary key field in a table, and if it is a primary key in another table, then this field is called a foreign key.
For example, there are now two tables:
Student Form-school number, name, sex, class number
Class
1. Description of federated Storage EngineFederated storage Engine enables remote Access database without replication or cluster technologyWhen creating a table based on the Federated storage Engine, the server creates only one table definition file
View MySQL Maximum connection data
The code is as follows
Copy Code
Show variables like '%max_connections% '
To modify the method:
Into the MySQL terminal,
The code is as follows
Copy Code
This article describes how to check the MySQL database, view the current date, using the MySQL current_date variable.
We can execute SQL statements when we log on to MySQL using the MySQL client tool or other graphical tools. If we want to look at
If you forget the root password can be modified by the following method
Note--skip-grant-tables can turn off permission validation
1. Modify the MySQL configuration file under [mysqld] Add a line of configuration--skip-grant-tables, restart MySQL
The company's database storage engine was all MyISAM, data volume and access is not very large, so there is no problem. However, the recent occurrence of the MySQL data table is often locked, directly caused the user to connect the site timeout and
When it comes to MySQL's execution, it has to say its execution process. And its execution process is divided into standard execution process and optimized execution process.
Standard processStandard processes are standard processes for SQL
The ORDER by null purpose is to force the ordering to be disabled for query results. When you check the query by explain, if you see a using Filesort in the extra column, this has a certain effect on performance, especially when group by is used,
Originally my idea is to use PHP for the loop to execute the SQL statements more than once, but later a thought, doing so in the data is not much good, if more data, query so many times do not know how much resources to consume.
After trying to
MySQL UPDATE statement Base usage
Updating data in a database
The UPDATE statement is used to modify data in a database table.
Grammar
The code is as follows
Copy Code
UPDATE table_nameSET column_name = New_valueWHERE
If there are many tables that need to be deleted, and the table has the same prefix, we might need the following statement:
The code is as follows
Copy Code
drop table pre_tablename1;drop table pre_tablename2;drop table
Using MYSQL for database backup is also a regular database backup method. It has the same concept as other database servers, but have you ever thought about it, mySQL will have a simpler backup method using the file directory, and it will be faster
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