I have an elastic beanstalk ec2 (Amazon Linux 2023) instance and a RDS database (MariaDB 10.11) created inside same region and using same VPC, my databse is accessible only via ssh tunneling, i have a laravel app deployed in the ec2 with following .env credentials for database :
RDS_HOSTNAME=prod-example-db.dafsfduieeikka0.eu-west-1.rds.amazonaws.com
RDS_PORT=3306
RDS_DB_NAME=db_name
RDS_USERNAME=db_username
RDS_PASSWORD=mydbpassword
following aws ebs documentation for deploying laravel app I have modifed a portion of the config/database.php file of laravel as following:
'host' => env('RDS_HOSTNAME', '127.0.0.1'),
'port' => env('RDS_PORT', '3306'),
'database' => env('RDS_DB_NAME', 'forge'),
'username' => env('RDS_USERNAME', 'forge'),
'password' => env('RDS_PASSWORD', ''),
Now i'm getting SQLSTATE[HY000] [1045] Access denied for user 'db_user'@'ip_address' (using password: YES) when i try to visit my site, Can someone tell me what is the problem? Do i have to create a ssh tunnel from inside the ec2 to the RDS db to allow the connection?
Access Deniedmeans that it is successfully connecting to the Amazon RDS database, but the database is rejecting the connection. So, your network configuration and security groups seem to be operating fine. Either you have the wrong database, username or password OR you make Laravel use secure SSL connection while using AWS RDS — Tech.Semicolon. Amazon RDS will reject a connection that is not using SSL.mysql -u db_username -p'mydbpassword' -h prod-example-db.dafsfduieeikka0.eu-west-1.rds.amazonaws.com db_name. Does it allow you to connect successfully?