mySQL reset root password

I’ve been using mysql for quite some time, and ever then after I shifted to a work place which uses msSQL, I felt that I’ve neglected mySQL for awhile. Basically one main question I had previously and just recently asked by my colleague is to how to change the root user password?

Here I will teach you what I usually use which is the mysql command line.

Login to mysql server using the following command prompt

$ mysqladmin -u root -p

In mysql prompt, select database mysql

mysql> use mysql;

Now update your root password by putting a new password in the NEWPASSWORD part

mysql> update user set password=PASSWORD(“NEWPASSWORD”) where User=’root’;

Finally you’ve completed the step. Oh one more final step.

mysql> flush privileges;

Now try quit the mysql command line, and relogin again using the new password. Congrats, your root has a new password 🙂

Leave a Reply