by XDK
23. August 2019 21:24
Explanation:
The mention exception occurred while granting privileges to the MySQL instance database.
Exception:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.0.1.14';
ERROR 1045 (28000): Access denied for user 'root'@'10.0.1.14' (using password: YES)
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 current_user();
+----------------+
| current_user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
mysql> SELECT host,user,Grant_priv,Super_priv FROM mysql.user where user = 'root';
+-----------+------+------------+------------+
| host | user | Grant_priv | Super_priv |
+-----------+------+------------+------------+
| localhost | root | Y | Y |
| 10.0.1.14 | root | N | Y |
+-----------+------+------------+------------+
2 rows in set (0.00 sec)
mysql> UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 2 Changed: 1 Warnings: 0
mysql> SELECT host,user,Grant_priv,Super_priv FROM mysql.user where user = 'root';
+-----------+------+------------+------------+
| host | user | Grant_priv | Super_priv |
+-----------+------+------------+------------+
| localhost | root | Y | Y |
| 10.0.1.14 | root | Y | Y |
+-----------+------+------------+------------+
2 rows in set (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.0.1.14';
fe649310-a11c-46f4-afc1-3622ac42c8db|1|1.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
Tags: exceptions
MySQL