MySQL实现用户添加绑定数据库及设置远程访问


mysql -u root -p

root

use mysql;

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; //最后这个密码会重置用户密码

flush privileges;


grant all privileges on mafeng99.* to 'mafeng99'@'%';


grant all privileges on 库名.表名 to '用户名'@'IP地址' identified by '密码' with grant option; 

flush privileges;



grant select,update on jeecnDB.* to jeecn@localhost identified by ‘jeecn’;

grant 权限1,权限2,…权限n on 数据库名称.表名称 to 用户名@用户地址 identified by ‘连接口令’;


flush privileges;


select host,user from user;


create user sevstudio;

update user set password=password('sevstudio') where user='sevstudio';

grant all privileges on *.* to 'sevstudio'@'%';  授予该用户所有权限,没有identified by '密码' 则会清空用户密码