Home >Database >Mysql Tutorial >Why is My Remote MySQL Connection Blocked (Error 1130)?
Remote Connection Blocked: Error 1130
Upon encountering the error "ERROR 1130 (HY000): Host 'xxx.xxx.xxx.xxx' is not allowed to connect to this MySQL server," you may find yourself unable to connect to your MySQL database remotely. This issue arises due to restricted access permissions on your root account.
To resolve this, you need to check your MySQL user table to verify the host(s) allowed for the root account. Run the following query:
SELECT host FROM mysql.user WHERE User = 'root';
If the results only show 'localhost' or '127.0.0.1,' you're restricted to local access. To grant remote access, add the IP address of the connecting system and grant privileges:
CREATE USER 'root'@'ip_address' IDENTIFIED BY 'some_pass'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'ip_address';
Alternatively, you can grant access to all systems using the wildcard symbol:
CREATE USER 'root'@'%' IDENTIFIED BY 'some_pass'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
Finally, reload the permissions with FLUSH PRIVILEGES; to apply the changes. After this, you should be able to connect from a remote host.
The above is the detailed content of Why is My Remote MySQL Connection Blocked (Error 1130)?. For more information, please follow other related articles on the PHP Chinese website!