Knowledge base
1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Resolve a disconnection between Joomla and MySQL
This guide is for users who are making changes around a hosting environment where Joomla is installed.
If you need to update the connection between the MySQL database and your Joomla site (to avoid the error "Database connection error: could not connect to mysql" for example), then this guide details how to proceed.
Elements to Modify
Here are the details to adjust in the configuration.php file to ensure your Joomla site works (typically, a prefix has been added in front of the existing database name and username):
- the MySQL database name (dbname before, abcd_dbname after for example)
- the MySQL database host server (mysql.domain.xyz before, abcd.myd.infomaniak.com after for example)
- the username accessing the MySQL database (userdb before, abcd_userdb after for example)
- the paths of the following two directories: /tmp and /logs
Modify the Joomla configuration.php file
To do this:
- Log in to the Infomaniak Manager (manager.infomaniak.com) from a web browser like Brave or Edge
- Click on the icon in the top right corner of the interface (or navigate using the left sidebar menu for example)
- Choose Website (under Web & Domain)
- Click on the name of the relevant item in the displayed table
- Click on the Advanced Settings button
- Under the PHP tab, click on PHP Information
- Copy the path on the right of the line _SERVER['DOCUMENT_ROOT']
- In the left sidebar menu, click on Databases
- Find and retain your current MySQL information according to the above list (help: https://faq.infomaniak.com/1981)
- In the left sidebar menu, click on FTP/SSH
- Create an FTP account: https://faq.infomaniak.com/1982
- Connect via FTP: https://faq.infomaniak.com/1130
- Edit the configuration.php file located in the root directory of your Joomla
- Find the relevant paragraph and update the 4 pieces of information (according to the list above)
- Don't forget to replace the old path (including "www") with the new path:
- Save the file and that's it, your Joomla site will now connect to the correct database
a
Verify the Changes Made
In the Joomla interface, you can check the paths of the /logs and /tmp directories:
- for the /logs directory: go to System / Configuration then System
- for the /tmp directory: go to System / Configuration then Server
Link to this FAQ: