How to reset password in mysql5.7

王林
Release: 2020-10-19 10:56:35
Original
3341 people have browsed it

Mysql5.7 method to reset the password: First execute the [update user set authentication_string = password('123456') where user = 'root';] statement; then restart the mysql service.

How to reset password in mysql5.7

Specific method:

(Recommended tutorial:mysql video tutorial)

Close MySQL5. 7 permission system

Find the configuration file my.cnf of MySQL5.7

Edit and add the code skip-grant-tables at the end of the file

Restart the mysqld service and log in to MySQL

$systemctl restart mysqld
Copy after login

When you log in to mysql at this time, you can log in without a password.

Modify root password

$use mysql; $select host,user,authentication_string from user; #修改root密码 $update user set authentication_string = password('123456') where user = 'root';
Copy after login

Enable the permission system, restart MySQL, and log in with a new password

$vim /etc/my.cnf #开启权限系统 #skip-grant-tables #重启mysql $systemctl restart mysqld #新root密码登陆 $mysql -uroot -p
Copy after login

Related recommendations:mysql tutorial

The above is the detailed content of How to reset password in mysql5.7. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!