Unable to access db from website (credentials)

July 2, 2016 308 views
PHP MariaDB API PHP Frameworks MySQL DigitalOcean Deployment

'Ello, wondering if anyone's ever encountered this one:

Setup laravel forge on a vps from digital ocean, got it all deployed and the website works, but I cannot access my mysql db. It connects successfully but is trying to input the incorrect credentials for access. It's attempting to connect with my previous login credentials from when I was developing locally. It's using my old localhost instead of my new ip, old username, password, etc etc. I've updated the .env file and .env.example just to see if it'd change anything, and I've updated the config/database.php file to try to access it from env variables and I've also tried to hard-code it without success - Still tries to login with my old credentials. I couldn't install my repo to my server via forge so may that have something to do with it? I'm at a loss for this one.

I've tried asking different laravel forums but had no avail, so hopefully someone here may have an answer.


1 Answer

This question was answered by @ryanpq:

Were you able to find those existing credentials anywhere in your deployed filesystem? The easiest way to get to the bottom of this might be to use grep to look recursively through your project and identify where the incorrect information is being loaded from. Something like

cd /your/project/directory
grep -r "somethingunique" .

Using the path to your project for the first command and a unique string (like the db user or password from your local testing) for the second command. This should result in a list of files with snippets showing the results in context and will allow you to find where these incorrect values are coming from.

View the original comment

Have another answer? Share your knowledge.