October 21, 2011
How to Reset Your MySQL Password
We’re guessing you’re like the rest of us and have about a dozen and a half different passwords for your server alone. This includes any number of administrative faculties, and if you’re even more like us—God help you—you’ve been keeping all these keys laying about on PostIt notes. Yet another layer deeper into our similar psyches, and we’re guessing you’ve at some point or another lost a life-saving note.
Long story short, if that lost password happened to be your MySQL database security key, you aren’t necessarily up a certain creek without a means of locomotion. In fact, there’s a rather quick way you can retrieve or reset your MySQL password, and without any panicking to boot.
If you’re in just such a situation, use the primer below to totally reset your MySQL password, allowing you to once again return to normalcy:
1. First, log onto your server via SSH and then root yourself (but not in an Australian way, mates).
$ su
2. Next you’ll want to bring any MySQL instances that are already running to a screeching halt—that means stop them before going any further. This will, of course, take down any site dependancies, so be sure to do this at non-peak hours for best results.
3. Boot up your database in safe mode and skip those pesky privilege checks:
# mysql –user=root mysql
4. Lastly, reset the blasted lost password by recreating the user table for your database with the following commands. You’ll want to replace the string ‘newrootpwd,’ of course, with a password that’s safe, secure, and easy to remember. Obviously the latter has been a problem, so try to do a bit better this time, eh champ?
UPDATE user SET Password=PASSWORD(‘newrootpwd’) WHERE user=’root’;
FLUSH PRIVILEGES;
- Now that that’s done, there’s nothing left to do but reset the server and get back to work!
# /etc/init.d/mysql restart
We complained a bit earlier about your lost password—don’t feel bad, we do it to!—but that doesn’t mean you should take the opportunity now to create a laxer, but easier on the memory, keyword. This is your personal database we’re talking about, and remember to always keep it as secure as possible from the ground-up.We’re guessing you’re like the rest of us and have about a dozen and a half different passwords for your server alone. This includes any number of administrative faculties, and if you’re even more like us—God help you—you’ve been keeping all these keys laying about on PostIt notes. Yet another layer deeper into our similar psyches, and we’re guessing you’ve at some point or another lost a life-saving note.
Long story short, if that lost password happened to be your MySQL database security key, you aren’t necessarily up a certain creek without a means of locomotion. In fact, there’s a rather quick way you can retrieve or reset your MySQL password, and without any panicking to boot.
If you’re in just such a situation, use the primer below to totally reset your MySQL password, allowing you to once again return to normalcy:
1. First, log onto your server via SSH and then root yourself (but not in an Australian way, mates).
$ su
2. Next you’ll want to bring any MySQL instances that are already running to a screeching halt—that means stop them before going any further. This will, of course, take down any site dependancies, so be sure to do this at non-peak hours for best results.
3. Boot up your database in safe mode and skip those pesky privilege checks:
# mysql –user=root mysql
4. Lastly, reset the blasted lost password by recreating the user table for your database with the following commands. You’ll want to replace the string ‘newrootpwd,’ of course, with a password that’s safe, secure, and easy to remember. Obviously the latter has been a problem, so try to do a bit better this time, eh champ?
UPDATE user SET Password=PASSWORD(‘newrootpwd’) WHERE user=’root’;
FLUSH PRIVILEGES;
5. Now that that’s done, there’s nothing left to do but reset the server and get back to work!
# /etc/init.d/mysql restart
We complained a bit earlier about your lost password—don’t feel bad, we do it to!—but that doesn’t mean you should take the opportunity now to create a laxer, but easier on the memory, keyword. This is your personal database we’re talking about, and remember to always keep it as secure as possible from the ground-up.
Categories: Security Issues |
Tags: mysql,
password,
database,
server,
bad,
server security,
security,
down time,
personal site,
secure server,
SSH,
up time,
password security,
passwords,
IT,
IT security,
memory,
keyword,
secure passwords,
safe password

Post comment: