
Sometimes, we forgot mysql passwords.So, no worry there is a option to recover this.
Follow below steps-
Step 1: Stop the mysql server using given command
/etc/init.d/mysql stop
Or service mysql stop
Step 2: Start the mysql server without permission
tables which permit us to login as root user without password
mysqld_safe –skip-grant-tables
You should see something like this
120425 13:23:00 mysqld_safe Loggin
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 using the following command
mysql –user=root mysql
or
mysql -u root -p
Note:-password should be blank.
Step 4: Finally reset the password from the mysql’s users table,
flush privileges.
UPDATE user SET password=PASSWORD(‘rnd’) WHERE user=’root’;
flush privileges;
exit;
Step 5: Your password has been reset; finally you need the Start
MySQL daemon, using the following command
/etc/init.d/mysql start
Or
Service mysql start

0 comments:
Post a Comment