MySQL 5.7 mysql command line client command details
For MySQL 5.7
MySQL command line client command MySQL 5.7 mysql command line client command details
1. Enter the password :******
2. ues mysql; use Mysql
3. show databases; displays the database
4. use register; use the Database Name register
5. show tables; displays the tables in the register database.
6. describe user; operate on the 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"; delete data
Update user set username = "xiaoyan" where username = "ff"; update data
Select * from user; query data
7. quit; quit
1. display the list of databases on the current database server:
Mysql> show databases;
Note: the mysql database contains the MYSQL system information. We change the password and add new users to use this database for operations.
2. display data tables in the database:
Mysql> USE Database Name;
Mysql> show tables;
3. display the data table structure:
Mysql> DESCRIBE table name;
4. Create a database:
Mysql> create database name;
5. Create a data table:
Mysql> USE Database Name;
Mysql> create table Name (field name VARCHAR (20), field name CHAR (1 ));
6. delete a database:
Mysql> drop database name;
7. delete a data table:
Mysql> drop table name;
8. Clear records in the table:
Mysql> drop table name;
9. display the records in the table:
Mysql> SELECT * FROM table name;
10. insert records into the table:
Mysql> insert into table name VALUES ("hyq", "M ");
11. Update table data:
Mysql-> UPDATE table name: SET field name: 1 = 'a'; field name: 2 = 'B' WHERE field name: 3 = 'C ';
12. load data into a 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. Change the root password on the command line:
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 ();