I am trying to create a wordpress blog on an Amazon EC2 instance. The amazon base image had apache and php already installed. I installed MySQL manually in my user directory. I am able to login to the MySQL database from linux command line. But I am not able to connect to the MySQL db from php. The scenario I tested was the following. I have a php file which I host through apache. When I open that php file in a browser; the MySQL connection fails. The following is the message in the browser
Error establishing a database connection This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at xxx.xxx.compute-1.amazonaws.com:port. This could mean your host's database server is down. Are you sure you have the correct username and password? Are you sure that you have typed the correct hostname? Are you sure that the database server is running?
My question is. Is it incorrect to manually install MySQL when php has already been installed? I mean is it recommended to compile-install the php with mysql first?
php/apache was already pre-installed in the machine which I instantiated from amazon. It has amazon linux as the OS.
rpm -qa |grep -i httpd httpd-tools-2.2.16-1.0.amzn1.x86_64 httpd-2.2.16-1.0.amzn1.x86_64 rpm -qa |grep -i php php-common-5.3.5-1.11.13.amzn1.x86_64 php-5.3.5-1.11.13.amzn1.x86_64 php-cli-5.3.5-1.11.13.amzn1.x86_64
Thanks. The yum install mysql-server helped a bit. So first I removed my manual installation; and then yum install mysql-server; Additionally yum install -y php php-mysql
I debugged a bit more. What I found is that if I put the wordpress directory under apache root and don't do port forwarding (no Proxy and proxyreverse), then I am able to connect to the DB from the WP install files. However, if I put the WP files under JBoss and do port forwarding from apache to JBoss, then from within JBoss, I am unable to connect through WP php files to the MySQL DB. So the problem is somewhere within the Caucho Quercus part of JBoss. Any suggestions? Thanks