Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos6.5@MySQL cracked the password

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Other Linux versions are similar!

Modify MySQL login settings

Vim / etc/my.cnf

For example:

[mysqld]

Datadir=/var/lib/mysql

Socket=/var/lib/mysql/mysql.sock

Skip-grant-tables adds this line

Save and exit.

two。 Restart mysqld

Service mysqld restart restart service method 1

/ etc/init.d/mysqld restart restart service method 2

Indicates that the service was restarted successfully

Stopping MySQL: [OK]

Starting MySQL: [OK]

3. Enter MySQL

/ usr/bin/mysql

4. Select database user

Mysql > USE mysql

Database changed

5.。 Reset MySQL password

Mysql > UPDATE user SET Password = password ('new-password') WHERE User =' root'

The × × part is the new password, followed by the root user

6. Reset permissions table

Mysql > flush privileges

Query OK, 0 rows affected (0.01 sec)

7. Exit MySQL

Mysql > quit

8. Change the login settings of MySQL back

Vim / etc/my.cnf

Delete the skip-grant-tables just added in the paragraph of [mysqld]

Save and exit

9,. Restart mysqld

# service mysqld restart

10. Restart successfully

Stopping MySQL: [OK]

Starting MySQL: [OK]

11.MySQL login

Mysql-u root-p

Enter the new password you just set

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report