1. 创建用户
use mysql;
create user 'your_username'@'%' identified by 'your_passwd';
2. 创建库
create database your_db_name character set utf8;
3.1 为用户添加该库的所有权限
grant all privileges on your_db_name.* to 'your_username'@'%';
flush privileges;
3.2 为用户添加该库的只读权限
grant select privileges on your_db_name.* to 'your_username'@'%';
flush privileges;
3.3 为用户添加root权限
grant all privileges on *.* to 'your_username'@'%' with grant option;
flush privileges;
网友评论