ERROR 1130 (HY000): Host '123.32.23.12' is not allowed to connect to this MySQL server

bukanspot

Indra Wahyu

Posted on May 1, 2024

ERROR 1130 (HY000): Host '123.32.23.12' is not allowed to connect to this MySQL server

My Problem

I want to connect to mysql server using my personal computer but I have this error.

ERROR 1130 (HY000): Host '123.32.23.12' is not allowed to connect to this MySQL server
Enter fullscreen mode Exit fullscreen mode

My Solution

Make sure your IP have access to database server

SELECT host FROM mysql.user WHERE User = 'root';
Enter fullscreen mode Exit fullscreen mode

If you only see results with localhost and 127.0.0.1, you cannot connect from an external source. If you see other IP addresses, but not the one you're connecting from - that's also an indication.

You will need to add the IP address of each system that you want to grant access to, and then grant privileges:

CREATE USER 'root'@'ip_address' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'ip_address';
Enter fullscreen mode Exit fullscreen mode

If you see %, well then, there's another problem altogether as that is "any remote source". If however you do want any/all systems to connect via root, use the % wildcard to grant access:

CREATE USER 'root'@'%' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
Enter fullscreen mode Exit fullscreen mode

Finally, reload the permissions, and you should be able to have remote access:

FLUSH PRIVILEGES;
Enter fullscreen mode Exit fullscreen mode

Reference

💖 💪 🙅 🚩
bukanspot
Indra Wahyu

Posted on May 1, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related