Messages about failed logrotate task are received in Plesk on Ubuntu 18 or Debian 9: 'Access denied for user 'root'@'localhost' (using password: NO)

Follow

Comments

25 comments

  • Avatar
    Unknown User

    Step 5 has typo (asterisk symbols were parsed as bold text):

    Should be:

    GRANT RELOAD, SHUTDOWN, PROCESS, SHOW DATABASES, SUPER, LOCK TABLES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'PASSWORD';

    Instead of:

    GRANT RELOAD, SHUTDOWN, PROCESS, SHOW DATABASES, SUPER, LOCK TABLES ON . TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'PASSWORD';

    0
    Comment actions Permalink
  • Avatar
    Duncan Mavuso

    Good Day

    The command on step 5 for MariaDB should be the following:

    GRANT RELOAD, SHUTDOWN, PROCESS, SHOW DATABASES, SUPER, LOCK TABLES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'PASSWORD';

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @Sage and @Duncan, thank you for notice.

    The article will be reviewed.

    0
    Comment actions Permalink
  • Avatar
    Markus Wernecke (Edited )

    Hi,
    I also use Ubuntu 18 with Plesk 17.8.11 and MariaDB 10.2.19. I receive the following message every day.
    Do you recommend me to do the same workaround? Or is it another problem with a different root cause?
    Lots of greets

    logrotate_script: line 2: [: /var/run/mysqld/mysqld.pid: binary operator expected

    0
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @Markus Wernecke
    Hi! Please check the "/etc/logrotate.d/mysql-server" file, if its content differs from the following, please change it accordingly:

    /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log /var/log/mysql/mariadb-slow.log /var/log/mysql/error.log {
    daily
    rotate 7
    missingok
    create 640 mysql adm
    compress
    sharedscripts
    postrotate
    test -x /usr/bin/mysqladmin || exit 0
    if [ -f `my_print_defaults --mysqld | grep -m 1 -oP "pid-file=\K.+$"` ]; then
    # If this fails, check debian.conf!
    mysqladmin --defaults-file=/etc/mysql/debian.cnf --local flush-error-log \
    flush-engine-log flush-general-log flush-slow-log
    fi
    endscript
    }

    Thanks!

    1
    Comment actions Permalink
  • Avatar
    Markus Wernecke

    Hi @Alisa Kasyanova,

    thanks a lot for help. Yes there is a difference: ..."pid-file=\K[^$]+"` ];... I changed it to your configuration. Do I have to apply this by a command? So I wait until script will be executed in a few hours. Lots of greets

    0
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @Markus Wernecke
    You're welcome!
    You may test whether it is ok now by running "/etc/cron.daily/logrotate". If you won't receive the same notification, then it is fine.

    1
    Comment actions Permalink
  • Avatar
    Markus Wernecke (Edited )

    Thanks a lot for your help. Sorry, I was not able to answer before. This error message doesn't appear anymore. But then, exactly the same day the error message from above in your tutorial appeared. Now I followed your helpful tutorial from above. Hope it works. Lots of greets and thanks for the great support.

    /etc/cron.daily/logrotate:
    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'root'@'localhost' (using password: NO)'
    error: error running shared postrotate script for '/var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log /var/log/mysql/mariadb-slow.log /var/log/mysql/error.log '
    run-parts: /etc/cron.daily/logrotate exited with return code 1


    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    @Markus,

    Great to hear this helped.

    Thank you for letting us know.

    1
    Comment actions Permalink
  • Avatar
    Wolfgang Reidlinger

    Thanks for the workaround!
    Seams to work out for me.

    Just one note/question:
    Will it be fixed with the next update / does the next update reverse this workaround / or do I have to do the next workaround after the next update?

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @Wolfgang,

    Glad to hear that workaround has helped.

    > Will it be fixed with the next update

    The bug will be fixed in the new Plesk version right at release but there is no exact date of release.

    Currently, there is no ETA  for backport to Plesk 17.8

    > does the next update reverse this workaround / or do I have to do the next workaround after the next update?

    Plesk update/upgrade does not modify the configuration changes of above workaround.

    1
    Comment actions Permalink
  • Avatar
    Joachim Weisse

    Hi,
    I also use Ubuntu 18 with Plesk 17.8.11 and MariaDB 10.2.19. I receive the following message after I follow your instructions above and as last try this:

    mysqladmin --defaults-file=/etc/mysql/debian.cnf --local flush-error-log

    I get this ERROR message on screen:

    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'

    I checked the set PASSWORD (replaced with my password) this way:

    mysql -u debian-sys-maint -p
    Password: PASSWORD (replaced with my password)

    and I can login with debian-sys-maint without trouble in mysql - so I think this part will be ok.

     

    So you can give me any hint what I can do?
    Best regards

    0
    Comment actions Permalink
  • Avatar
    Alexandr Redikultsev

    Hi @Joachim Weisse,

    It should work in case you can access mysql with this user manually. Please double-check that there are no extra spaces in the password provided in the file after the password or try playing around with quotes.

    0
    Comment actions Permalink
  • Avatar
    Joachim Weisse

    I have double checked as I wrote above and yes I can login whith the user debian-sys-maint and password I have given. But logrotate does not work. I will try to make you a litle screen recorded video from...

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @Joachim,

    Thank you for the comment.

    As an additional investigation is required, I would suggest submitting a support request. Usually, this allows to find the cause faster.

    0
    Comment actions Permalink
  • Avatar
    Marcel Klein (Edited )

    Hello,

    I've the same problem like Joachim after the workaround above:

    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'

    Password is correct and I can login manually.

     

    0
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @Marcel Klein
    Please check the following article as well: https://support.plesk.com/hc/en-us/articles/213361889 Probably, there could be some password misconfiguration between the database and the file. If this won't help, feel free to submit a request as per https://support.plesk.com/hc/en-us/articles/213608509-How-to-submit-a-request-to-Plesk-support-

    0
    Comment actions Permalink
  • Avatar
    Yoshi

    @Ivan Postnikov

    Any update on  issue from Marcel and Joachim?

    I  have the same issue.

    Password is correct and I can login manually.

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @Yoshi,

    After the conversation in this article, we have not heard from them.

    The suggestion was to submit a ticket for Plesk support as an additional investigation was required.

    The bug described in this article was fixed for Plesk 17.8.11, mu47, which was released on 25th of March.

    0
    Comment actions Permalink
  • Avatar
    Giuseppe D. (Edited )

    Hi, 

    same problem here, installed updates but the problem remain.

    plesk version
    Product version: Plesk Onyx 17.8.11 Update #49
    Update date: 2019/04/09 06:26
    Build date: 2019/04/05 05:45
    OS version: Ubuntu 18.04
    Revision: 2761d524aa7ba76d89920a04e85b43c2b4172878
    Architecture: 64-bit
    Wrapper version: 1.2

    same error even after reboot

    /etc/cron.daily/logrotate:
    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'root'@'localhost' (using password: NO)'
    error: error running shared postrotate script for '/var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log /var/log/mysql/mariadb-slow.log /var/log/mysql/error.log '
    run-parts: /etc/cron.daily/logrotate exited with return code 1


    the patch guide with update to database is not longer available, so i followed only the main instructions on the post i read yesterday here.

     

    Thank you to drive me on right direction

    0
    Comment actions Permalink
  • Avatar
    Joachim Weisse (Edited )

    Hello,

    interesting - the error is gone here (Plesk 17.8.11) now. 

    I haven't enough time last weeks to make a ticket, that is the only reason why you hear nothing from me. :)

    I will take a look at the log rotates next days, so I can give feedback.

    0
    Comment actions Permalink
  • Avatar
    Nikita Nikushkin

    Hi @Giuseppe D.,

    Thank you for letting us known

    Possibly, the cause of the issue is related to something else...I recommend creating a request to Plesk Support. We will be glad to assist you, find the root cause of the issue and share our results here in order to make this article useful for other users who met the same issue and were not able to resolve it by resolution in the article

    0
    Comment actions Permalink
  • Avatar
    Nikita Nikushkin

    Hi @Joachim Weisse,

    Glad to hear that the issue was resolved!

    Thank you for the information

    0
    Comment actions Permalink
  • Avatar
    Giuseppe D.

    @Nikita Nikushkin 

    il logged in mysql console with admin and pass copied from /etc/psa/.psa.shadow

    on the db there are not root or debian.sys-maint users... so i changed the /et/mysql/debian.cnf with admin as user and pass copied from /etc/psa/.psa.shadow

    It's a good way to solve the problem?

    0
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @Giuseppe D.
    It is better to do the following:
    1. Create MySQL user root with password Your_password:

    MYSQL_LIN: GRANT RELOAD, SHUTDOWN, PROCESS, SHOW DATABASES, SUPER, LOCK TABLES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'your_password';

    2. Modify /etc/mysql/debian.cnf and specify user with password used above:

    CONFIG_TEXT: [client]
    host = localhost
    user = root
    password = "your_password"
    socket = /var/run/mysqld/mysqld.sock
    [mysql_upgrade]
    host = localhost
    user = root
    password = "your_password"
    socket = /var/run/mysqld/mysqld.sock
    basedir = /usr

    3. Execute the following command to make sure that logrotate works. If the command doesn't show the output then everything works properly:

    # mysqladmin --defaults-file=/etc/mysql/debian.cnf --local flush-error-log

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request