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

The method of resetting root password by mysql5.7

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

Share

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

This article is about mysql5.7 reset root password method. Xiao Bian thinks it is quite practical, so share it for everyone to make a reference. Let's follow the editor and have a look.

After installing mysql5.7, I forgot my password. You need to reset the root password.

Step 1: Modify configuration file Password free login mysql

vim /etc/my.cnf ##Add skip-grant-tables to my.cnf's [mysqld] field ##Restart mysql service mysqld restart

Step 2: Login to mysql without password

mysql -u root ##password Enter directly

Step 3: Reset root password to null

mysql>use mysql;## mysql 5.7.9 after the password field abandoned, field name changed to authentication_stringmysql>update user set authentication_string =''where user ='root ';##refresh database mysql>flush privileges;

Step 4: Root Reset Password

  Exit mysql, delete skip-grant-tables at the end of/etc/my.cnf file, restart mysql service, log in as root user, because authentication_string is set to empty above, so you can log in without password.

alter user 'root'@'localhost' identified by '#new password #'; Thank you for reading! About mysql5.7 reset root password method to share here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge. If you think the article is good, you can share it so that more people can see it!

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