Mysql Default password



  • Hi every body,
    I installed a fresh install of Debian 10.3. Only Debian whith SSH : No php, no MySql or MariaDB.
    I installed the last version of FOG : 1.5.8.
    During installation i type no password for MySql
    And i’ve got a problem about the access to the databases in commande line.
    So what are the default passwords of the mysql users ? : root, fog…
    Regards


  • Developer

    @Wayne-Workman Thanks heaps for mentioning this here! We should really update that wiki page to help people fix this. Newer versions of MySQL/MariaDB behave very different and we have changed the old way of using an empty DB password.



  • Additional information about FOG passwords for future readers: https://wiki.fogproject.org/wiki/index.php?title=Password_Central


  • Developer

    As mentioned below there is a glitch in 1.5.8 on Debian 10 as well. I just spun up a test VM and did a quick recovery as the steps might vary between different systems and versions. This should work on Debian 10 with MariaDB 10.3.22 - run as root:

    systemctl stop mariadb.service
    mysqld_safe --skip-grant-tables &
    mysql -u root
    

    Now from here we are in the mysql shell and can try to change the password:

    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 8
    Server version: 10.3.22-MariaDB-0+deb10u1 Debian 10
    
    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)]> select user,password,host,plugin from mysql.user;
    +------+-------------------------------------------+-----------+-----------------------+
    | user | password                                  | host      | plugin                |
    +------+-------------------------------------------+-----------+-----------------------+
    | root | *B9179FF9CF31E6DDF1DCEA4E656BCB4C5CA71943 | localhost | mysql_native_password |
    +------+-------------------------------------------+-----------+-----------------------+
    1 row in set (0.002 sec)
    
    MariaDB [(none)]> update mysql.user set password=PASSWORD("newpassword") where User='root';
    Query OK, 1 row affected (0.001 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    MariaDB [(none)]> update mysql.user set authentication_string=PASSWORD("newpassword") where User='root';
    Query OK, 1 row affected (0.002 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    MariaDB [(none)]> update mysql.user set plugin='mysql_native_password' where User='root';
    Query OK, 0 rows affected (0.002 sec)
    Rows matched: 1  Changed: 0  Warnings: 0
    
    MariaDB [(none)]> 
    MariaDB [(none)]> flush privileges;
    Query OK, 0 rows affected (0.009 sec)
    
    MariaDB [(none)]> quit
    Bye
    

    Ok, password is set! Now let’s restart the DB and test connecting as root:

    killall -15 mysqld
    systemctl start mariadb.service
    mysql -u root -p
    

    Maybe even re-set the password again using the proper tools now that you have access again because messing with the user table is not that great but as far as I know it’s the only way on this version.

    mysqladmin -u root -p password
    Enter password: 
    New password: 
    Confirm new password: 
    

  • Moderator

    If the root password for mysql is lost then you will need to go through the password recovery process for mysql: https://support.rackspace.com/how-to/mysql-resetting-a-lost-mysql-root-password/

    Make sure the password is set to a value. The developers were having issues with ubuntu getting cranky with no password for mysql and breaking the FOG install so with the later builds the root password is set by the FOG Admin and not recorded anywhere for security reasons. Its up to the FOG Admin to document the password elsewhere to ensure it doesn’t get lost.


  • Developer

    @bfriconneau Unfortunately there is an issue in the 1.5.8 FOG installer setting a random root DB password which is not stored anywhere.

    There is another DB account named fogmaster which the FOG web UI is using. You will find the password for that in /var/www/html/fog/lib/fog/config.class.php


Log in to reply
 

319
Online

7.0k
Users

14.2k
Topics

134.4k
Posts