Reputation: 311
Trying to root access our EC2 instance locally with Heidi, produces the error message, using external IP in client:
SQL Error (1045) in statement #0: Access denied for user 'root'@'internal.host.net' (using password: YES)
Connecting with the internal IP, produces different error:
SQL Error (2003) in statement #0: Can't connect to MySQL server on '10.0.5.152' (10060)
The /etc/hosts
:
127.0.0.1 localhost
No internal IP line, and no line of EC2 external hostname as:
10.0.5.152 hostname
+--------------------------------------+
| Grants for @localhost |
+--------------------------------------+
| GRANT USAGE ON *.* TO ''@'localhost' |
+--------------------------------------+
+----------------------------------------------------------------------------------------------------------------------------------------+ | Grants for root@localhost | +----------------------------------------------------------------------------------------------------------------------------------------+ | GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*D0**********' WITH GRANT OPTION | +----------------------------------------------------------------------------------------------------------------------------------------+
user
root localhost
root ip-10-0-5-152
root 127.0.0.1
localhost
ip-10.0.5.152
Command I have executed is:
mysql> grant all privileges on *.* to 'root'@'%' with grant option;
Query OK, 0 rows affected (0.00 sec)
Upvotes: 1
Views: 2735
Reputation: 2440
i faced similar problem, so for that i created new user by granting all the privileges and then i connected on ec2-instance and it was allowing me to connect after then, you can also do the same,
below are the steps.
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'your_public_ip' WITH GRANT OPTION;
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;
Upvotes: 1