SOLVED Please help! Ubuntu updates screwed up my mysql root password
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”.
@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.
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()
@fireguy1720 I was in kind of a hurry when answering. Sure I meant
mysql -u root -pbut 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)
@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.
@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.
I appreciate the reply, but I’ve tried everything from that thread, and still get the same error with the root account.
@fireguy1720 This should help you I suppose: https://forums.fogproject.org/topic/10006/ubuntu-is-fog-s-enemy