Reset mySQL password

Simple stuff assuming you haven’t forgotten your password.  If you have lost the password then read on below after the two methods

mysql -uroot
USE mysql;
UPDATE user
SET password = password
WHERE user = “root";
flush privileges;
exit;
# or is you have a password - change it
 mysqladmin -h localhost -u root password newpassword

I LOST MY PASSWORD
Easy enough, you have to start in safe mode and then use the first method above.  Safe mode is invoked by skipping the grant table load:

/usr/bin/mysqld_safe –skip-grant-tables&

About Jay Farschman - Jay currently works as a Senior Systems Administrator for an asset management company in Colorado where he works with companies that produce hardware, telecommunications software and financial services.  Jay previously owned a consulting company and provided training and consulting services for three Fortune 500 companies and numerous small businesses where he leveraged Linux to provided exceptional value.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>