Joomla: Database Error: Unable to connect to the database
Joomla stores everything in a database. If the connection to the database fails, you'll get the message Database Error: Unable to connect to the database: Could not connect to MySQL.
The connection details are in the file configuration.php in the Joomla folder:
public $host = 'localhost'; // altijd localhost public $user = 'gebruiker_dbuser'; // je DA-gebruikersnaam, liggend streepje, database-gebruiker public $db = 'gebruiker_dbnaam'; // je DA-gebruikersnaam, liggend streepje, databasenaam public $password = 'wachtwoord'; // het wachtwoord van de database-gebruiker
If any of these details is incorrect, you'll get this error. Here's how to check:
- Log in to DirectAdmin and click MySQL Management under Account Manager.
- Check that the database and the user from configuration.php are listed. Under Manage Users you can see which users have access.
- Not sure about the password? Change the password of the database user and enter the same password in configuration.php.
If you installed Joomla with Installatron, you can also see there which database the site uses.
See also in the DirectAdmin manual: 'Error establishing a database connection'.
Detailed explanation with screenshots: Database users, privileges and passwords in the DirectAdmin manual.
