Strange ERROR 1698 (28000): Access denied for user 'root'@'localhost'

Discussion in 'Installation/Configuration' started by lollollollol, Aug 10, 2023.

  1. lollollollol

    lollollollol Member

    Hello,

    On a Debian 12 (Up to date).
    Code:
     # php -v
    PHP 7.4.33 (cli) (built: Jun  9 2023 07:37:37) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v3.4.0, Copyright (c) Zend Technologies
        with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies
    Code:
    Server: xxxxx (Debian Unknown) ISPConfig 3.2.9p1
    
    State: ok (0 unknown, 0 info, 0 warning, 0 critical, 0 error)
    Ok
    The state of your Hard-Disk space is ok [More...]
    Your virus protection is ok [More...]
    Your Mail queue load is ok [More...]
    Your RAID is ok [More...]
    Your Server load is ok [More...]
    All needed services are online [More...]
    Your system is up to date. [More...]
    The System Log is O.K. [More...]
    
    I didn't understand why I hadn't had an update offered for a while in the web interface.
    So I ran the update from the command line. And I am surprised to see a mysql error...
    Code:
    >> 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]:
    
    Creating backup of "/usr/local/ispconfig" directory...
    Creating backup of "/etc" directory...
    Creating backup of "/root/.acme.sh" directory...
    Creating backup of "/etc/letsencrypt" directory...
    Checking MariaDB version 10.11.3 .. 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
    Of course I can login to mysql with the exact password which is in mysql_clientdb.conf:
    Code:
    root@mail ~ mysql -uroot -hlocalhost -p
    Enter password:
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 1057693
    Server version: 10.11.3-MariaDB-1 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)]>
    IspConfig works perfectly and the cron logs don't report any problem... I just can't upgrade...
    Before I try to reset mysql root password would you have any idea about my problem?

    Thank you for for reading.
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    I think Debian 12 should have PHP version 8.2.
    How come you run ISPConfig 3.2.9p1 when ISPConfig 3.2.11 is first to support Debian 12?
    Did you run on Debian 11, then upgraded to Debian 12 without upgrading ISPConfig first?
    Anyway, assuming PHP version mismatch is not breaking everything, root@localhost should have account in database, check this and check the correct password is entered in ISPConfig.
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    You might also want to test if root login with IP 127.0.0.1 works.
     
  4. lollollollol

    lollollollol Member

    Hello,
    Yes, it's a Debian11 upgrade few monthes ago. I was on ISPConfig 3.2.9p1 before upgraded Debian.
    Non php is ok even with 8.2:
    Code:
     # php8.2 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]:
    
    Creating backup of "/usr/local/ispconfig" directory...
    Creating backup of "/etc" directory...
    Creating backup of "/root/.acme.sh" directory...
    Creating backup of "/etc/letsencrypt" directory...
    Checking MariaDB version 10.11.3 .. 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
    I already triple check root password of course and root is granted in mysql:
    Code:
    MariaDB [(none)]> SHOW GRANTS FOR 'root'@'localhost';
    +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | Grants for root@localhost                                                                                                                                                 |
    +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` IDENTIFIED VIA mysql_native_password USING '*xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' OR unix_socket WITH GRANT OPTION |
    | GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION                                                                                                             |
    +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    2 rows in set (0,000 sec)
     
  5. lollollollol

    lollollollol Member

    You are right...
    Code:
    # mysql -uroot -h127.0.0.1
    ERROR 1698 (28000): Access denied for user 'root'@'localhost'
    root@mail /tmp/ispconfig3_install/install # mysql -uroot -hlocalhost
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 13092
    Server version: 10.11.3-MariaDB-1 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)]>
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, so fix your root user in mysql and run the update again. You probably changed the root password only for localhost but not 127.0.0.1, there are always 2 users. And take care to not disable networking (skip-networking) in mysql/mariadb.
     
  7. lollollollol

    lollollollol Member

    Hello Till,
    Thank you.

    This doesn't work:
    Code:
    CREATE USER 'root'@'127.0.0.1' IDENTIFIED BY 'xxxxxxxxxxxxxx';
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1';
    If I replace localhost by 127.0.0.1 in /usr/local/ispconfig/server/lib/mysql_clientdb.conf
    Code:
    $clientdb_host                  = 'localhost';
    It doesn't work either. o_O
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Check your mysql users e.g. by using phpmyadmin. There must be one root user for localhost and one for 127.0.0.1. Both users must have existed at the time you installed ISPConfig, so either you removed one and you have to add it again or you changed the password just for the localhost user and not the one for IP 127.0.0.1. Also see my comment on networking config in mariadb which you might have altered and this can cause login problems as well.

    This can not work as the settings in this file are not causing the issue. Undo your changes.
     
  9. lollollollol

    lollollollol Member

    Yes! Thank you very much Till.

    Code:
    ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxxxxxxxxxxxxxxx';
    flush privileges;
    I still don't understand why IspConfig was working fine but not the upgrade ? :confused:
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    ISPConfig uses the root user during updates and for adding new databases only, that's why you did not notice the misconfiguration earlier.
     
    lollollollol likes this.

Share This Page