ERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQL

When using Mysql account to log in remotely, an error similar to the following appears:
ERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQL 


Solution:

1. Change the table method (maybe your account is not allowed to log in remotely , only on localhost. At this time, as long as the computer on localhost, after logging in to mysql, change the "host" item in the "user" table in the "mysql" database, from "localhost" to "%")

c:/mysql/mysql server 5.1>mysql -u root -p

Enter the corresponding password

mysql>use mysql;

mysql>show tables; (confirm whether the table user exists)

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

mysql>quit

exit mysql

c:/mysql/mysql server 5.1>net stop mysql

c:/mysql/mysql server 5.1>net start mysql

Now connect to this mysql server remotely

c:/mysql/mysql server 5.1>mysql -h 192.168.1.3 -u root -p

2. Authorization method
For example, if you want myuser to use mypassword to connect to the mysql server from any host.

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
if you want to allow user myuser to connect to mysql server from host with ip 192.168.1.3 and use mypassword as password
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

Guess you like

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