I have an application that runs on PHP 5.6 and Laravel 5.2. It's hosted in AWS on an AWS Linux 1 EC2 machine. This web server connects to a RDS MySQL instance. The RDS instance has been running MySQL 5.7 for several years.
MySQL 5.7 passed its end of life at the end of 2023 and Amazon is phasing out standard support for MySQL 5 in RDS. I updated my RDS instance to MYSQ 8.0 this week taking the precautions laid out in this guide.
Here are the things I've done:
-In my Laravel config/database.php file, I have the following:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE'),
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
-In RDS, I've attached a parameter group with the following overwrites:
After saving the above database config values in the parameter group, I've made sure to allow my RDS MySQL instance to finish "modifying" and then restarted the instance via the AWS console.
-I've also made sure the MySQL user that's connecting from the Laravel app has the authentication plugin mysql_native_password (and not the new plugin caching_sha2_password).
-I've tested that I am able to connect to the RDS MySQL instance with the username / password I've provided to the Laravel app via MySQL Workbench
After the above steps, I am receiving the following error:
In addition to the above config (which aligns with all the MySQL 5 to 8 upgrade guides and all questions and answers I've seen around the internet), I've also tried:
-Setting all character_set_* values in my RDS parameter group to utf8mb4 (the default character set in MySQL 8) and collation_* values in the parameter group to utf8mb4_0900_ai_ci (the default collation in MySQL 8).
-Setting my Laravel database config to:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE'),
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_0900_ai_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
to match the new MySQL 8 character set and collation defaults.
-Mixing and matching the above configs in every possible iteration
I haven't been able to get past the SQLSTATE[HY000] [2002] error I posted above.
Has anyone gone through the same MySQL 5 to 8 upgrade process with an older version of Laravel (preferably where the MySQL instance was hosted on RDS) and had to work through the same error?


mysql -u {username} -p{password} -h {remote server ip}?telnet {host IP} 3306for a lower-level check.