`

Mysql 1130 Host * is not allowed to connect to this MySQL server

 
阅读更多
mysql -u root -p
mysql>use mysql;
mysql>update user set host =’%'where user =’root’;
mysql>flush privileges;
第一种方式将用户host由localhost改成%,即不限制远程连接

 

还有一种授权法,以下是从网上摘抄的:

例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

FLUSH   PRIVILEGES;

如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器,并使用mypassword作为密码

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

FLUSH   PRIVILEGES;

如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器的dk数据库,并使用mypassword作为密码

GRANT ALL PRIVILEGES ON dk.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

FLUSH   PRIVILEGES;

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics