[MySQL] query command

Source: Internet
Author: User

Tables/databases/processlist/user
Showtables or showtablesfromdatabase_name;
Explanation: displays the names of all tables in the current database.
Showdatabases;
Explanation: displays the names of all databases in mysql.
Showprocesslist;
Explanation: displays all processes running in the system, that is, the query currently being executed. Most users can view
Their own processes, but if they have the process permission, they can view all processes, including passwords.
ShowgrantsforX_user;


Table
Desctable;
Explanation: display table structure
Showtablestatus;
Explanation: displays information about each table in the currently used or specified database. Information includes the table type and the latest update time of the table.
Showcolumnsfromtable_namefromdatabase_name; or showcolumnsfromdatabase_name.table_name;
Explanation: displays the column name in the table.
Showindexfromtable_name;
Explanation: displays the table index.

Warnings/errors
Showwarnings;
Explanation: displays errors, warnings, and notifications generated by the last executed statement.
Showerrors;
Explanation: only displays Errors generated by the last statement.

Procedure
Select 'name' frommysql. procwheredb = 'your _ db_name 'and 'type' = 'processed'
Showprocedurestatus;
Showcreateprocedureproc_name;
Showcreatefunctionfunc_name;

Binlog
Showbinlogevents [IN 'Log _ name'] [FROMpos] [LIMIT [offset] row_count]

Mysqlbinlog -- start-date = '2017-09-051: 24' -- stop-date = '2017-09-051: 26 '/mysqlLog/up04/logs/mysql-bin.011557-v-v -- base64-output = DECODE-ROWS>/data/jiangxu4.txt
Mysqlbinlog -- start-position = "63933950" -- stop-position = "63940929"/mysqlLog/up04/logs/mysql-bin.011557 -- no-defaults-v -- base64-output = DECODE-ROWS

Other
Showgrantsforuser_name @ localhost;
Explanation: displays the permissions of a user. The display result is similar to the grant command.
Showstatus;
Explanation: displays information about specific system resources, such as the number of running threads.
Showvariables;
Explanation: displays the name and value of the system variable.
Showprivileges;
Explanation: display different permissions supported by the server
Showcreatedatabasedatabase_name;
Explanation: whether the createdatabase statement can create a specified database
Showcreatetabletable_name;
Explanation: whether the createdatabase statement can create a specified database
Showengies;
Explanation: displays available storage engines and default engines after installation.
Showinnodbstatus;
Explanation: displays the innodb Storage engine status.
Showlogs;
Explanation: displays bdb storage engine logs.

EVENT
SHOWVARIABLESLIKE 'event _ schedation ';
Explanation: display the event activation status
SETGLOBALevent_scheduler = ON;
Explanation: Enable event

Triggers
UseXXDB; showtriggers;
Usexxdb; droptrigger 'triggers _ name ',
Usexxdb; showtrigger 'triggers _ name ',
Explanation: View and delete a trigger.

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.