Database

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

If you are trying to access your database server remotely and getting below error during MySQL login:

Error:

“ERROR 1130 (HY000): Host ‘10.120.152.137’ is not allowed to connect to this MySQL server”

Then this article will help you to resolve this issue. In this article I will show you how to fix this error.

Mostly this error comes when your root user only have been added with localhost access. You can check using below command, first of all go to your mysql database server and type the below command to check:

mysql> SELECT host FROM mysql.user WHERE User = 'root';
+-----------+
| host      |
+-----------+
| 127.0.0.1 |
| ::1       |
| localhost |
+-----------+
3 rows in set (0.00 sec)

As you can see that root is only allowed from localhost 127.0.0.1. you cannot connect from an external source. If you see other IP addresses.

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

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

You can also allow your root to connect from any remote source use the below command:

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

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

FLUSH PRIVILEGES;

If still you are getting same error check open your my.cnf file and check for below line:

bind-address  = 127.0.0.1

Now Comment out the bind address from the file /etc/mysql/my.cnf.

#bind-address  = 127.0.0.1

Next restart mysqld service to apply above changes.

# /etc/init.d/mysqld restart
Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

3 Comments

Leave a Comment