Original address: http://blog.csdn.net/jack2009win/article/details/6319261
Feel good to write, copy it.
Semicolons can't forget semicolons can't forget semicolons can't forget
The important thing three times
1. Enter the password: ******
2.ues MySQL; using MySQL
3.show databases; Show database
4.use Register; Use the database named register
5.show tables; Displays the tables in the Register database
6.describe user, operation on table User:
Insert into User (Username,password) VALUES ("XiaoYan", "123456"); Insert data
Insert into User (Username,password) VALUES ("FF", "123456"); Insert data
Delete from user where username= "XiaoYan";
Update user set Username= "XiaoYan" where username= "FF";
select * from user; query data
7.quit; launch
1. Displays the list of databases in the current database server:
Mysql> SHOW DATABASES;
Note: MySQL library has the MySQL system information, we change the password and new users, is actually using this library to operate.
2. Display the data table in the database:
mysql> use library name;
Mysql> SHOW TABLES;
3, display the structure of the data table:
mysql> DESCRIBE table name;
4. Establish the database:
mysql> CREATE database name;
5. Set up the data sheet:
mysql> use library name;
mysql> CREATE table name (field name VARCHAR (20), Field name CHAR (1));
6. Delete the database:
mysql> DROP database name;
7. Delete Data sheet:
mysql> DROP table name;
8. Empty the records in the table:
Mysql> DELETE from table name;
9. Display the records in the table:
Mysql> SELECT * from table name;
10. Insert a record into the table:
mysql> INSERT into table name VALUES ("HyQ", "M");
11. Update the data in the table:
mysql-> UPDATE table name SET field name 1= ' A ', field name 2= ' B ' WHERE field name 3= ' C ';
12. Load data into the data table in text mode:
mysql> LOAD DATA LOCAL INFILE "d:/mysql.txt" into table name;
13. Import the. sql File command:
mysql> use database name;
Mysql> SOURCE D:/mysql.sql;
14, the command line to modify the root password:
mysql> UPDATE mysql.user SET password=password (' New password ') WHERE user= ' root ';
mysql> FLUSH privileges;
15. Display the database name of use:
Mysql> SELECT DATABASE ();
16. Display the current User:
Mysql> SELECT USER ();
MySQL command line client uses commands