Knowledge Walls
John Peter
Pune, Maharashtra, India
Two ways to Change password of root user in Mysql
1626 Views
1. mysqladmin 
mysqladmin bin used to set the root password with below statement.

Syntax
mysqladmin -u <user-name> -p<password> password <new-password>

Example
mysqladmin -u root -pmysql password mysql2
2. Update query 
Normal Update query to change the password of root user.

Syntax
UPDATE `mysql`.`user` SET `password` = PASSWORD("new-password") WHERE `user` = "user-name"

Example
UPDATE `mysql`.`user` SET `password` = PASSWORD("mysql") WHERE `user` = "root"
Best Lessons of "MySQL"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details