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
==================添加用户及授权部分===================
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';即可。