How to Reset mysql Root Password on Linux and Unix ?
Step 1: Stop the mysql server using the following command
service mysql stop
Step 2: Start the mysql server manually without permission tables which allows us to login as root user without password, using the following command
You should see something like this
120425 13:23:00 mysqld_safe Logging to syslog.
120425 13:23:00 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Step 3: Now open a new terminal window and run the mysql console using the following command
mysql —user=root mysql
Step 4: Finally reset the password from the mysql’s users table, flush privileges, and then exit the MySQL console using the following commands
UPDATE user SET password=PASSWORD(‘NewChoicepassword’) WHERE user=’root’;
Step 5: Your password has been reset; finally you need the Start MySQL daemon, using the following command
Service mysql start