Applicable to:
- Plesk for Linux
Symptoms
Cannot open database via phpMyAdmin in Domains > example.com > Databases:
mysqli_real_connect(): (HY000/1045): Access denied for user 'jdoe'@'localhost' (using password: YES)
Cannot restore backup in Domains > example.com > Backup Manager. The same error as above is shown with a randomly generated
backup_XXXusername.Website
example.comis not accessible with:Error establishing a database connection
Installation of the WordPress instance fails with:
Error: Error establishing a database connection. This either means that the username and password information in your
wp-config.phpfile is incorrect or we can’t contact the database server atlocalhost:3306. This could mean your host’s database server is down.
Cause
Extra rows with empty "User" values in the mysql.user table:
# plesk db "SELECT User, Host FROM mysql.user where user=''"
+-----------+-----------------+
| User | Host |
+---------- +-------- --------+
| | example.com |
| | localhost |
+----------+------------------+
Resolution
Connect to the server via SSH
Open MySQL console:
# plesk db
Switch to MySQL database:
use mysql;
Delete rows with empty
user:delete from user where user='';
Perform a flush-privileges operation:
flush privileges;
Exit the database:
exit