We use cookies to improve our services and provide a better experience. By continuing to use this site, you agree with our Cookies Policy.


More than 400 step-by-step articles to guide you through online project development.
HomeTutorialsCMS TutorialsJoomlaJoomla Administration

Could not connect to the database

Cloud Servers 727 x 90

Sometimes you might experience the error “Could not connect to the database” when Joomla is simply unable to connect to the MySQL server. This usually happens after editing the login details of the configuration file or if there is an issue with MySQL server itself. It might also happen after transferring youbsite to the new server where you have forgotten to create the database and import required tables.

Follow these steps to solve database connection issues

First of all, you should make sure there is everything all right with our database. You can check it by connecting to the server control panel and accessing MySQL databases management area. If you are using DirectAdmin, databases are being managed by going to MySQL Management.

DirectAdmin MySQL Management

If you are using cPanel, locate the databases by going to MySQL Databases.

cPanel MySQL Databases
If you can see your database and it’s username in the list, you can assume the database is created in the server and can be used. If there is no such database, you can easily create it in the MySQL management area.

Next thing you need to check is whether the details of the database are correct in the Joomla configuration file. The configuration file can be found in the public_html directory of the Joomla youbsite.

Find and open configuration.php for editing and locate the following lines that are used to define the details of the database:

public $dbtype = 'mysql';
public $host = 'localhost';
public $user = 'database_username';
public $password = 'strong_password';
public $db = 'database_name';
public $dbprefix = 'table_prefix_';

The details above show what database details are currently used by the Joomla youbsite. Therefore, you can use them to test the connection to a MySQL server. This can be done by using a MySQL client like phpMyAdmin. Open it with a youb browser by going to http://domain.com/phpmyadmin/ and a window with the login form should pop up. This is where you can enter the username and password of the database. If the login is correct, you should be able to successfully reach the phpMyAdmin interface. If you get “Wrong username/password. Access denied” you will need to check the database settings in MySQL management area.

By correcting all the issues explained above, you should have your Joomla youbsite up and running again. If you are still facing issues with connecting to the database, you might need to contact to your hosting provider and ask if there are any problems with the MySQL server.

Rate this Tutorial:
No Comments Leave a Comment
Leave a Comment

Cloud Servers 1 230×230

Other (197)

Popular Keywords

Web Banner 3 230×230