I started getting an error “ERROR 1130: Host is not allowed to connect to this MySQL server” when I was trying to connect to a new mysql server which i had recently setup somewhere else instead of my own local machine.
After a lot of troubleshooting and reading I found that by default, MySQL does not allow remote clients to connect to the MySQL database. And that was preventing my local machine to connect to this remove server which I have setup.
To actually verify if your local machine is allowed or not you can use the simply telnet command as shown below:
telnet my-sql-server-hostname 3306
If your local machine is not allowed to connect to this mysql host then you will get an error such as:
$ telnet my-sql-server-hostname 3306host 192.168.1.3 is not allowed to connect to this mysql server
$ mysql -u root -p
Enter password:
mysql> use mysql
mysql> GRANT ALL ON *.* to root@'192.168.1.3' IDENTIFIED BY 'mysql-password';
mysql> FLUSH PRIVILEGES;
If you want to allow a specific client ip-address (for example: 192.168.1.3) to access the mysql database running on a server, you should execute the following command on the server that is running the mysql database.
After a lot of troubleshooting and reading I found that by default, MySQL does not allow remote clients to connect to the MySQL database. And that was preventing my local machine to connect to this remove server which I have setup.
To actually verify if your local machine is allowed or not you can use the simply telnet command as shown below:
telnet my-sql-server-hostname 3306
If your local machine is not allowed to connect to this mysql host then you will get an error such as:
$ telnet my-sql-server-hostname 3306host 192.168.1.3 is not allowed to connect to this mysql server
$ mysql -u root -p
Enter password:
mysql> use mysql
mysql> GRANT ALL ON *.* to root@'192.168.1.3' IDENTIFIED BY 'mysql-password';
mysql> FLUSH PRIVILEGES;
If you want to allow a specific client ip-address (for example: 192.168.1.3) to access the mysql database running on a server, you should execute the following command on the server that is running the mysql database.
Also, update firewall rules to make sure port# 3306 is open on the server that is running the mysql database.
After the above changes, when you try to connect to the mysql database from a remote client, you’ll not get the “Host is not allowed to connect to this MySQL server” error message anymore.
No comments:
Post a Comment