message from server: "Host is not allowed to connect to this MySQL server"解决办法

报错:1130-host ... is not allowed to connect to this MySQL server

Solution:

1. Change the table method

        It may be that your account is not allowed to log in from the remote, only on localhost. At this time, as long as you are on the localhost computer, after logging in to mysql, change the "host" item in the "user" table in the "mysql" database, from "localhost" to "%"

mysql -u root -pvmwaremysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
mysql>FLUSH RIVILEGES

 

2. Authorization Law

        For example, you want the user bijian to connect to the mysql server from any host using the password 123456.

GRANT ALL PRIVILEGES ON *.* TO 'bijian'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

FLUSH   PRIVILEGES;

        If you want to allow user bijian to connect to mysql server from host with ip 192.168.1.3 and use 123456 as password.

GRANT ALL PRIVILEGES ON *.* TO 'bijian'@'192.168.1.3' IDENTIFIED BY '123456' WITH GRANT OPTION;

FLUSH   PRIVILEGES;

        If you want to allow user bijian to connect to dk database of mysql server from host with ip 192.168.1.3 and use 123456 as password.

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

FLUSH   PRIVILEGES;

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326697300&siteId=291194637