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

What are the methods for MySQL to change the root password

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

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what are the methods for MySQL to change root password". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's way of thinking to study and learn "what are the methods for MySQL to change root password"?

Method 1: use the SET PASSWORD command

Mysql-u root

Mysql > SET PASSWORD FOR = PASSWORD ('newpass')

Method 2: use admin

Mysqladmin-u root password "newpass"

If root has already set a password, use the following methods

Mysqladmin-u root password oldpass "newpass"

Method 3: edit the user table directly with UPDATE

Mysql-u root

Mysql > use mysql

Mysql > UPDATE user SET Password = PASSWORD ('newpass') WHERE user =' root'

Mysql > FLUSH PRIVILEGES

You can do this when you lose your root password

Mysqld_safe-skip-grant-tables&

Mysql-u root mysql

Mysql > UPDATE user SET password=PASSWORD ("new password") WHERE user='root'

Mysql > FLUSH PRIVILEGES

Thank you for your reading, the above is the content of "what are the methods for MySQL to modify root password?" after the study of this article, I believe you have a deeper understanding of the method of MySQL changing root password, and the specific use also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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: 247

*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