Joomla Database Connect Errors
There are two cases when you might be getting these error:
1. Can't connect to database during Joomla! installation
Check that you're entering the database login details correctly. Yes, you may be sure they're correct, but go back to the cPanel and do copy and paste of the database name and user name. Here's a checklist on what to do.
- Log in to your cPanel
- Click on 'MySQL Databases'
- Under 'Current Databases', copy and paste the database name you are planning to use for your Joomla installation. Make sure you don't copy any spaces before or after the name.
- Under 'Current Databases', make sure there is a user assigned to the database you will be using, and that it's the same user you are entering in the Joomla registration screen. Again copy and paste if you need to, without copying any extra spaces on the ends.
- Click on the user assigned to the database and make sure that this user has all the privileges to run Joomla. At the very minimum it should have the privileges to SELECT, DROP, INSERT, DELETE, UPDATE, CREATE.
- You might create a new database, to make sure the password you think you're using for that user is correct.
2. Can't connect to database after Joomla! has been installed
Possible cause: Have you moved your site to another server?
Solution: Go to your Joomla! files and open the configuration.php file. Make sure the values 'var $user' and 'var $db' are set correctly. Follow the steps above to make sure the database and user exist on the new server and the values are correct.
Possible cause: Have you deleted the database Joomla was running on, or the user that had access to that database?
Solution: Go to 'MySQL Databases' in your cPanel to double check.
Possible cause: Did you install a new plugin/extension/module recently?
Solution: Try uninstalling the plugin to see if that was the cause of the problem.
Possible cause: Your MySQL server may be down. That could happen even if the static content of your website is showing up, since databases may be stored on a different server than the files.
Solution: Give it a few minutes and check again. Email your host if the server is down for a long time.