`
tcspecial
  • 浏览: 909973 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Host '192.168.1.110' is not allowed to connect to this MySQL server

阅读更多
$ mysql -h 192.168.1.8 -u root -p
Enter password:
ERROR 1130: Host '192.168.1.110' is not allowed to connect to this MySQL server

 

$ telnet 192.168.1.110 3306
host 192.168.1.4 is not allowed to connect to this mysql server

 

    mysql 默认安装是不允许远程登陆,只能通过localhost登录,因此你需要为你访问主机授权. 

一. 主机授权

    1.1 为主机192.168.1.110授权

$ mysql -u root -p
Enter password:

mysql> use mysql

mysql> GRANT ALL ON *.* to root@'192.168.1.110' IDENTIFIED BY 'mypass'; 

mysql> FLUSH PRIVILEGES;

   

   1.2 为所有主机授权

GRANT ALL ON *.* to 'root'@'%' IDENTIFIED BY 'scada';
flush privileges;

  

二. 修改用户密码

update mysql.user set password=PASSWORD('mypass') where user='root';              #5.5
update mysql.user set authentication_string=password('mypass') where user='root'; #5.7
flush privileges;

 

三. 添加用户账号

创建账号 greentest,指定数据库mygreen。

 

mysql> CREATE USER 'greentest'@'%' IDENTIFIED BY 'greentest'; 
mysql> GRANT ALL ON mygreen.* TO 'greentest'@'%' IDENTIFIED BY 'greentest';
1044 - Access denied for user 'root'@'%' to database 'mygreen'

 

    由于权限问题,运行报1044错误,在mysql服务器上执行上述代码,一切正常。

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics