經常使用系統表
查看當前數據庫鏈接ip信息
– select * from information_schema.PROCESSLISTmysql
當前mysql實例中全部數據庫的信息
– select * from information_schema.SCHEMATAsql
數據庫中的表信息
– select * from information_schema.TABLES數據庫
當前數據庫中的列信息
– select * from information_schema.COLUMNSorm
數據庫中的索引信息
– select * from information_schema.STATISTICS索引
用戶權限
– select * from information_schema.USER_PRIVILEGESip
方案權限
– select * from information_schema.SCHEMA_PRIVILEGESssl
表權限
– select * from information_schema.TABLE_PRIVILEGESio
列權限
– select * from information_schema.COLUMN_PRIVILEGEStable
字符集
– select * from information_schema.CHARACTER_SETSform
字符集 對照信息
– select * from information_schema.COLLATIONS
存在約束的表信息
– select * from information_schema.TABLE_CONSTRAINTS
存在約束的列信息
– select * from information_schema.KEY_COLUMN_USAGE
數據庫中的視圖
– select * from information_schema.VIEWS
觸發器信息
– select * from information_schema.TRIGGERS
經常使用命令
全部數據庫名
– show DATABASES
全部表名
– show TABLES
abc數據庫中的全部表名
– show tables from abc
全部表信息
– show table status
– show table status from abc
表信息
– desc information_schema.TABLES
某表的列信息
– show columns from information_schema.TABLES
某表的建立語句
– show create table test
某數據庫的建立語句
– show create database abc
數據庫的鏈接及操做信息
– show processlist
表狀態 包括表
– show table status
某表的索引信息
– show index from information_schema.tables
系統變量名和值
– show variables
存儲引擎信息
– show ENGINES
顯示當前用戶
– select user()
獲取當前日期
– select now()
獲取當前日期– select dayofmonth(current_date)– select month(current_date)– select year(current_date)