How to change MySQLAdmin(root) Password using MySQL Safe Mode



Reset MySQL Admin Password using MySQL Safe Mode….

First you must Stop/Kill existing MySQL service or PIDs

#service mysqld stop or
#killall mysqld

Now Start MySQL in Safe Mode using Following Command

#/usr/bin/mysqld_safe --user=mysql --skip-grant-tables

Now Connect to MySQL

#/usr/bin/mysql

Use the mysql database:

mysql>use mysql;

Change the MySQL admin(root) Password using following command

mysql>update user set password=password(‘wsarxaffa’) where user=’root’ and host=’localhost’;

Flush the privileges so everything will take (It removes any privileges set by the server)

mysql>flush privileges;

Then Quit : mysql>quit

Stop MySQL Service

/etc/init.d/mysqld stop

Start MySQL Service

/etc/init.d/mysqld start

Now Login to MySQL As A root user

#mysql -u root -p wsarxaffa