MySQL Service common commands

Source: Internet
Author: User

I. Find out which SQL command is currently being executed by MySQL

Then find out the ID of the statement to terminate
Mysql> Kill ID Number
ID of >mysqladmin-uroot-p123456 kill to kill when not logged in
You can also write it to a file
Not logged in case >mysql-e ' show full processlist; ' > 111.txt;


Two. current MySQL status;
Mysql>show status;
Last line
Threads_connected refers to the current number of connections; Do not like to set the maximum number of connections: Mysql>set GLOBAL max_connections= connections; Let it take effect mysql>flush privileges;

or modify the max_connections in/ETC/MY.CNF and restart
Note In the configuration file:
Set-variable=max_user_connections=30 This is the number of single-user connections
set-variable=max_connections=800 This is the global limit number of connections



Kill all currently executing SQL commands
1. Under the Processlist table below the INFORMATION_SCHEMA library, you can list the SQL that is being executed
Mysql> Select Concat (' KILL ', id, '; ') from information_schema.processlist where user= ' root ';
+------------------------+
| Concat (' KILL ', id, '; ') |
+------------------------+
|             KILL 3101; |
|             KILL 2946; |
+------------------------+
2 rows in Set (0.00 sec)
2. We can then export it to a file under the external file system;
Mysql>select concat (' KILL ', id, '; ') from information_schema.processlist where user= ' root ' into outfile '/tmp/a.txt ';
Query OK, 2 rows Affected (0.00 sec)

3.source come in, the file is finally executed.
mysql>source/tmp/a.txt;
Query OK, 0 rows Affected (0.00 sec)





MySQL Service common commands

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.