MySQL 5.7 mysql command line client usage command details

MySQL 5.7 mysql command line client usage command details

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:
  • 18 common commands in MySQL command line
  • Common operation commands of MySQL in Linux system
  • Centos7 restart apache, nginx, mysql, php-fpm command method
  • How to implement import and export mysql database commands under linux
  • Detailed explanation of the EXPLAIN command and its usage in MySQL
  • MySql common query command operation list
  • Special commands in MySql database query
  • How to use commands in Mysql to achieve hierarchical search help detailed explanation
  • Solve the Chinese garbled problem of mysql5.5 database command line under Windows 10
  • Summary of Commonly Used MySQL Commands in Linux Operating System
  • Mysql uses the kill command to solve the deadlock problem (kill a certain SQL statement being executed)
  • MySQL database source command detailed explanation and examples
  • Common commands for mysql authorization, startup, and service startup

<<:  Example of how to set up a third-level domain name in nginx

>>:  How to use Nexus to add jar packages to private servers

Recommend

4 ways to view processes in LINUX (summary)

A process is a program code that runs in the CPU ...

Summarize the commonly used nth-child selectors

Preface In front-end programming, we often use th...

Detailed explanation of how to view the number of MySQL server threads

This article uses an example to describe how to v...

Windows 10 + mysql 8.0.11 zip installation tutorial detailed

Prepare: MySQL 8.0 Windows zip package download a...

A brief summary of my experience in writing HTML pages

It has been three or four months since I joined Wo...

Vue uses dynamic components to achieve TAB switching effect

Table of contents Problem Description What is Vue...

Example code for Html layered box-shadow effect

First, let’s take a look at the picture: Today we...

Simple steps to write custom instructions in Vue3.0

Preface Vue provides a wealth of built-in directi...

CSS3 to achieve dynamic background gradient effect

Learning CSS3 is more about getting familiar with...

The front-end page pop-up mask prohibits page scrolling

A problem that front-end developers often encount...

About the pitfalls of implementing specified encoding in MySQL

Written in front Environment: MySQL 5.7+, MySQL d...

Solution to Docker disk space cleaning

Some time ago, I encountered the problem that the...