Sharath
Sharath

Reputation: 2428

Access denied for user 'admin'@'MY-IP' (using password: YES) when connecting to MySql RDS in AWS

I am able to connect through the below command and see the databases. But unable to run migration or create tables which results in below error.

Command

mysql -h endpoint.rds.amazonaws.com -u admin -p

Error

SQLSTATE[HY000] [1045] Access denied for user 'admin'@'MY-IP' (using password: YES) 
(SQL: select * from information_schema.tables 
where table_schema = storydb and table_name = migrations and  
table_type = 'BASE TABLE') 

Queries from MySql command line

show databases;
+--------------------+
| Database           |
+--------------------+
| storydb            |
| information_schema |
| mysql              |
| performance_schema |
+--------------------+

select user, host, plugin from mysql.user;
+------------------+-----------+-----------------------+
| user             | host      | plugin                |
+------------------+-----------+-----------------------+
| admin            | %         | mysql_native_password |
| mysql.infoschema | localhost | caching_sha2_password |
| mysql.session    | localhost | caching_sha2_password |
| mysql.sys        | localhost | caching_sha2_password |
| rdsadmin         | localhost | mysql_native_password |
+------------------+-----------+-----------------------+

Configuration

enter image description here

Upvotes: 1

Views: 8722

Answers (1)

Impermanence
Impermanence

Reputation: 184

For those using SSL - RDS (check configuration -> Encryption (enabled)

  1. You need to generate a token as the password (even with auth IAM role)
  2. Get the bundle and then try to connect mysql -h mysqldb.abcd.us-west-2.rds.amazonaws.com --ssl-ca=global-bundle.pem -P 3306 -u myuser --password=$TOKEN

More info on how to generate the token and the bundles : https://aws.amazon.com/premiumsupport/knowledge-center/rds-mysql-access-denied/

Upvotes: 0

Related Questions