Mysql – How to change the MySQL root password back to empty

MySQLpassword

When I'm working locally, I don't really need to enter my password to access my database. I changed my root password when I first installed MySQL, but I don't know how to change my password back. What should I do?

Best Answer

To change the root password to newpassword:

 mysqladmin -u root -p'oldpassword' password 'newpassword'

To change it so root doesn't require a password:

 mysqladmin -u root -p'oldpassword' password ''

Note: I think it matters that there isn't a space between the -p and 'oldpassword' but I may be wrong about that

Related Topic