Reprinted from: http://www.educity.cn/wenda/400530.html
1. Link MySQL database
Format: mysql-h domain-u user name-p password database name
1.1 First open the DOS window, then enter the directory Mysql\bin, and then type the command mysql-uroot-p, Enter the password after you are prompted to lose. Note The user name can have a space or no space, if just installed MySQL, no password, superuser root is no password, so directly enter into MySQL, MySQL prompt is: mysql>
1.2 Exit MySQL command: Exit
2. Change the password
Format: Mysqladmin-u username-P Old password password new password
3. Displays the list of databases in the current database server:
mysql> show databases;
4. Display the data tables in the database:
mysql> use database name;
Mysql> Show tables;
5. Display the structure of the data table:
mysql> describe table name;
6. Create a database:
mysql> CREATE database name;
7. Create a data sheet:
mysql> use database name;
Mysql> CREATE table name (field name varchar (20), field name char (1));
8. Delete the database:
mysql> drop database name;
9. Delete the data sheet:
mysql> drop table name;
10. Empty the records in the table:
mysql> Delete from table name;
11. Display the records in the table:
Mysql> select * from table name;
12. Insert a record into the table:
mysql> insert into table name values ("HyQ", "M");
13. Update the data in the table:
Mysql-> Update table name set field name 1= ' A ', field name 2= ' B ' where field name 3= ' C ';
14. Load the data into the data table in text mode:
mysql> Load Data local infile "d:/mysql.txt" into table name;
15. Import the. sql File command:
mysql> use database name;
Mysql> source D:/mysql.sql;
16. Change the root password on the command line:
mysql> Update Mysql.user Set Password=password (' New password ') where user= ' root ';
mysql> flush Privileges;
17. Display the database name for use:
Mysql> Select Database ();
18. Display the current User:
Mysql> Select User ();
Note: Each command is followed by; MySQL allows line-break input commands, which are separated from commands and commands. Note here, otherwise ...
MySQL Common command collection