title | excerpt | updated |
---|---|---|
Changing the password for a Web Hosting plan’s database |
Find out how to change the password for a database created as part of a Web Hosting plan |
2022-01-26 |
Most websites use a database to store their articles, comments, or users' email addresses.
You can connect to this database using a configuration file contained in the file storage space on your Web Hosting plan. It contains credentials that allows your website to access its database server.
The password change for a database must therefore always be carried out in two places:
-
In your website’s configuration file via the FTP space on your Web Hosting plan.
-
And on the server that contains their database, via the OVHcloud Control Panel.
Until this change is made in both locations, your site will display a "database connection error".
For this reason, if you would like to change your database password, you will need to carry out all of the operations listed in this guide. If you have any doubts about how to proceed, contact your webmaster or contact a specialised service provider.
There are four steps to changing your website’s database password:
- Step 1: identify your website configuration file
- Step 2: identify your website database
- Step 3: change the password for your website database in its configuration file
- Step 4: change the password for your website database on the database server
This guide explains how to change a database password securely.
Warning
OVHcloud is providing you with services for which you are responsible, with regard to their configuration and management. You are therefore responsible for ensuring they function correctly.
This guide is designed to assist you in common tasks as much as possible. Nevertheless, we recommend that you contact a specialist service provider and/or discuss the issue with our community on if you have difficulties or doubts. You can find more information in the Go further section of this guide.
- An OVHcloud Web Hosting plan
- Access to the OVHcloud Control Panel
- A database associated with your hosting
- FTP login details to log in to your hosting’s storage space
In the OVHcloud Control Panel, click on Web Cloud
{.action}, then on Hosting plans
{.action} and finally the hosting plan concerned. Then go to the Multisite
{.action} tab. Identify the name of your site's Root folder
(the directory in which its files and folders are located).
Then click on the FTP-SSH
{.action} tab and go to the space containing your website’s files and folders (the FTP space) by clicking FTP Explorer
{.action}.
[!primary]
If you would like to change the password on your FTP space, please refer to this guide.
If you would like to use another method to log in, please refer to this guide.
Open the Root folder
identified previously.
Locate and open your site's configuration file:
- For a WORDPRESS site, open "wp-config.php".
- For a JOOMLA site, open "configuration.php".
- For a DRUPAL site, click on the "sites" folder, then "default". The configuration file is "settings.php".
- For a PRESTASHOP website, click on the "app" folder, then "config". The configuration file is "parameters.php".
In the configuration file identified in step 1, start by noting down the name of its database:
- For WORDPRESS: The name appears under "DB_NAME".
- For JOOMLA: The name appears under "public $db".
- For DRUPAL: The name appears under "database".
- For PRESTASHOP: The name appears under "database_name".
Then go back to the OVHcloud Control Panel and open the Web Cloud
{.action} section:
- Go to the
Hosting plans
{.action} section, then to the Web Hosting plan concerned. - Click on
Databases
{.action} tab on the right-hand side of your screen. - Locate the database name previously found in the
Database Name
column.
[!primary]
For more information on password management best practices, follow the instructions in this guide.
Choose the new password for your database and save it. It must meet the following conditions:
- Minimum 8 characters
- Maximum 30 characters
- At least one capital letter
- At least one lower-case letter
- At least one number
- Only numbers and letters
As described in step 1, go back to your Web Hosting plan’s file storage space, then open your website’s configuration file for editing.
Before you make any changes, save the content of this file locally in a text document, so that you keep a copy if you make any mistakes.
Manually replace your database password while avoiding changing or deleting any other elements of the configuration file (in the extracts below, only the sample password *0VhCloudPa55w0rdDB123*
should be replaced):
- In the configuration file of a WORDPRESS website, modify "DB_PASSWORD":
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'dbname123');
/** MySQL database username */
define('DB_USER', 'dbname123');
/** MySQL database password */
define('DB_PASSWORD', '0VhCloudPa55w0rdDB123');
/** MySQL hostname */
define('DB_HOST', 'dbname123.mysql.db:3306');
- In the configuration file of a JOOMLA website, modify "public $password" (at the end of the configuration file):
public $host = 'dbname123.mysql.db:3306';
public $user = 'dbname123';
public $password = '0VhCloudPa55w0rdDB123';
public $db = 'dbname123';
- In the configuration file of a DRUPAL website, modify "password":
$databases['default']['default'] = array (
'database' => 'dbname123',
'username' => 'dbname123',
'password' => '0VhCloudPa55w0rdDB123',
'prefix' => 'prefix123_',
'host' => 'dbname123.mysql.db',
'port' => '3306',
- In the configuration file of a PRESTASHOP website, modify "database_password":
'database_host' => 'dbname123.mysql.db',
'database_port' => '3306',
'database_name' => 'dbname123',
'database_user' => 'dbname123',
'database_password' => '0VhCloudPa55w0rdDB123',
Save this change.
[!primary]
This operation will take a few minutes to take effect. Once you have launched it, check its status in the
Ongoing tasks
{.action} tab.
In the Hosting Plans
{.action} section of the OVHcloud Control Panel, go to the Databases
{.action} tab on the right-hand side of your screen:
Next, click on the three dots to the right of your website’s database, then on Change password
{.action}.
In the window that pops up, enter your database’s new password (defined at step 3), confirm it, then click on Confirm
{.action}.
FileZilla software usage with your hosting
Troubleshoot common database errors
For specialised services (SEO, development, etc.), contact your OVHcloud partners.
Join our community of users.