MySQL Admin Command

Show MySQL Meta-data

Using mysql

SQL Description
SELECT VERSION(); Show MySQL version
SHOW DATABASES; Show all DB on this server instance
SELECT DATABASE(); Show current schema
   
SHOW CREATE TABLE db_name.tbl; Show table definition
SHOW TABLES; Show all tables in the current schema
SHOW TABLE STATUS FROM my_db\G Show table information
DESCRIBE table_name; Describe table's column

MySQL System Variables

Showing MySQL Variables

SHOW GLOBAL VARIABLES;
SHOW SESSION VARIABLES;

SHOW GLOBAL VARIABLES LIKE 'SOMENAME%';

SELECT @@GLOBAL.var_name;
SELECT @@session_var_name;

Set MySQL Variables

SET GLOBAL var1 = val1, var2 = val2, SESSION var3 = val3;

SET GLOBAL var1 = val1;
SET @@GLOBAL.var1 = val1;

SET SESSION var1 = val1;
SET @@var1 = val1;

MySQL SHOW

SQL Description
SHOW VARIABLES [LIKE 'some%] Show Mysql variables
SHOW STATUS [LIKE 'some%] Show Mysql status
SHOW INDEX FROM tbl Show table index
SHOW TABLES Show all tables
SHOW ERRORS/WARNINGS Show errors or warnings
SHOW ENGINE engine_name {STATUS | MUTEX} Show engine (say INNODB) status
SHOW PROCESSLIST Show process running in MySQL
SHOW INNODB STATUS Show InnoDB status
SHOW GRANTS [FOR user] Show users grants
SHOW PRIVILEGES Show Mysql Privileges
SHOW PROFILES Resource utilization for statements in this session
SHOW PROFILE FOR QUERY n Resource utilization for statement n in SHOW PROFILES
SHOW TABLE STATUS [LIKE 'some%] Show table status
SHOW CREATE DATABASE mydb; Show database definition
SHOW CREATE TABLE tbl1; Show table definition
SHOW OPEN TABLES Show open tables
SHOW BINARY LOGS; Show binary log file in use
SHOW CREATE EVENT mydb.myevent Show event definition
SHOW CREATE FUCNTION/PROCEDURE/TRIGGER/VIEW/EVENT ... Show corresponding info
SHOW EVENTS/FUNCTION CODE/FUNCTION STATUS/TRIGGERS  
SHOW ENGINES Show all storage engines
SHOW MASTER STATUS Show binary log info in the master
SHOW PLUGINS Show plugins
SHOW PROCEDURE CODE/PROCEDURE STATUS Procedure info
SHOW SCHEDULER STATUS Show event scheduler status
SHOW SLAVE HOSTS/SLAVE STATUS Show slave info

MySQL Flush

FLUSH [LOCAL] LOGS Flush binary log to disk
FLUSH [LOCAL] PRIVILEGES Reload Grant table
FLUSH [LOCAL] QUERY CACHE De-fragment the query cache, no data is clear
FLUSH [LOCAL] STATUS Reset session status
FLUSH [LOCAL] TABLES Flush tables to disk

LOCAL means do not log into the binary log

Other

KILL [CONNECTION | QUERY] thread_id thread id can be found in SHOW PROCESSLIST
RESET QUERY CACHE Clear query cache