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

MySQL database root account password forgot what to do

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

Share

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

This article mainly introduces "MySQL database root account password forgot how to do", in the daily operation, I believe that many people in the MySQL database root account password forgot how to do the problem, Xiaobian consulted all kinds of information, sorted out a simple and useful method of operation, hope to answer the "MySQL database root account password forgot how to do" the doubt is helpful! Next, please follow the editor to study!

Forget the MySQLroot account password, how to change it

Background:

Generally speaking, only MySQL DBA knows the root account of MySQL database. The password of this account needs to be kept strictly confidential, and the problem of leakage is very serious. However, if DBA forgets, some MySQL management cannot be carried out. In this case, the password of root account must be reset under the condition of ensuring data security and no damage.

Step: www.2cto.com

1. Stop the d database service

Shell > service mysql stop

Note: if a user has shutdown permission, you can use mysqladmin-- user=xxx-password shutdown to stop the mysqld service

two。 Start the mysqld database service with the-- skip-grant-tables option

Shell > mysqld-datadir=/var/data/-pid-file=/var/data/xxx.pid-skip-grant-tables

Note: datadir specifies database data directory, pid-file specifies files with mysqld process number, specifies skip-grant-tables option, and ignores permission verification when mysqld starts.

3. Log in to my without a password

Shell > mysql-uroot mysql

Note: if you do not specify a password option (- p or-- password), log in with an empty password

4. Change the root password of the account

Mysql > update user set password=password ('root_pwd') where user='root'

Mysql > flush privileges

Note: after changing the password, you must use the flush privileges statement to make the password effective. Here, set the password of the root account to root_pwd www.2cto.com.

5. Stop the mysqld database service

Shell > mysqladmin-- user=root-password shutdown

Note: if you use mysqladmin to stop this time, service under linux cannot stop the mysql database server started manually.

6. Start the mysql database normally

Shell > service mysql start

7. Log in with the new password and find that the password has been changed to the new password

Shell > mysql-uroot-proot_pwd mysql

At this point, on the "MySQL database root account password forgot how to do" on the end of the study, I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical 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