2

I've moved my Craft 3 installation to a new server.

When connecting to the original database, everything works fine.

However, when trying to connect to a new MySQL database (I've tried hosting this on both the new server and RDS) I'm getting the error: Access denied for user. I migrated to the new database by exporting via the Craft CP and then importing to the new database via MySQL Workbench.

I've tried connecting to both servers using a vanilla PHP connection (i.e. new mysqli(host, username, password) and it works perfectly fine -- I can even query the database and return results.

I only run into this error when the connection is opened by the original Craft index.php (the one with the $app->run() command). I've checked the output of the (new Dotenv\Dotenv(CRAFT_BASE_PATH))->load(); line and it does properly return the settings defined in .env, which are the same as the ones used in the vanilla connection I mentioned above.

The side-effect of this error in storage/logs/phperrors.log is Allowed memory size of <memory_limit> bytes exhausted ... in /var/www/craft/vendor/yiisoft/yii2/db/Connection.php.

1 Answer 1

2

Seems this is not a Craft issue at all, but an issue with MySQL connections over PDO. Not sure of the precise environmental conditions that cause this, but I was experiencing the issue on both an AWS EC2 Ubuntu server as well as a MySQL RDS instance.

I discovered the solution here: https://stackoverflow.com/questions/38809418/unable-to-connect-to-aws-rds-through-pdo

In short, the ! in my password was causing the problem. After replacing it with a ., the issue is resolved.

Thanks Amazon...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.