Trying to get an old site up & running on a new server (EE 2)

Have changed the credentials in database.php to one for the new MySQL db.

However, the site errors with "Failed to connect to MySQL: Access denied for user 'OLDUSER'@'localhost' (using password: YES) "

with 'olduser' being the previous MySQL account before database.php was edited.

So it looks like it's cached somewhere, or is being overridden elsewhere.

I've searched for this username in the php files and can't see it anywhere else so am a little stumped.

Could anyone give me any pointers?



When moving servers, did you blanket copy files like the php.ini file and the Apache virtual hosts files? It could be an environment variable set in either of those places.

Look at your index.php files and also look for some form of config.php in your web-root and config folder.

Stuff like https://github.com/focuslabllc/ee-master-config (and other vendor configuration systems) exists in some installs, especially back in EE2 days, so you have to look a bit deeper. The reason I'm guessing it could be an environment variable is because you searched your code base for the username and it didn't show up, but if your database credentials were set as environment variables they might show up in config file looking like this:

$db['expressionengine']['username'] = getenv('DB_USERNAME');

So searching your codebase for that username might be fruitless.


Many thanks for you input.

After a good steer from a web dev colleague, who pointed out that as admin.php was working, the database must be connecting and the error was being generated elsewhere.

So I searched the dump of the DB itself and found the old credentials in a page that was itself stored in the DB.

So we're working now... why it was set up like that I don't really know, but there you go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.