MySQL 5.7 MySQL command line client using commands 1. Enter password: ****** 2.ues mysql; use MySQL 3.show databases; display databases 4.use register; use the database name register 5.show tables; Displays the tables in the register database 6.describe user; operate on the user table: 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; exit 1. Display the list of databases in the current database server: mysql> SHOW DATABASES; Note: The mysql database contains MYSQL system information. When we change passwords and add new users, we actually use this database to perform operations. 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 database: mysql> CREATE DATABASE library name; 5. Create a data table: mysql> USE library 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. Clear the records in the table: mysql> DROP TABLE table name; 9. Display the records in the table: mysql> SELECT * FROM tablename; 10. Insert records 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 using text: mysql> LOAD DATA LOCAL INFILE "D:/mysql.txt" INTO TABLE table name; 13. Import .sql file command: mysql> USE database name; mysql> SOURCE d:/mysql.sql; 14. Modify the root password via 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 the detailed explanation of MySQL 5.7 mysql command line client usage commands introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Example of how to set up a third-level domain name in nginx
>>: How to use Nexus to add jar packages to private servers
A process is a program code that runs in the CPU ...
Preface In front-end programming, we often use th...
This article uses an example to describe how to v...
Prepare: MySQL 8.0 Windows zip package download a...
By default, /etc/default/docker configuration wil...
It has been three or four months since I joined Wo...
Table of contents Problem Description What is Vue...
This article uses an example to describe how to c...
First, let’s take a look at the picture: Today we...
Preface Vue provides a wealth of built-in directi...
Learning CSS3 is more about getting familiar with...
A problem that front-end developers often encount...
Written in front Environment: MySQL 5.7+, MySQL d...
Some time ago, I encountered the problem that the...
1. Apache static resource cross-domain access Fin...