ERROR 1130: Host '192.168.xxx.xxx' is not allowed to connect to this MySQL server(学习笔记)

来源:互联网 发布:1980年电影 知乎 编辑:程序博客网 时间:2024/05/18 01:09

1:25

连接MySQL的时候发生这个错误:

ERROR 1130: Host '192.168.xxx.xxx' is not allowed to connect to this MySQL server

 

1改表法

MySQL server不允许你的远程访问,在MySQL server主机登入mysql后,更改"mysql" 数据库里的 "user" 表里的 "host" 项,"localhost"改"%"

mysql>mysql -u root -p

mysql>use mysql;

mysql>update user set host = '%' where user ='root';

mysql>select host user from user where user ='root';





2、授权法

MySQL服务器端通过授权自设定一个用户名“root”和口令密码“MySQL2010!”客户可以通过此设置定的用户名和口令密码从任何主机连接到MySQL服务器设定的用户名和口令密码本地主机MySQL账号和密码不冲突


mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'MySQL2010!';

mysql>flushprivileges; //刷新






指定固定IP访问:IP为192.168.56.101主机访问MySQL服务器,那么要在MySQL服务器端给其设定一个用户名和口令密码使其登陆访问,设定用户名"hoot""LOVEyou2017@"为口令密码 


mysql>GRANT ALL PRIVILEGES ON *.* TO'hoot'@'192.168.56.101'IDENTIFIED BY'LOVEyou2017@';

mysql>flush privileges;   //刷新




阅读全文
0 0