Monday 9 June 2014

MySQL show commands

MySQL command prompt provides lots of show commands to view the database objects and status. Here is a short summary of show commands:


show tables or show tables from database_name
Explaination: show all tables in current database
show databases;
Explaination: show databases in current server
show processlist;
Explaination: show all running processes associated with the user, if the user has been granted with process privilege, he can check all processes in the server.
show table status;
Explanation: show table detailed status.
show columns from table_name from database_name; 
show columns from database_name.table_name;
Explanation: show table columns = desc [tablename]
show grants for user_name@localhost;
Explanation: show the users privileges;
show index from table_name;
Explanation: show index for the table;
show status;
Explanation: show database very detailed status such as threads numbers, lock numbers, uptime, etc. 
show variables;
Explanation: show variables and the values
show privileges;
Explanation: show different privileges database supports. 
show create database database_name;
Explanation: show create database command syntax
show create table table_name;
Explanation: show create table command syntax 
show engies;
Explanation: show available data engines and the default one.
show innodb status;
Explanation: show innoDB store engine status
show logs;
Explanation: show BDB store engine log status
show warnings;
Explanation: show the last commands warning messages
show errors;
Explanation: show the last commands error messages

No comments:

Post a Comment