MySQL创建数据库时指定编码utf8mb4和添加用户


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';即可。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM