MySQL Common commands

Source: Internet
Author: User
Tags mysql client

1, install the MySQL client on Linux, then enter the MySQL console with the following command, then you can execute various SQL statements:

mysql-h10.2.120.1-utest-p123456
Use DB1

Where 10.2.120.1 is the IP address of MySQL, the default port number 3306,test is the user name, 123456 is the password, and DB1 is the name of the DB instance.

2, execute the following command, export the entire database SQL script (table structure + data):

mysqldump-h10.2.120.1-utest-p123456 db1 >./db1.sql

Where DB1 is the name of the DB instance.

3. Export the structure and data for the specified table in the specified database:

mysqldump-h10.2.120.1-utest-p123456 db1 table1 >./table1.sql

Where DB1 is the name of the DB instance, and Table1 is the name of the table to be exported.

4. Export the structure and data of the specified table in the specified database, using the specified where condition filter:

mysqldump-h10.2.120.1-utest-p123456 db1 table1--where= "xxx" >/table1.sql

Where DB1 is the name of the database instance, Table1 is the name of the table to be exported, and XXX is the Where condition.

5. View MySQL Database status:

mysql> status;

6. View the value of the specified variable:

Mysql> Show variables like '%max_connections% ';

7. View the list of currently executing commands:

Mysql> show Processlist;

8. Terminate the specified command:

Mysql> Kill process_id

Specific process_id can be obtained through the show processlist command.

MySQL Common commands

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.