在Rc实例上的数据库上在Ec2实例上安装Wordpress [英] Installing Wordpress on Ec2 Instance with the Database on an RDS Instance
问题描述
我想在现有的AWS ec2实例上安装Wordpress. 但是,我收到一个错误:建立数据库连接时出错".
I want to install Wordpress on an existing AWS ec2 instance. However, I get an error: "Error establishing database connection".
我在这里遵循了该教程: http://docs. aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html
I followed the tutorial here:http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html
唯一的区别是,该教程适用于在同一ec2实例上安装MySQL的人,而我希望MySQL在单独的实例(即RDS)上运行.
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).
我执行的步骤:
1)在ec2实例上安装了httpd24,php56和php56-mysqlnd软件包.
1) Installed the httpd24, php56 and php56-mysqlnd packages on the ec2 instance.
2)创建一个具有特权和db的MySQL用户:
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)用适当的值填写wp-config值:
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)本教程中概述的其余说明(允许Apache Web服务器的永久链接和文件权限).
4) The rest of the instructions outlined in the tutorial (allow permalinks and file permissions for Apache web server).
但是,当我输入Wordpress博客的URL时,出现错误: 建立数据库连接时出错".
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?
谢谢.
推荐答案
我通过不为DB用户指定主机(即:'wordpress-user'@'%'
而不是'wordpress-user'@'localhost'
)来完成此工作.
I got this working by not specifying a host for the DB user (ie: 'wordpress-user'@'%'
rather than 'wordpress-user'@'localhost'
).
这篇关于在Rc实例上的数据库上在Ec2实例上安装Wordpress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!