MySQL database connection 1130-host XXX is not allowed to connect to this MySql server, MySQL does not allow remote access methods

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 -p password (initialize root user without password);

mysql>show databases;

mysql>use mysql;

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

mysql>select host, user from user;

2. Authorization Law.

For example, if you want root to connect to mysql server from any host using pwd.

1、GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'pwd' WITH GRANT OPTION;

2、FLUSH   PRIVILEGES;

If you want to allow user root to connect to mysql server from host with ip 192.168.1.6 and use pwd as password

1、GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.3' IDENTIFIED BY 'pwd' WITH GRANT OPTION;

2、FLUSH   PRIVILEGES;

If you want to allow user root to connect to xxx database of mysql server from host with ip 192.168.1.6 and use pwd as password

1、GRANT ALL PRIVILEGES ON XXX.* TO 'root'@'192.168.1.3' IDENTIFIED BY 'pwd' WITH GRANT OPTION;

2、FLUSH   PRIVILEGES;

===============================================================

Steps:

On the machine where mysql is installed run:

1. Execute GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION on the MySQL mysql Command Line Client side //Grant any host permission to access data

2. mysql>FLUSH PRIVILEGES //The modification takes effect

3. mysql>EXIT //Exit MySQL server

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325899475&siteId=291194637
Recommended