Unable to access Plesk on Linux: Access denied for user 'admin'@'localhost' (using password: YES)

Follow

Comments

19 comments

  • Avatar
    adrianTNT

    The commands like mysql -uadmin mysql still says  Access denied for user admin, even after adding skip-grant-tables to my.cnf

    All these commands that should reset password assume I am already logged in, when in fact that is my initial problem.

    Frustrating.

    These doc pages don't seem accurate at all.

    0
    Comment actions Permalink
  • Avatar
    Vitaly Zhidkov

    @adrianTNT, after modifying the my.cnf file and adding the skip-grant-tables option it is needed to restart the database server.

    0
    Comment actions Permalink
  • Avatar
    fabianevt

    "11. If an output of the command is similar to the above - both strings Password and authentication_string are defined and the plugin is set as mysql_native_password for the admin user in the mysql.user table - run the query below. If not - move to the step 13."

     

    What is the step 13??

     

    Thanks !!

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    @fabianevt, thank you for notice, It is required to move to step 12. The article was updated.

    0
    Comment actions Permalink
  • Avatar
    WartraxX

    What is the step 12 or 13 ?

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @WartraxX!

    Since previous comments regarding steps 12 and 13, the resolution was optimized and shortened.

    Now resolution consists only of 10 steps.

    0
    Comment actions Permalink
  • Avatar
    Domenico

    but once the automatic reset is done, what is my new password ???

    0
    Comment actions Permalink
  • Avatar
    Alexandr Redikultsev

    Hi @Domenico,

    The password is stored in /etc/psa/.psa.shadow file in the hashed form.

    You can copy the content and use it as a plain text password, MySQL will understand it.

    0
    Comment actions Permalink
  • Avatar
    Yassir Elnaw
    The same problem under Linux Solved:
    I had the same problem in my server and found out it was due to some virus which is related to read write permission in some web-based files. the approach I took was first:
    1. Download a fresh Ubuntu latest version live cd.
    2. Make a bootable Ubuntu thumb drive.
    3. Boot your server from the live cd.
    4. Choose try Ubuntu with your internet connected.
    5. When it boots up open the terminal program & type the following command:
    sudo apt install clamav
    sudo freshclam
    Don't bother if freshclam command gives an error because your virus database might not need update.​
    6. Now you need to find a place where the root directory of your server is located. Usually it will be in /mnt directory.
    7. Now use the following command to scan the root directory of your server.
    clamscan -r --bell -i /mnt/your root directory​
    8. After scanning is done viruses will be removed & corrupted files will be repaired.
    9. Disconnect the server from the Internet and reboot it.
    10. Login to the server a sure that the main domain and the sub-domains in the /var/www/vhosts/nsxxxxxxx/ has the right read write permission and it's better to default all files to 644 and directories to 755 and it's done this way:
    cd /var/www/vhosts/nsxxxxxxxx "where xxxxxxx is the domain name"
    find . -type f -exec chmod 644 {} \;
    find . -type d -exec chmod 755 {} \;​
    11. Reboot the server and connect it to the internet
    12. Now you must be able to access Plesk normally.
    13. Now check which directory needs other read and write permission. Some might need 707 permission like image directories and some might need chown apache:apache or 
    chown www-data:www-data like cache directories in the domains and sub-domains.
    I hope this will help & thank you plesk team.
     
     
    0
    Comment actions Permalink
  • Avatar
    Alexandr Zubtsovsky

    @Yassir Elnaw

    Hi,

    Thank you for sharing the solution with us. I think other Pleskians will find it useful as well

    I would like to mention that on step #10 the commands should be executed with "httpdocs" directory in path, for example:

    find /var/www/vhosts/domain.tld/subdomain.tld/httpdocs/ -type f -exec chmod 644 {} \;

    find /var/www/vhosts/domain.tld/subomdoman.tld/httpdocs/ -type d -exec chmod 755 {} \;

    find /var/www/vhosts/domain.tld/subomdoman.tld/httpdocs/ -type f -exec chown user_example:psacln {} \;

    find /var/www/vhosts/domain.tld/subomdoman.tld/httpdocs/ -type d -exec chown user_example:psacln {} \;

    0
    Comment actions Permalink
  • Avatar
    Markus Granzow

    Thank you, Alexandr

    The script runs in CentOS 7.4 with MariaDB 5.5.60, but with no effect. The manual solution works fine and with success.

    0
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @Markus Granzow
    I have not reproduced the issue on a test CentOS 7 with MariaDB 5.5.60.
    Does it show any errors? Is it showing "Password reset for MySQL user has been completed" message at the end?

    1
    Comment actions Permalink
  • Avatar
    Ojomo

    what should i do if the error is ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: NO)

    The difference to what you said before is that using password:NO)

    0
    Comment actions Permalink
  • Avatar
    Ojomo

    I also got this error below

    sudo MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin
    cat: /etc/psa/.psa.shadow: Permission denied

    0
    Comment actions Permalink
  • Avatar
    Artyom Baranov

    @Ojomo,

    Hi!

    We have another article for the mentioned error "Unable to upgrade MySQL: Access denied for user 'root'@'localhost' (using password: NO)"

    However, please note that the command "MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin" should be executed only by root user due to special permissions on /etc/psa/.psa.shadow file.

    0
    Comment actions Permalink
  • Avatar
    Markus Granzow

    @Alisa Kasyanova

    Thank you for your test. The problem I found is that php on my vserver is on an old version (5.6 or so) and the upgrade is more difficult than the manual solution above.

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @Markus,

    CentOS 7.4 is supplied with PHP 5.4.16. As verified in a test environment, this PHP version is enough to apply the automatic solution.

    Feel free to share additional information in case there were some error messages, for example.

    0
    Comment actions Permalink
  • Avatar
    Christian (Edited )

    After the manual solution did not work (at least my Plesk update still fails to complete from what seems to be related to it failing to take a MySQL Backup as far as I can see in the log which brought me to this support article). I now tried to do the automated approach which as well fails with the following error:

    Checking if administrator exists
    !ERROR: User 'admin'@'localhost' already exists on the system and has required privileges.Run the script with '-y' option to skip this check
    exit status 1

    It does not seems like a -y is possible, at least I get the same error.

    0
    Comment actions Permalink
  • Avatar
    Daria Gavrilova

    Hello @Christian,

    Thank you for your input.

    There is a possibility, that the following article may help: Plesk upgrade/installation fails: Access denied for user 'admin'@'localhost'

    However, to investigate the issue deeper and find the cause of such behavior, please create a request to Plesk Technical Support: How to submit a request to Plesk support?

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request