mysqladmin: connect to server at 'localhost' failed

  • - IMSCP: 1.4.7
    - Distribution: Debian 9
    - Proftpd
    - PHP FCGID
    - MariaDB 10.1
    - Courier
    - Roundcube
    - Web2FTP


    after migration (full mysql dump) I get a logrotate error message, the password part in debian,cnf is empty ... how can I fix this?


    Code
    1. Cron <root@host2> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
    2. /etc/cron.daily/logrotate:
    3. mysqladmin: connect to server at 'localhost' failed
    4. error: 'Access denied for user 'root'@'localhost' (using password: NO)'
    5. 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 '
    6. run-parts: /etc/cron.daily/logrotate exited with return code 1
  • @fulltilt


    I don't know how you have done your migration but it seem that you made the work by closing your eyes.


    The password field in that file shouldn't be empty...


    See Daily error report with Anacron

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206


  • thanks!
    I think I must be going senile ;-)
    so I guess there is no need to run the sql queries when migrated a complete msql dump?

  • Hello Nuxwin,
    I have set the password in debian,cnf and I'm able to login as debian-sys-maint ...
    but this morn I received the same message again:



    Code
    1. /etc/cron.daily/logrotate:
    2. mysqladmin: connect to server at 'localhost' failed
    3. error: 'Access denied for user 'root'@'localhost' (using password: YES)'
    4. 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 '
    5. run-parts: /etc/cron.daily/logrotate exited with return code 1
  • Please, just follow the steps from Daily error report with Anacron


    In short, do what we say or don't ask us ;) ;)

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Code
    1. grep -m 1 password /etc/mysql/debian.cnf | cut -d ' ' -f3

    I got an empty result w/ above command
    should I run the queries with the debian.cnf password from privious installation (before migartion)?

  • @fulltilt


    Seriously... Please open the /etc/mysql/debian.cnf file. You should see two password parameters. Value for those two password parameters must be identical and not empty. If only one password parameter is empty in the file, set the value same as the other.


    If both values are empty, set a new password for both (identical), with only ASCII alphabet and number characters. See http://passwordsgenerator.net/


    Once done, follow the steps from the thread.


    And now I'm going to bought your diapers :S

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • still got the same message today, could this happen because of missing log files?
    /var/log/mysql contains only error.log and error.log.1


    mysqladmin user login works:

    Code
    1. mysqladmin -uroot -pxxxxxxxx processlist+----+-----------------+-----------+-------+---------+------+-------+------------------+----------+| Id | User | Host | db | Command | Time | State | Info | Progress |+----+-----------------+-----------+-------+---------+------+-------+------------------+----------+| 2 | authdaemon_user | localhost | ispcp | Sleep | 23 | | | 0.000 || 3 | authdaemon_user | localhost | ispcp | Sleep | 2 | | | 0.000 || 4 | authdaemon_user | localhost | ispcp | Sleep | 31 | | | 0.000 || 5 | authdaemon_user | localhost | ispcp | Sleep | 4 | | | 0.000 || 28 | authdaemon_user | localhost | ispcp | Sleep | 27 | | | 0.000 || 49 | root | localhost | | Query | 0 | init | show processlist | 0.000 |+----+-----------------+-----------+-------+---------+------+-------+------------------+----------+


    Code
    1. /etc/cron.daily/logrotate:
    2. mysqladmin: connect to server at 'localhost' failed
    3. error: 'Access denied for user 'root'@'localhost' (using password: YES)'
    4. 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 '
    5. run-parts: /etc/cron.daily/logrotate exited with return code 1
  • hmm, should I remove /etc/logrotate.d/mysql-server?
    # - The error log is obsolete, messages go to syslog now.