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 reset user password by mysql

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

Share

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

Mysql user password reset

Stop the MySQL service:

Sudo service mysql stop

The above command applies to Ubuntu and Debian. Replace mysql with mysqld under CentOS, Fedora, and RHEL.

Start mysql in safe mode:

Sudo mysqld_safe-skip-grant-tables-skip-networking &

This allows us to log in directly with root without a password:

Mysql-u root

Reset password:

Mysql > use mysql; mysql > update user setpassword=PASSWORD ("mynewpassword") where User='root'; mysql > flushprivileges

Note that you need to add a semicolon after the command.

After the reset, we exit and start the mysql service:

Mysql > quit

Quit does not need a semicolon.

Restart the service:

Sudo service mysql restart

Again, the above command applies to Ubuntu and Debian,Centos, where Fedora and RHEL need to replace mysql with mysqld.

This is how to reset the mysql user password. For more details, please pay attention to other related articles!

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