Installing Wordpress on Ec2 Instance with the Database on an RDS Instance

冷暖自知 提交于 2019-12-13 06:49:18

问题


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.


回答1:


I got this working by not specifying a host for the DB user (ie: 'wordpress-user'@'%' rather than 'wordpress-user'@'localhost').



来源:https://stackoverflow.com/questions/39153753/installing-wordpress-on-ec2-instance-with-the-database-on-an-rds-instance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!