Symptoms
WordPress website is not accessible after migration with the following error:
Error establishing a database connection
Cause
Users’ database passwords are not correct on the source server.
Resolution
Use one of the following workarounds:
-
Set the correct database user password in the
/var/www/vhost/example.com/httpdocs/wp-config.php
file on the source server using Plesk File Manager or SSH connection and re-migrate the subscription. -
If content re-syncing is not planned or is not possible, update the database password as follows:
Update the database password on the destination server
-
Go to Domains > example.com > File Manager and find the
wp-config.php
file in the domain directory. -
Open
wp-config.php
and find the first lines defining the database, database user, database password and database server address, like the following:/** The name of the database for WordPress /
define('DB_NAME', 'dbname');
/* MySQL database username /
define('DB_USER', 'username');
/* MySQL database password */
define('DB_PASSWORD', 'password');
/** MySQL hostname */
define('DB_HOST', '203.0.113.2:3306'); -
Copy the password (without the
''
symbols). -
Go to Domains > example.com > Databases and click the database user
username
under the databasedbname
(see lines fromwp-config.php
from the previous step for reference). -
Paste the password (see step 2) to the New password and Confirm password fields and click OK or Apply.
Note: In case an error is shown ‘Database user name is greater than 16 characters‘, shorten the user name to under 16 characters on the Database User page in Plesk, and then update the
username
inwp-config.php
accordingly. -
Ensure that
DB_HOST
is set to the hostname or IP address displayed in Domains > example.com > Databases