"Access denied" error when managing databases or database users through Plesk

Created:

2016-11-16 13:06:06 UTC

Modified:

2017-08-08 13:12:13 UTC

2

Was this article helpful?


Have more questions?

Submit a request

"Access denied" error when managing databases or database users through Plesk

Applicable to:

  • Plesk

Symptoms

  • The following error is shown in Plesk

    SQLSTATE[HY000] [1045] Access denied for user 'admin'@'localhost' (using password:  YES)

    on attempt:- to remove/add/change subscription or domain- to remove/add/change database- to remove/add/change mailbox

    The same error can occur when adding or removing domains, mail, databases or subscriptions.

  • The "Access denied" error occurs when attempting to manage databases or database users:

    Error: Connection to the database server has failed because the supplied account does not possess administrative privileges: Access denied; you need the RELOAD privilege for this operation

    Note: This error may be related to any MySQL privilege, not just to the "RELOAD" one in the example above.

Cause

This error means that the MySQL administrator account used in Plesk does not have the correct privileges for managing databases or users on the MySQL server.

Resolution

  1. Make sure that a valid username/password is specified for the MySQL server. Go to Tools & Settings > Database servers . The following icon means that the connection is sucessfull: alttext

  2. Check that skip_grant_tables option is not enabled for the local MySQL server:

    Windows:

    Make sure that "%plesk_dir%"\\MySQL\\Data\\my.ini does not contain the skip_grant_tables option under the [PleskSQLServer] section. If it does, remove this option and restart the Plesk SQL server service.

    Linux:

    Make sure that the /etc/my.cnf file does not contain the skip_grant_tables option under the [mysqld] section. If it does, remove this option and restart the mysqld service.

  3. If the problem persists, log into the problem MySQL server with the administrator account or restart MySQL in the skip-grant-tables mode, as described in the Knowledge Base article 213381869 . Then, verify that the administrator account has the correct privileges, as in the following example:

    On Windows:

    > cd %plesk_dir%\\MySQL\\bin
    > mysql -uadmin -P8306

    On Linux:

    # plesk db

    Next:

    mysql> use mysql;
    mysql> select * from user where user='admin' \G
    *************************** 1. row ***************************
    Host: localhost
    User: admin
    Password: 3d89770b0d299d60
    Select_priv: Y
    Insert_priv: Y
    Update_priv: Y
    Delete_priv: Y
    Create_priv: Y
    Drop_priv: Y
    Reload_priv: Y
    Shutdown_priv: Y
    Process_priv: Y
    File_priv: Y
    Grant_priv: Y
    References_priv: Y
    Index_priv: Y
    Alter_priv: Y
    Show_db_priv: Y
    Super_priv: Y
    Create_tmp_table_priv: Y
    Lock_tables_priv: Y
    Execute_priv: Y
    Repl_slave_priv: Y
    Repl_client_priv: Y
    ssl_type:
    ssl_cipher:
    x509_issuer:
    x509_subject:
    max_questions: 0
    max_updates: 0
    max_connections: 0
    1 row in set (0.00 sec)

Note that the MySQL administrator username may differ from the one in the example above. If you use a remote MySQL server without the Plesk, the MySQL administrator account name is root .

If MySQL server version is higher than 5.5, then make sure that user.plugin and user.authentication_string are empty, not NULL

mysql> update mysql.user set authentication_string="", plugin="" where user='admin';

If a privilege is not set, you can add it with the GRANT PRIVILEGE query. See the MySQL documentation for more information: Grant syntax Causes of Access-Denied Errors

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