Kali resetting the MySQL password

Source: Internet
Author: User
Tags mysql client

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.