天天看點

mysql基本操作(1)

1.mysql資料庫用戶端安裝

brew install mysql-client           

2.mysql 連接配接資料庫

mysql -h <資料庫位址>  -P <端口>  -u <資料庫賬号>  -p           

3.顯示資料庫清單指令

show databases;           

4.切換資料庫

use <dataBassName>           

5.顯示標明資料庫下的表

show tables;           

6.檢視表結構

show colums from <tableName>;         // 或者         describe <tableName>;           

7.檢視資料庫伺服器狀态

show status;           

8.顯示授權使用者

show grants;           

9.顯示伺服器錯誤日志

show errors;         show warnings;           

10.檢索列的不同值

select distinct <column> from <tableName>;           

沐風的原創文章

繼續閱讀