In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Forget the mysql root administrator account password handling method, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
The loss of the root password means that you cannot log in to the database as a Super Admin account for maintenance. The root password needs to be recovered.
Overview
The loss of the root password means that you cannot log in to the database as a Super Admin account for maintenance. The root password needs to be recovered.
Treatment method
Kill the mysql process, then add a parameter-skip-grant-tables skips the permissions table, starts the mysql instance, then logs in to the database without a password, changes the root user password, then closes the mysql instance (shutdown or the kill mysql process), and finally starts the mysql instance normally, and you can log in to the database using the root user.
Key operation code
Click to read the original text to enhance the reading experience: https://www.modb.pro/db/22826?cyn
Mysql-uroot-p
Ps-ef | grep mysql
Kill-9 mysql process number
Mysqld_safe-defaults-file=/etc/my.cnf-skip-grant-tables &
Mysql
Use mysql
Update user set authentication_string=password ('oracle123') where user='root'
Flush privileges
Mysqladmin-p shutdown
Mysqld_safe-- defaults-file=/etc/my.cnf &
Mysql-uroot-p
Operation demonstration log [root@source ~] # mysql-uroot-pEnter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) = = intentionally enter the wrong password Simulated root password loss = = [root@source ~] # [root@source ~] # ps-ef | grep mysqlroot 6733 6191 0 10:28 pts/0 00:00:00 / bin/sh / usr/local/mysql/bin/mysqld_safe-- defaults-file=/etc/my.cnfmysql 7029 6733 2 11:10 pts/0 00:00:00 / usr/local/mysql/bin/mysqld-- defaults-file=/etc/my.cnf-- basedir=/usr/local/ Mysql-- datadir=/data/mysql-- plugin-dir=/usr/local/mysql/lib/plugin-- user=mysql-- log-error=source.err-- pid-file=source.pid-- port=3306root 7063 6191 0 11:10 pts/0 00:00:00 grep mysql [root@source] # [root@source] # kill-9 7029 6733 [root@source] # [1] + Killed mysqld_safe-- defaults-file=/etc/my.cnf [ Root@source ~] # [root@source ~] # ps-ef | grep mysqlroot 7066 6191 0 11:10 pts/0 00:00:00 grep mysql [root@source ~] # [root@source ~] # [root@source ~] # mysqld_safe-- defaults-file=/etc/my.cnf-- skip-grant-tables & [1] 7286 [root@source ~] # 2020-02-16T03:11:41.998645Z mysqld_safe Logging to'/ data/mysql/source.err '.2020-02-16T03:11:42.020962Z mysqld_safe Starting mysqld daemon with databases from / data/mysql [root@source] # [root@source] # mysqlWelcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 3Server version: 5.7.20-log MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.root@db 11:11: [(none)] > root@db 11:11: [(none)] > root@db 11:12: [(none)] > root@db 11:12: [(none)] > use mysql;Database changedroot@db 11:12: [mysql] > root@db 11:12: [mysql] > update user set authentication_string=password ('oracle123') where user='root' = = change password = = Query OK, 1 row affected, 1 warning (0.01 sec) Rows matched: 2 Changed: 1 Warnings: 1root@db 11:13: [mysql] > root@db 11:13: [mysql] > flush privileges Query OK 0 rows affected (0.00 sec) root@db 11:13: [mysql] > root@db 11:14: [mysql] > exitBye [root@source ~] # [root@source ~] # mysqladmin-p shutdownEnter password: [root@source ~] # [root@source ~] # 2020-02-16T03:15:27.217666Z mysqld_safe mysqld from pid file / data/mysql/source.pid ended [1] + Done mysqld_safe-- defaults-file= / etc/my.cnf-- skip-grant-tables [root@source ~] # [root@source ~] # ps-ef | grep mysqlroot 7502 6191 0 11:15 pts/0 00:00:00 grep mysql [root@source ~] # [root@source ~] # mysqld_safe-defaults-file=/etc/my.cnf & [1] 7503 [root@source ~] # 2020-02-16T03:15:57.181920Z mysqld_safe Logging to'/ data/mysql/source.err' .2020-02-16T03:15:57.217614Z mysqld_safe Starting mysqld daemon with databases from / data/mysql [root@source ~] # [root@source ~] # mysql-uroot-pEnter password: = = root password is recovered Normal login = = Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 4Server version: 5.7.20-log MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.root@db 11:16: [(none)] > after reading the above, do you know how to forget the password of the mysql root administrator account? If you want to learn more skills or want to know more about it, you are 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.