I don’t know how many times I have had to look up this information in the past. In hopes of learning-through-writing I’ve decided to publish these methods of recovering or resetting the MySQL root password. Set Initial Password If you’ve just installed MySQL and have never set the root password a password is not yet needed. Until one is defined you should be able to access your database(s) without the password. To set a password for the first time you can use: mysqladmin -u root password NEWPASSWORD Update Root Password If you want to update or change the existing root password you can use: mysqladmin -u root -p'oldpassword' password newpass You should note that this will require that you know the current password. Recover Lost Password If you have completely lost the MySQL root password and need to reset it you can. This will require short downtime on your database(s). Read more
After typing out that title I wonder if I’ve been spending too much time on forums, hehe. In any case, I ran into a problem today regarding my database tables being read-only so I thought I’d post this for the good of the internets. I had to dig pretty deep to find a solution to it. Hopefully some additional Google fodder will make life a bit easier for the next guy. If you’re a regular reader here you know that I had some database problems this morning with this site. I ended up needing to import some databases from backups and manually tweak a few things to restore the lost data. Well it turns out that after a database import or a change of users and permissions your database tables can become read-only. I’m not entirely sure the reasoning behind this, but I found some discussion about it on a MySQL developers mailing list thread. Read more
I apologize for the trouble on the site today. I made a minor little mistake with a database and spent the entire day trying to solve it. It appears that everything is working as expected now and I want to thank Stephen Shaw for helping me out, just as I was about to give up. Great work–good eye! I’m going to make sure I have some healthy backups at this point, and perhaps I’ll find a little time to blog about the whole situation. Mainly what to avoid and what tips I’ve found in the process. Thank you again for your patience. Let me know if you find anything out of place on the site.