All sites show: Error establishing a database connection

Created:

2016-11-16 13:23:58 UTC

Modified:

2017-08-08 13:42:46 UTC

0

Was this article helpful?


Have more questions?

Submit a request

All sites show: Error establishing a database connection

Applicable to:

  • Plesk 12.5 for Linux

Symptoms

After upgrade from mysql 5.5 to 5.6 all sites that use mysql databases show error:

Error establishing a database connection

It's not possible to connect to psa database:

# plesk db
ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)
exit status 1

With enabled skip-grant-tables it's not possible to login to database:

# mysql -u db_user

mysql> use database;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'database'

Cause

Empty mysql user in mysql database.

Resolution

  1. Edit the MySQL configuration file - /etc/my.cnf and add skip-grant-tables option under [mysqld] section.

  2. Restart mysqld service:

    # service mysqld restart
  3. Create a backup of mysql database:

    # plesk db dump mysql > /root/mysql.sql
  4. Login to mysql and remove an empty mysql user:

    # mysql
    use mysql;
    delete from user where user='';
  5. Remove skip-grant-tables from /etc/my.cnf and restart mysql according to point #2.

Have more questions? Submit a request
Please sign in to leave a comment.