Articles in this section

Cannot access database with phpMyAdmin or restore it: Access denied for user 'jdoe'@'localhost' (using password: YES)

Plesk for Linux kb: technical ext: wptk ABT: Group A

Applicable to:

  • Plesk for Linux

Symptoms

  • Cannot open database via phpMyAdmin in Domains > example.com > Databases:

    PLESK_ERROR: 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\_XXX username.

  • Website example.com is not accessible with:

    CONFIG_TEXT: Error establishing a database connection

  • Installation of the WordPress instance fails with:

    PLESK_ERROR: Error: Error establishing a database connection. This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost: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

  1. Connect to the server via SSH

  2. Create Plesk and MySQL database backup

  3. Open MySQL console:

    # plesk db

  4. Switch to MySQL database:

    MYSQL_LIN: use mysql;

  5. Delete rows with empty user:

    MYSQL_LIN: delete from user where user='';

  6. Perform a flush-privileges operation:

    MYSQL_LIN: flush privileges;

  7. Exit the database:

    MYSQL_LIN: exit

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.