1. 程式人生 > >mysql的cmd視窗檢視資料庫資訊

mysql的cmd視窗檢視資料庫資訊

 

1.mysql -uroot -p 123456

2.show databases; 檢視全部資料庫

3.select database(); 檢視當前資料庫

4.show variables like 'port';

5. 檢視當前資料庫大小,如檢視springdata庫大小

select concat(round(sum(data_length)/(1024*1024),2) + round(sum(index_length)/(1024*1024),2),'MB') as 'DB Size'
-> from tables
-> where table_schema='springdata';

6. 檢視資料所佔有的空間

select concat(round(sum(data_length)/(1024*1024),2),'MB') as 'DB Size'
-> from tables
-> where table_schema='springdata';

7.檢視索引所佔用的空間

select concat(round(sum(index_length)/(1024*1024),2),'MB') as 'DB Size'
-> from tables
-> where table_schema='INVOICE';

8.檢視資料庫編碼

 show variables like 'character%';

9.status

10.show tables;

11. 檢視許可權

  show grants for 'root'@'localhost';

12.某個人的許可權

show grants for 'root'@'localhost';