I want to install Wordpress on an existing AWS ec2 instance. However, I get an error: "Error establishing database connection".
I followed the tutorial here:http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html
The only difference is that the tutorial is for people who are installing MySQL on the same ec2 instance while I wish to have MySQL run on a separate instance (ie: RDS).
The steps I carried out:
1) Installed the httpd24, php56 and php56-mysqlnd packages on the ec2 instance.
2) Created a MySQL user with privileges and db:
CREATE USER 'wordpress-user'@'localhost' IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON `wordpress-db`.* TO "wordpress-user"@"localhost";
3) Filled out the wp-config values with the appropriate values:
define('DB_USER', 'wordpress-user'); //without the "@'localhost'" part
define('DB_HOST', '[RDS endpoint]:3306');
4) The rest of the instructions outlined in the tutorial (allow permalinks and file permissions for Apache web server).
However, when I enter the url of the Wordpress blog I get the error: "Error establishing database connection".
Does anyone have any suggestions for what's wrong with my setup?
Thank you.
I got this working by not specifying a host for the DB user (ie:
'wordpress-user'@'%'
rather than'wordpress-user'@'localhost'
).