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 useful ways to change the root password in MySQ

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

Share

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

This article mainly introduces what MySQ has to use to modify the root password, the contents of the article are carefully selected and edited by the author, with a certain pertinence, the reference significance for everyone is still relatively great, the following with the author to understand what good ways to modify the root password MySQ.

Method 1: use the SET PASSWORD command

Mysql-u root

Mysql > SET PASSWORD FOR 'root'@'localhost' = PASSWORD (' newpass')

Mysql > quit; / / exit the mysql console

After setting the password, test login:

Mysql-u root-p "newpass" / /-p and password cannot have spaces

Or enter mysql-u root-p to enter and let the system prompt for the password.

Method 2: use mysqladmin

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

After reading the above about MySQ what good ways to change the root password, many readers must have some understanding, if you need to get more industry knowledge and information, you can continue to follow our industry information column.

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