Problems with fog homepage
-
@zln1996
I had troubles this past week after updating as well. My issues I’m sure was due to my own clumsyness. We had a fire drill and in my haste I kicked the power to the station during fog update. The DB was not in good shape after and had similar problems. I am by no means a MySQL/DB pro so please use caution with my assistance.So what I found was to stop mysql service and use this command to get into the DB…
sudo mysqld --skip-grant-tables
Then in another terminal run:
mysql use mysql
After trying a bunch of other things(table repairs and such) I realized the root account was missing(as were others).
You can use this to check existance and should show rights assigned.select * from user where User='root';
I can’t find the page that helped me most but I think next is:
FLUSH PRIVILEGES #if root doesnt exist... insert into user (Host, User, Password) values ('localhost','root',''); #IF/after root exists... update user set Select_priv='Y',Insert_priv='Y',Update_priv='Y',Delete_priv='Y',Create_priv='Y',Drop_priv='Y',Reload_priv='Y',Shutdown_priv='Y',Process_priv='Y',File_priv='Y',Grant_priv='Y',References_priv='Y',Index_priv='Y',Alter_priv='Y',Show_db_priv='Y',Super_priv='Y',Create_tmp_table_priv='Y',Lock_tables_priv='Y',Execute_priv='Y',Repl_slave_priv='Y',Repl_client_priv='Y',Create_view_priv='Y',Show_view_priv='Y',Create_routine_priv='Y',Alter_routine_priv='Y',Create_user_priv='Y' where user='root'; # grant all privileges on *.* to 'root'@'%' with grant option; grant all privileges on *.* to 'root'@'localhost' with grant option;
while I didnt use this site:http://www.helpfromfriend.com/featured/how-to-recreate-root-account-in-mysql/ initially ,
it does layout basically what i had to do.you may need to add: IDENTIFIED WITH mysql_native_password BY ‘’ to the end of the GRANT statements. I think I had to.
If you want to check/repair tablesyou can check this site on how to:
http://www.thegeekstuff.com/2011/12/mysqlcheckThe experts here may over rule me but it helped me.
hopefully this helps you. Or at least someone.
Jason
-
@KnightRaven Thanks for the help man! I am definitely not in anyway a SQL pro lol, so I tried what you did. I used the command
sudo service mysql stop
and then ran the first command. When I attempted to run the second command I receive this error: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2) I then checked the status of the mysql service and it was still stopped. I also attempted the command in the article you provided/etc/init.d/mysql stop mysqld_safe --skip-grant-tables
but that was also to no avail. I even attempted to replace “stop” with “start” in that command but that didn’t work either. :L -
@zln1996
hmmm… Maybe the server isn’t stopping all the way. I think you can try:killall mysqld
Mine gave me this error as well but don’t rem. what all I did now.
You may also need to check your mysql config file “my.cnf”.
should be located in /etc/mysql/my.cnf
while I didn’t find them here, you can also check:
/etc/my.cnf
/var/lib/mysql/my.cnfMake sure any IPs match your server and check where it says the .sock file is supposed to be. There is also a bind statement listed, but from what I read(and as was in my file) it should be commented out.
As I checked mine just now I don’t see any IPs or names other than at the bind-address which is commented out.You could also try just making the .sock file:
touch /var/run/mysqld/myssqld.sock
keep in mind when making these changes you will need to use sudo or run as root(sudo -i).
Check your error.log file in /var/log/mysql/error.log
It may have some more info.
also: /var/log/mysql.err and /var/log/mysql.log
although for me the last two were empty.Now I will tell you that I eventually re-installed mysql but I would use that as a last resort. My DB data stayed intact(as far as fog info goes anyway) but I may have been lucky.
after re-installing I used the steps provided previously to re-add the root user and it’s rights. I didn’t realize the root user was gone til after the re-install so I figure I may not have had to do that.
-
@KnightRaven Okay thanks man, I’m about to try those things and see if it works for me. If it doesn’t I may resort to uninstalling mySQL.
Maybe @Tom-Elliott could answer, whether or not, my fog database should stay intact if I uninstall and then re-install mySQL?
Also Knight, what commands did you run to uninstall mySQL and re-install it? The ones I found seem to get rid of anything SQL related.
-
@zln1996
I forgot to mention you can useps -ef | grep mysql
to find other potential instances of mysql running.
as far as removal goes…
sudo apt-get remove --purge mysql-server mysql-client mysql-common sudo apt-get autoremove sudo apt-get autoclean
then to re-install…
sudo apt-get update sudo apt-get install mysql-server mysql-client mysql-common
If you don’t have a .sql backup you can try backing up these folders:
/etc/mysql and /var/lib/mysql
it looks like, at least on mine, that the data is in /var/lib/mysql. It has matching info for my databases anyway.Using --purge will certainly get rid of config files. Maybe it leaves the data though?
If this is a full blown live production server I might wait til i hear back from one of the Fog pros. While I use mine regularly it is not mission critical so to speak. I also had backups I could use. I was also prepared that I would have to just manually re-enter the image info as the files would still be there.
My killer would have been losing my advanced pxe scripts lol. -
@zln1996
Also you are quite welcome. I just hope its useful info. These guys on here have helped me quite a bit to keep things running and setup stuff. So I try to help or add my $.02 worth.I dunno they might would like for me to stop.
-
@KnightRaven This is driving me insane lol, Ubuntu absolutely hates me. I completely removed sql and reinstalled it, and it still denies access to everything. The only other thing I can think of doing is saving my images then installing Ubuntu and fog again.
Any ideas? Or does this seem like the only other option?
-
@zln1996
Wow. I’m not really sure. I would hate to think you’d have to go that extreme. Maybe someone else knows better than I.However…
Did it ask you for a password during re-install? I will say that mine did but the login still didn’t work. Root was still missing I still had to use the --skip-grant-tables to get in. There is also a network related switch/option but I don’t know for sure what that does. Maybe skips issues if it denies login from localhost?
I think its --skip-networking. You can try that. I may have used both now that I think about it. I’ve slept a couple of times since then though. LOLThe only other thing I could think(if you didn’t) is to verify that the config files are gone from /etc/mysql when re-installing.
The next thing would be purely experimental… But there is a mariadb that is supposed to be a drop in replacement for mysql. You could try installing that and see if that fixes it. But I have not tried this.
I’m sorry I can’t be of more help.
-
@KnightRaven There are no words to describe how happy I am right now. I finally got it working and I’m in fog again and everything looks okay! Knight I want to thank you so much for your help you had me on the right path all along, however, I did have to do a few extra steps. I’m going to explain so if anyone has this issue later on and they stumble upon this post hopefully it will help them out.
First thing is the reason I could never get mysqld to start is during the installation of mySQL it never created the directory /var/run/mysqld so that’s why it would never start a mysql instance. So using these commands you can accomplish that.
mkdir -p /var/run/mysqld chown mysql:mysql /var/run/mysqld
Once that was done, make sure all instances of regular mysql is gone. I used
killall mysql
and then to verifykillall -9 mysql
Then I ran the following commandmysqld_safe --skip-grant-tables --skip-networking &
Once that is done you’ll need to open a different terminal. And do the following:
mysql -u root
If all is well you should now be in the database once more, here I checked for the user account like you mentioned Knight, but mine seemed to still be in there. So if the user is there use the following commands (this is what I had to do in my case, since my root user still existed)
use mysql; update user set authentication_string=PASSWORD('<YOURPASSWORDHERE>') where user='root'; flush privileges; \q
So now your password should be updated, so now to verify kill all of the mysqld instances and start the regular mysql ones. This can be accomplished by the following.
killall mysqld service mysql start #now you can check your new password... mysql -u root -p #Enter your password and you should be brought to the following prompt... mysql>
After that I was able to get to the fog homepage and update my schema, and now I’m back in with everything in tact. After this was done I followed Tom’s advice and disabled automatic updates because I’m really tired of Ubuntu breaking everything lol.
I hope this helps any future readers, so you don’t have to go through this madness like I did. Turn off automatic updates as soon as you can, because from my experience it only causes issues, and if you have to update your Ubuntu fog machine prepare for problems.
I also want’s to extend one last thanks to @KnightRaven @Tom-Elliott and @george1421 for their help on this, you guys rock!
Along with everyone else’s references here is the one I used: https://askubuntu.com/questions/489098/unable-to-reset-root-password-of-mysql
-
@zln1996
That’s awesome! Glad to hear you got it working. I figured that directory under run would have been created automatically when starting the process. How interesting. Good job and glad all is intact. Glad we were able to get you in the right direction.Jason