Knowledge Walls
John Peter
Pune, Maharashtra, India
Two ways to Change password of root user in Mysql
3121 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"
  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