mysql用户不能远程登录的有关问题

mysql用户不能远程登录的问题

Host ’60-248-32-13.HINET-IP.hinet.net’ is not allowed to connect to this,出现这个错误的原因是权限问题。mysql的root用户默认不允许远程登录,主要是考虑到安全问题吧。在mysql库的user表中,记录了root用户只允许本机登录。可以通过查看user表的数据看出:

?

mysql> select host,user,password from user;

+———–+——+——————————————-+

| host ? ? ? | user | password ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|

+———–+——+——————————————-+

| localhost | root | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |

| cenos11g| root | ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |

| 127.0.0.1 | root | ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |

| ::1 ? ? ? ??| root | ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |

| localhost | ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |

| cenos11g ?| ? ? ?| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |

+———– ?+——+——————————————-+

解决方案:

先在本机用root登录

[root@cenos11g ~]# mysql -uroot -p

?mysql>?grant select,update,delete,insert on *.* to root@192.168.3.1 identified by “mysql”;

语法:
GRANT SELECT,INSERT,UPDATE,DELETE ON [db_name].* TO [username]@[ipadd] identified by ’[password]’;

by ’[password]’;

[username]:远程登入的使用者代码

[db_name]:表示欲开放给使用者的数据库称

[password]:远程登入的使用者密码

[ipadd]:IP地址或者IP反查后的DNS Name

?

mysql用户不能远程登录的有关问题

相关文章:

你感兴趣的文章:

标签云: