数据库远程连接权限配置

登录mysql

GRANT ALL PRIVILEGES ON *.* TO 'username'@'IP' IDENTIFIED BY 'password';

这里的IP填写能访问数据库的ip地址, 如果需要所有地址都能访问,则填%

GRANT ALL ON db.* TO 'username'@'192.168.12.10'  IDENTIFIED BY "123456";
GRANT ALL ON db.table TO 'username'@'192.168.12.%' IDENTIFIED BY "123456";
GRANT ALL ON db.* TO 'username'@'192.168.12.0/24'  IDENTIFIED BY "123456";
GRANT ALL ON *.* TO 'username'@'%' IDENTIFIED BY "123456";

然后刷新权限

FLUSH PRIVILEGES;

附创建用户

CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass';
CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';

查看mysql用户远程连接

select Host,User,Password from mysql.user;

删除远程用户授权

  

  

posted @ 2015-10-06 20:58  chemandy  阅读(443)  评论(0编辑  收藏  举报