Plesk is accessible but error sometimes is shown: Access denied for user 'admin'@'localhost' (using password: YES)

Created:

2016-11-16 12:52:25 UTC

Modified:

2017-08-16 17:11:03 UTC

15

Was this article helpful?


Have more questions?

Submit a request

Plesk is accessible but error sometimes is shown: Access denied for user 'admin'@'localhost' (using password: YES)

Applicable to:

  • Plesk for Linux

Symptoms

Access to Plesk and database is possible, but the following errors occur:

  1. When performing any changes in Plesk or the Plesk database:

    ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)
  2. When performing a Plesk upgrade:

    MySQL databases are dumped to /var/lib/psa/dumps/mysql.preupgrade.9.5.4-11.0.9.20130807.dump.gz. ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)

Note: If Plesk is not accessible with this error, visit article Unable to access Plesk: Access denied for user 'admin'@'localhost' (using password: YES)

Cause

A reinstalled or broken MySQL server.

Resolution

For Windows see article ERROR PleskMainDBException Access denied for user 'admin'@'localhost' (using password: YES)

  1. First of all, connect to the server using SSH.
  2. Make sure that the password for the admin user is set correctly using the following article for Linux: How to retrieve Plesk admin password on Linux
  3. Make sure that the admin user has all privileges:

    • Log into MySQL server under 'admin':
      # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin mysql
    • Check admin privileges:

      mysql> SHOW GRANTS FOR 'admin'@'localhost'\G
    • Grant all privileges to admin if required:

      mysql> GRANT ALL ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
      FLUSH PRIVILEGES;
  4. If the issue persists or the previous command fails with an error, check /var/log/mysqld.log

    If you see a message such as:

    [ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it

    this probably means that MySQL was reinstalled or was not upgraded completely. Run the following command to update MySQL:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin
Have more questions? Submit a request

4 Comments

  • 0
    Avatar
    iamkingsleyf

    Not working for me, destination server is still showing this error.

     

     Failed to copy content of database 'coupondig'
    Migration tools tried to perform operation in 3 attempts: Command execution failed on the source server 'source' (158.69.247.123) with non-zero exit code.
    command: MYSQL_PWD="$(cat)" mysqldump --no-defaults -h localhost -P 3306 -uadmin --quick --quote-names --add-drop-table --default-character-set=utf8 --set-charset --routines coupondig > /root/plesk_migrator/plesk_migrator-twks464nc88wp9kvxljp749p2mppndcx/db-dumps/coupondig.sql
    exit code: 2
    stdout:
    stderr: mysqldump: Got error: 1045: "Access denied for user 'admin'@'localhost' (using password: YES)" when trying to connect

  • 0
    Avatar
    Lev Iurev

    Hi @iamkingsleyf this article is not related to your issue. This is a bug in Plesk Migrator Tool #PMT-3778 and will be fixed in future. In order to fix it perform the following actions on the source server:

     

    1. Create a backup of PSA database:

      # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin psa > psa`date +%F_%H.%M`.sql

    2. Open the database:

      # plesk db

    3. Update psa.DatabaseServers table admin_password for MySQL server localhost on the source server in the psa database:

      mysql> UPDATE DatabaseServers SET admin_password = '********' WHERE host = 'localhost' AND type = 'mysql'; 

    Note: Asterisks in admin_password it is directly asterisks, not another symbols.

  • 0
    Avatar
    iamkingsleyf

    Is this a password or i should just use it like that? ********

  • 0
    Avatar
    Lev Iurev

    @iamkingsleyf, it is just asterisks

Please sign in to leave a comment.