建立数据库连接Amazon EC2时出错-移动我的wordpress博客后
将wordpress博客移至Amazon EC2后,出现错误:建立数据库连接时出错。我已经检查了wp-config.php文件,并且设置正常(本地主机,密码和用户名)。
I am getting the error: "error establishing a database connection" after moving my wordpress blog to Amazon EC2. I've checked the wp-config.php file and settings are ok (localhost, password and username).
我在这里阅读了很多问题和答案,但是没有任何帮助。
I've read many of the questions and answers here but nothing helped me.
我具有shell访问权限,因此我可以检查您需要我执行的所有操作。也许我应该查看phpmyadmin的配置文件,看看那里有什么数据库连接设置,因为phpmyadmin可以工作,但是我不知道它在哪里。
I have shell access so I can check everything that you need me to do. Maybe I should look at the configuration file for phpmyadmin to see what db connection settings are there, because phpmyadmin works, but I don't know where it is.
谢谢
对我来说,重新启动mysqld服务即可。但是,当我执行 sudo服务mysqld restart
时,MySql服务就停止了,但是没有启动。 sudo服务mysqld start
给出了 MySQL Deamon无法启动错误。我花了很多时间尝试启动该服务,但我想真正的罪魁祸首是httpd服务。我停止了httpd服务 sudo服务httpd stop
。现在执行 sudo服务mysqld restart
,然后将wordpress网站重新联机(记住要启动httpd服务)。这听起来有些la脚,但它确实有效,从我发现MySQL DB停止运行的原因有很多,查看日志并找出实际原因是唯一对我有用的东西。
For me just restarting the mysqld service worked. There was a hitch though, as soon as I executed sudo service mysqld restart
the MySql service stopped but didn't start. sudo services mysqld start
gave a MySQL Deamon Failed to Start Error. I spent a lot of time trying to start the service but I guess the real culprit was the httpd service. I stopped the httpd service sudo service httpd stop
. Now execute sudo service mysqld restart
and bingo the wordpress site was back online(remember to start the httpd service). This sounds kind of lame but it worked, from what I figured out the MySQL DB stops for a number of reasons looking at the log and figuring out the actual reason is the only thing that works for me.