by XDK
23. August 2019 20:59
Explanation:
The mention exception occurred while connecting to MySQL database instance remotely.
Exception:
ubuntu@ip-10-0-1-14:~$ sudo mysql -u root -p -h 10.0.2.227
Enter password:
ERROR 1130 (HY000): Host '10.0.1.14' is not allowed to connect to this MySQL server
Solution:
Login to the data tier where MYSQL server --> Login to MYSQL --> Execute the following steps.
ubuntu@ip-10-0-2-227:~$ sudo mysql -u root -p
mysql> SELECT host FROM mysql.user WHERE User = 'root';
+-----------+
| host |
+-----------+
| localhost |
+-----------+
1 row in set (0.00 sec)
mysql> CREATE USER 'root'@'10.0.1.14' IDENTIFIED BY '*****';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.0.1.14';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT host FROM mysql.user WHERE User = 'root';
+-----------+
| host |
+-----------+
| 10.0.1.14 |
| localhost |
+-----------+
2 rows in set (0.00 sec)
ubuntu@ip-10-0-1-14:~$ sudo mysql -u root -p -h 10.0.2.227
fbe21dd0-834c-4f3c-81d3-ce393efca7af|0|.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
Tags: exceptions
MySQL