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

How to write the sql statement of mysql5.7 reset password

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly introduces how to write the sql statement of mysql5.7 reset password, which is very detailed and has certain reference value. Friends who are interested must finish reading it!

Mysql5.7 resets the password by first executing the [update user set authentication_string = password ('123456') where user =' root';] statement, and then restarting the mysql service.

Specific methods:

Shut down the permission system for MySQL5.7

Find the configuration file my.cnf for MySQL5.7

Edit the addition code skip-grant-tables at the end of the file

Restart the mysqld service and log in to MySQL

$systemctl restart mysqld

When you log in to mysql at this time, you don't need a password to log in.

Modify root password

$use mysql;$select host,user,authentication_string from user;# changes the root password $update user set authentication_string = password ('123456') where user =' root'

Open the permission system, restart MySQL, log in with the new password

$vim / etc/my.cnf# Open permission system # skip-grant-tables# restart mysql$systemctl restart mysqld# new root password login $mysql-uroot-p above is all the contents of the sql statement of mysql5.7 reset password, thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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