Websitetemplate.org

Welcome > MySQL > MySQL: Change Lost Password

MySQL: Change Lost Password

shutdown mysql

# service mysqld stop

Change root password

# safe_mysqld -Sg &
# mysql mysql
mysql> select * from user;
mysql> update user set Password=password("newpasswd") where User="root";
mysql> select * from user;
mysql> exit

Kill the mysql processes

# ps -ef | grep sql | awk '{print $2}' | xargs kill -15 # ps -ef | grep sql | awk '{print $2}' | xargs kill -9 # ps -ef | grep sql

Restart mysql

# service mysqld start

Content Copyright 2003-2014 George Toft