1. 程式人生 > >mac os 啟動mysql指令及一些指令

mac os 啟動mysql指令及一些指令

終端進入mysql:

user$ /usr/local/mysql/bin/mysql -uroot -p 

啟動/停止/重啟mysql服務:

user$ sudo /usr/local/MySQL/support-file/mysql.server start

user$ sudo /usr/local/MySQL/support-file/mysql.server stop

user$ sudo /usr/local/MySQL/support-file/mysql.server restart

修改資料庫表編碼:

mysql>alter table tablename convert to character set utf8mb4 collate utf8mb4_unicode_ci;

修改資料庫編碼:

mysql>alter database databasename character set utf8mb4 collate utf8mb4_unicode_ci;

mysql匯入.sql檔案

mysql>use databasename;
mysql>source /${Path}/name.sql