Link to home
Start Free TrialLog in
Avatar of Pete Long
Pete LongFlag for United Kingdom of Great Britain and Northern Ireland

asked on

WordPress Website MySQL connection Problem

Centos VPS running Mysql 5.1

1 site running perfectly under an SQL account created when the site was built.

Created a new database with a new account and gave the account full privileges. Then installed WordPress and got the cannot connect to database error.

Then I created a new user, and also gave it access to the new database, same issue.

Then tried to use the account that works on the perfectly working site, and then get an issue saying “cannot select database”. Gave a working user account full privileges on new database and then get the “cannot connect to database error”

Logging into the VPS I can connect to MySql and create tables in the database will all users created. It appears to be an issue with the websites or PHP connecting to the databases?
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Pete Long

ASKER

Returns

http://www.randomjoke.co.uk/contest.php

Testing with legacy MySQL lib ... 
Unable to select database

Open in new window


BUT using the same code in a known good working Wordpress site on the same VPS returns the same error?

I'm using  

define('gb_server', 'localhost');

Open in new window


Is that the problem?

Bear in mind the main wordpress site is up and had been running for  along time this is a new (additional) site on the same server
Actually testing the account with new credentials now gives a response time with your script however the WP install still gives a cannot connect to DB error.

Just created another site , non worpdress, that is a basic script that calls a DB, it alsop gets a response however when you try and access the db through the site it fails.

Something strange is going on as PHP appears to log in.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I actually found out what was wrong, I believe I had 2 issues....

You are correct that the credentials were wrong, I changed them but it did not works still..

the reason APC cache, even though I had noti installed it for this site it had cached them on this virtual host! simply flushed the cache and away it went...thanks!!

My only issue now is another site I tested has the same issue with just a white screen , however I think that is a PHP issue.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No Pete is a colleagure of mine who asked the question, he is not available now so I im using my account. He will mark it as answered on hiseturn :)
Don't Panic! I asked the Question for my colleague :) (he had no Q points left)

You Sorted now Al?

Pete