MySQL中有很多的基本命令,show命令也是其中之一,在很多使用者中對show命令的使用還容易產(chǎn)生混淆,
本文匯集了show命令的眾多用法。 
1. show tables或show tables from database_name; -- 顯示當(dāng)前數(shù)據(jù)庫中所有表的名稱。 
2. show databases; -- 顯示mysql中所有數(shù)據(jù)庫的名稱。 
3. show columns from table_name from database_name; 或show columns from database_name.table_name; -- 顯示表中列名稱。 
4. show grants for user_name; -- 顯示一個用戶的權(quán)限,顯示結(jié)果類似于grant 命令。 
5. show index from table_name; -- 顯示表的索引。 
6. show status; -- 顯示一些系統(tǒng)特定資源的信息,例如,正在運行的線程數(shù)量。 
7. show variables; -- 顯示系統(tǒng)變量的名稱和值。 
8. show processlist; -- 顯示系統(tǒng)中正在運行的所有進程,也就是當(dāng)前正在執(zhí)行的查詢。大多數(shù)用戶可以查看他們自己的進程,但是如果他們擁有process權(quán)限,就可以查看所有人的進程,包括密碼。 
9. show table status; -- 顯示當(dāng)前使用或者指定的database中的每個表的信息。信息包括表類型和表的最新更新時間。 
10. show privileges; -- 顯示服務(wù)器所支持的不同權(quán)限。 
11. show create database database_name; -- 顯示create database 語句是否能夠創(chuàng)建指定的數(shù)據(jù)庫。 
12. show create table table_name; -- 顯示create database 語句是否能夠創(chuàng)建指定的數(shù)據(jù)庫。 
13. show engines; -- 顯示安裝以后可用的存儲引擎和默認引擎。 
14. show innodb status; -- 顯示innoDB存儲引擎的狀態(tài)。 
15. show logs; -- 顯示BDB存儲引擎的日志。 
16. show warnings; -- 顯示最后一個執(zhí)行的語句所產(chǎn)生的錯誤、警告和通知。 
17. show errors; -- 只顯示最后一個執(zhí)行語句所產(chǎn)生的錯誤。 
18. show [storage] engines; --顯示安裝后的可用存儲引擎和默認引擎。將會列出所有數(shù)據(jù)庫名字末尾為't'字符的數(shù)據(jù)庫
查看當(dāng)前所使用的數(shù)據(jù)庫:select database();
新聞熱點
疑難解答
圖片精選