mysqlcheck: Got error: 1698: Access denied for user 'root'@'localhost' when trying to connect

Discussion in 'General' started by sjau, Mar 21, 2024.

  1. sjau

    sjau Local Meanie Moderator

    Want to upgrade my debian/ispconfig server but it fails now with the ispconfig upgrade script:

    Code:
    root@ispc /tmp/ispconfig3_install/install # php -q update.php
    --------------------------------------------------------------------------------
     _____ ___________   _____              __ _         ____
    |_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
      | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
      | |  `--. \  __/  | |    / _ \| '_ \|  _| |/ _` |  |_ |
     _| |_/\__/ / |     | \__/\ (_) | | | | | | | (_| | ___\ \
     \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                                  __/ |
                                                 |___/
    --------------------------------------------------------------------------------
    >> Update 
    Operating System: Debian 12.0 (Bookworm) or compatible
    This application will update ISPConfig 3 on your server.
    Shall the script create a ISPConfig backup in /var/backup/ now? (yes,no) [yes]: no
    Checking MariaDB version 10.11.6 .. OK
    Checking ISPConfig database .. mysqlcheck: Got error: 1698: Access denied for user 'root'@'localhost' when trying to connect
    OK
    ERROR 1698 (28000): Access denied for user 'root'@'localhost'
    Unable to call mysql command line with credentials from mysql_clientdb.conf
    root@ispc /tmp/ispconfig3_install/install # mysql -u root -p
    Enter password:
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 519
    Server version: 10.11.6-MariaDB-0+deb12u1 Debian 12
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]>
    
    I did check the /usr/local/ispconfig/server/lib/mysql_clientdb.conf file and made sure the credentials there are correct. Using the credentials from the mysql_clientdb.conf I can log into mariadb just fine.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    You must test like this:

    mysql -h localhost -u root -p

    and

    mysql -h 127.0.0.1 -u root -p

    Both should work. It might be that you set skip-networking in MySQL.
     
    ahrasis likes this.
  3. sjau

    sjau Local Meanie Moderator

    works

    does not work
    does not work. As said, I upgraded from debian 10 to 12 and now I have that problem.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Check the MariaDB7MySQL config that it does not contain skip-networing.
     
  5. sjau

    sjau Local Meanie Moderator

    I figured out the problem. With the upgraded (old) databases, I got this:

    Code:
    show grants; 
    +-----------------------------------------------------------------------------------------------------------------------------------------+ 
    | Grants for root@localhost                                                                                                               | 
    +-----------------------------------------------------------------------------------------------------------------------------------------+ 
    | GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` IDENTIFIED VIA mysql_native_password USING 'invalid' OR unix_socket WITH GRANT OPTION | 
    | GRANT ALL PRIVILEGES ON `phpmyadmin`.* TO `root`@`localhost`                                                                            | 
    | GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION                                                                           | 
    +-----------------------------------------------------------------------------------------------------------------------------------------+
    
    while a brand new intsall was like this:

    Code:
    show grants; 
    +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 
    | Grants for root@localhost                                                                                                                                                 | 
    +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 
    | GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` IDENTIFIED VIA mysql_native_password USING 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' OR unix_socket WITH GRANT OPTION | 
    | GRANT ALL PRIVILEGES ON `phpmyadmin`.* TO `root`@`localhost`                                                                                                              | 
    | GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION                                                                                                             | 
    +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    
    so I just used the one from the new install

    Code:
    GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` IDENTIFIED VIA mysql_native_password USING 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' OR unix_socket WITH GRANT OPTION; 
    Query OK, 0 rows affected (0.017 sec) 
    MariaDB [(none)]> flush privileges; 
    Query OK, 0 rows affected (0.005 sec)
    
    and now it's working again.
     
    till likes this.
  6. ledufinfra

    ledufinfra New Member

    i got the same issue with multi server update.
    My db, mail and web2 servers cant connect to master (web1) server ?
    Why , is the updater have an issue ?

    And i must precise that : mysql -h web1.auvergnux.org -u root -p (from the ispconfig server i want to update)
    is working perfectly .
    I dont know what the update script is trying to do ... but it's not working.
     
    Last edited: Jun 15, 2024
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    This error is not about a connection to the master server at all. You likely have altered the MySQL root password after installing ISPConfig but missed to set the new MySQL root password in the file /usr/local/ispconfig/server/lib/mysql_clientdb.conf
     

Share This Page