You can recover MySQL database server password with following five easy steps.
Step # 1:stop The MySQL server process.
Step # 2:start the MySQL (mysqld) Server/daemon process with the--skip-grant-tables option so it would not prompt fo R password.
Step # 3:connect to MySQL server as the root user.
Step # 4:setup new MySQL root account password i.e. reset MySQL password.
Step # 5:exit and restart the MySQL server.
Here is commands you need to type for each step (login as the root user): Step # 1:stop MySQL Service
# /etc/init.d/mysql stop
Output:
Stopping MySQL database server:mysqld.
Step # 2:start to MySQL server w/o password:
# mysqld_safe --skip-grant-tables &
Output:
[1] 5988Starting mysqld daemon with Databases from/var/lib/mysqlmysqld_safe[6025]: Started
Step # 3:connect to MySQL server using MySQL client:
# mysql -u root
Output:
Welcome to the MySQL Monitor. Commands End With; or \g.your MySQL connection ID is 1-to-server Version:4.1.15-debian_1-logtype ' help, ' or ' \h ' for help. Type ' \c ' to clear the buffer.mysql>
Step # 4:setup New MySQL root user password
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User=‘root‘;
mysql> flush privileges;
mysql> quit
Step # 5:stop MySQL Server:
# /etc/init.d/mysql stop
Output:
Stopping MySQL database server:mysqldstopping server from PID file/var/run/mysqld/mysqld.pidmysqld_safe[6186]: ended[1 ]+ done Mysqld_safe--skip-grant-tables
Step # 6:start MySQL server and test it
# /etc/init.d/mysql start
# mysql -u root -p
.
Kali resetting the MySQL password