mysql command line client use command

1. Enter the password: ******
2.ues MySQL; use Mysql
3.show databases; display the database
4.use register; use the database name register
5.show tables; display the tables in the register database
6.describe user ;Operate 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"; delete data
update user set username="xiaoyan" where username="ff"; update data
select * from user; query data

7.quit; launch
1. Display the list of databases in the current database server :
mysql> SHOW DATABASES;
Note: There is MYSQL system information in the mysql library. When we change the password and add new users, we actually use this library to operate.
2. Display the data tables in the database:
mysql> USE library name;
mysql> SHOW TABLES;

mysql> DESCRIBE table name;
4. Create database:
mysql> CREATE DATABASE database name;
5. Create data table:
mysql> USE database name;
mysql> CREATE TABLE table name (field name VARCHAR(20), field name CHAR(1) );
6. Delete the database:
mysql> DROP DATABASE library name;
7. Delete the data table:
mysql> DROP TABLE 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 records into the table:
mysql> INSERT INTO table name VALUES ("hyq", "M");
11. Update 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 Table name;
13. Import the .sql file command:
mysql> USE database name;
mysql> SOURCE d:/mysql. sql;
14. Modify 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();

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326799455&siteId=291194637