• Register
    • Login
    • Search
    • Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Solved Please help! Ubuntu updates screwed up my mysql root password

    FOG Problems
    4
    8
    973
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      fireguy1720 last edited by fireguy1720

      Hi guys,

      I’ve been using fog for months without issues. I’ve got a bunch of images saved that I cant lose, otherwise i’d erase and do a fresh install.

      Anyway, I decided (I’m not sure why) to install Ubuntu updates a few weeks ago. After installing and rebooting, I got the dreaded “database connection unavailable”. When I originally set up fog and mysql, I left the password blank. Now when I attempt to connect to Mysql using root, I get the root not authorized account.

      I’ve tried everything I could find online, and have been working at this since noon today. I’ve tried every “reset root user password” instructions I could find online, and none of them seem to work. I keep getting the “access denied for user root”.

      Any suggestions???

      1 Reply Last reply Reply Quote 0
      • Q
        Quazz Moderator @matijn last edited by

        @matijn Don’t edit core files for this. (they’ll be overwritten at next update)

        Instead update your /opt/fog/.fogsettings file with the credentials and rerun the fog install script.

        1 Reply Last reply Reply Quote 0
        • M
          matijn last edited by matijn

          @fireguy1720

          Ok.
          It seems i decided to enter no root password for mysql while running the FOG installation, after I tried to configure a less secure root password.

          After setting a very very strong password on mysql root account (phpmyadmin).
          You have to manually edit:

          sudo nano /var/www/fog/lib/fog/Config.class.php

          In my case, for Ubuntu 18.04.1 LTS
          sudo nano /var/www/html/fog/lib/fog/Config.class.php

          private static function _dbSettings()
          enter credentials.

          Q 1 Reply Last reply Reply Quote 0
          • S
            Sebastian Roth Moderator last edited by

            @fireguy1720 I was in kind of a hurry when answering. Sure I meant mysql -u root -p but seems like there is a password set but you don’t know it.

            Well then you can still use other methods to reset the DB root password: https://coderwall.com/p/j9btlg/reset-the-mysql-5-7-root-password-in-ubuntu-16-04-lts (should work for other ubuntu and mysql versions just the same)

            Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

            Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

            1 Reply Last reply Reply Quote 0
            • F
              fireguy1720 @Sebastian Roth last edited by

              @Sebastian-Roth Hi Sebastian,

              I just connected into my fog server, using RDP from a windows machine.

              Once in, I start a terminal session and enter the command “mysql -u root” and immediately get:
              ERROR 1045 (28000) : Access denied for user ‘root’@'localhost" using password NO.

              If I try using the “sudo -i” and then the mysql -u root, I get the same response.

              I’ve also tried using the -p and trying different passwords (or no password) with 0 luck.

              1 Reply Last reply Reply Quote 0
              • S
                Sebastian Roth Moderator last edited by Sebastian Roth

                @fireguy1720 It’s not of much help if you say you have tried it all and nothing works… What exactly happens when you do mysql -u root (run this when being logged in as root - e.g. through sudo -i!). Can you log in? If not please post the exact error you get.

                Then run the following commands in that mysql shell:

                ALTER USER 'root'@'127.0.0.1' IDENTIFIED WITH mysql_native_password BY '';
                ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';
                

                Again, what’s the output of those commands? Errors or success message. Please post it here!

                If it does not work, then try the following:

                SET password for 'root'@'localhost' = password('');
                SET password for 'root'@'127.0.0.1' = password('');
                UPDATE mysql.user SET plugin = 'mysql_native_password';
                

                Again tell us exactly what you get as response to those commands.

                Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                F 1 Reply Last reply Reply Quote 0
                • F
                  fireguy1720 @Sebastian Roth last edited by

                  @Sebastian-Roth
                  I appreciate the reply, but I’ve tried everything from that thread, and still get the same error with the root account.

                  1 Reply Last reply Reply Quote 0
                  • S
                    Sebastian Roth Moderator last edited by

                    @fireguy1720 This should help you I suppose: https://forums.fogproject.org/topic/10006/ubuntu-is-fog-s-enemy

                    Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                    Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                    F 1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post

                    58
                    Online

                    10.4k
                    Users

                    16.4k
                    Topics

                    150.7k
                    Posts

                    Copyright © 2012-2023 FOG Project