MySQL 5.7 mysql command line client command details, mysql command details
For MySQL 5.7
MySQL command line client command
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 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();
The above is a detailed explanation of MySQL 5.7 mysql command line client command. I hope it will help you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!