Mysql advanced SQL statement

 

show processlist; only list the first 100, if you want to list all, please use show full processlist; 

 

show columns from table_name from database_name; 或show columns from database_name.table_name;或show fields;

Explanation: Display the column names in the table (same effect as the desc table_name command)

 

Check the number of connections and status

show variables like '%max_connections%'

 

After logging in to MySQL from the command line. Set the new MySQL maximum number of connections to 200:
MySQL> set global max_connections=200.

 

show processlist;

KILL QUERY thread_id;

 

show index from user;

or

show keys from user;

Explanation: Display the index of the table

 

show status;

Explanation: Displays information about some system-specific resources, for example, the number of running threads

 

show variables;

Explanation: Display the names and values ​​of system variables

 

show privileges;

Explanation: Display the different permissions supported by the server

 

show create database database_name;

Explanation: Display the SQL statement to create the specified database

 

show create table table_name;

Explanation: Display the SQL statement to create the specified data table

 

show innodb status;

Explanation: Displays the status of the innoDB storage engine

 

show logs;

Explanation: Display the logs of the BDB storage engine

 

show warnings;

Explanation: Displays errors, warnings, and notifications from the last executed statement

 

show errors;

Explanation: Display only the errors generated by the last executed statement

 

SELECT now(),version();

Guess you like

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