CREATE DATABASE `wordpress` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE DATABASE `wordpress` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; 1.修改/etc/my.cnf 文件 [client] default-character-set = utf8mb4 [mysqld] character-set-server=utf8mb4 collation-server=utf8mb4_unicode_ci [mysql] default-character-set = utf8mb4 2.重啟Mysql服務 /etc/init.d/mysqld stop /etc/init.d/mysqld start
==================添加用戶及授權部分===================
摘自:Mysql創建、刪除用戶
2.3 授權test用戶擁有testDB數據庫的所有權限(某個數據庫的所有權限):
mysql>grant all privileges on testDB.* to test@localhost identified by '1234';
mysql>flush privileges;//刷新系統權限表
格式:grant權限 on 數據庫.* to 用戶名@登錄主機 identified by "密碼";
2.4 如果想指定部分權限給一用戶,可以這樣來寫:
mysql>grant select,update on testDB.* to test@localhost identified by '1234';
2.5 授權test用戶擁有所有數據庫的某些權限:
mysql>grant select,delete,update,create,drop on *.* to test@"%" identified by "1234";
//test用戶對所有數據庫都有select,delete,update,create,drop 權限。
//對localhost授權:加上一句grant all privileges on testDB.* to test@localhost identified by '1234';即可。