In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you how to forget the root password of MySQL 5.7and 8.0 database. I hope you will get something after reading this article. Let's discuss it together.
Note: MySQL5.7 cracked the root password, skipped password authentication to log in to the database, and directly changed the password in the table, but MySQL 8.0 can not change the root password in this way. After skipping password authentication and logging in to the database, you need to set the root password to null before logging in to the database and changing the root password.
1. The root password solution of forgetting MySQL 5.7database
[root@mysql01 ~] # mysql-- version # confirm MySQL version mysql Ver 14.14 Distrib 5.7.28 For linux-glibc2.12 (x86 / 64) using EditLine wrapper [root@mysql01 ~] # vim / etc/my.cnf # Edit the main configuration file [mysqld] # write the following under the line mysqld skip-grant-tables. # omit part of the content [root@mysql01 ~] # systemctl restart mysqld # restart the MySQL service Make the configuration file effective [root@mysql01 ~] # mysql-uroot # skip password verification, log in directly to the database # change the root password to pwd@123, and refresh permissions mysql > use mysql Mysql > update user set authentication_string = passwoord ('pwd@123') where user =' root';mysql > flush privileges # Refresh permissions mysql > exit# configure password authentication, log in to [root@mysql01 ~] # vim / etc/my.cnf # to edit the main configuration file [mysqld] skip-grant-tables # delete this line [root@mysql01 ~] # systemctl restart mysqld # restart to make the change take effect # you can successfully log in to [root@mysql01 ~] # mysql-uroot-ppwd@123 with the new password
2. The root password solution of forgetting MySQL 8.0 database.
[root@mysql01 ~] # mysql-- version # View MySQL version mysql Ver 8.0.18 for linux-glibc2.12 on x861664 (MySQL Community Server-GPL) [root@mysql01 ~] # vim / etc/my.cnf # Edit the main configuration file [mysqld] # write the following content skip-grant-tables. # omit part of the content [root@mysql01] under the line mysqld ~] # systemctl restart mysqld # restart the MySQL service Make the configuration file effective [root@mysql01 ~] # mysql-uroot # skip password verification and log in directly to the database # set the root password to empty mysql > use mysqlmysql > update user set authentication_string='' where user = 'root' Mysql > flush privileges;mysql > exit# enable password authentication and log back into the database [root@mysql01 ~] # vim / etc/my.cnf # Edit the main configuration file [mysqld] skip-grant-tables # delete this line [root@mysql01 ~] # systemctl restart mysqld # restart to make the changes take effect [root@mysql01 ~] # mysql-uroot # directly log in to the database mysql > alter user root@localhost identified by 'pwd@111';mysql > flush privileges Mysql > exit# login test with new password [root@mysql01] # mysql-uroot-ppwd@111 after reading this article, I believe you have a certain understanding of "how to forget the root password of MySQL 5.7,8.0 database". If you want to know more about it, welcome to follow the industry information channel, thank you for reading!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.