Thursday, 7 April 2016

ERROR 1130: Host is not allowed to connect to this MySQL server

Cause: By default MySQL does not allow remote clients to connect to the database.

Solution: If you want to connect to remote MySQL database, you must have grant privilege to your machine IP.

Connect to the MySQL database as root user and then grant privilege to your IP.

$ mysql -u root -p
Enter password:

mysql> use mysql

mysql> GRANT ALL ON *.* to <username>@'<IP of Client>' IDENTIFIED BY 'your-root-password'; 

mysql> FLUSH PRIVILEGES;
Replace username and IP of with your database username and IP of the client machine.