In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Next, let's learn how to deal with mysql forgetting root password. I believe everyone will benefit a lot after reading it. The text is not much in essence. I hope mysql forgets how to deal with this short article with root password.
Mysql forgot the superuser administrative password and can use the-- skip-grant-tables parameter when restarting the mysql process to start the database and log in with an empty password. This is the equivalent of when the database starts for the first time. You can then view the superuser in the mysql.user table and change the superuser's password
Kill closes MYSQL instance or kills the process
Restart mysql with-- skip-grant-tables statement
[mysql@mysql01 my.cnf.d] $mysqld_safe-- defaults-file='/data/mysqldata/3306/my.cnf'-- skip-grant-tables & [1] 32530 [mysql@mysql01 my.cnf.d] $180828 19:02:13 mysqld_safe Logging to'/ data/mysqldata/3306/data/../mysql-error.log'.180828 19:02:13 mysqld_safe Starting mysqld daemon with databases from / data/mysqldata/3306/data [mysql@mysql01 my.cnf.d] $
Log in to MySQL with empty password
[mysql@mysql01 my.cnf.d] $msyql-S / data/mysqldata/3306/mysql.sock bash: msyql: command not found... [mysql@mysql01 my.cnf.d] $mysql-S / data/mysqldata/3306/mysql.sock Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 1Server version: 5.6.31-log Source distributionCopyright (c) 2000, 2016, 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@localhost) [(none)] >
Modify the mysql.user table
(root@localhost) [(none)] > use mysql;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with-ADatabase changed (root@localhost) [mysql] > (root@localhost) [mysql] > select user,host,password from user +-+ | user | host | password | +- -- + | root | localhost | * A0F874BC7F54EE086FCE60A37CE7887D8B31086B | +-- + 1 row in set (0.00 sec) (root@localhost) [mysql] > update User set password=password ('password123') where user='root' Query OK, 0 rows affected (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 0 (root@localhost) [mysql] >
"shut down the database normally
[mysql@mysql01 my.cnf.d] $mysqladmin-S / data/mysqldata/3306/mysql.sock-uroot-paired password123' shutdownWarning: Using a password on the command line interface can be insecure.180828 19:04:54 mysqld_safe mysqld from pid file / data/mysqldata/3306/mysql.pid ended [1] + Done mysqld_safe-- defaults-file='/data/mysqldata/3306/my.cnf'-- skip-grant-tables [mysql@mysql01 my.cnf.d] $
Open the database normally
[mysql@mysql01 my.cnf.d] $mysqld_safe-- defaults-file='/data/mysqldata/3306/my.cnf' & [1] 33094 [mysql@mysql01 my.cnf.d] $180828 19:05:04 mysqld_safe Logging to'/ data/mysqldata/3306/data/../mysql-error.log'.180828 19:05:04 mysqld_safe Starting mysqld daemon with databases from / data/mysqldata/3306/data [mysql@mysql01 my.cnf.d] $
Log in to the database normally
[mysql@mysql01 my.cnf.d] $mysql-uroot-S'/ data/mysqldata/3306/mysql.sock'-p'password123'Warning: Using a password on the command line interface can be insecure.Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 1Server version: 5.6.31-log Source distributionCopyright (c) 2000, 2016, 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@localhost) [(none)] >
At this point, the root password of mysql has been modified.
After reading this article that mysql forgot how to deal with root passwords, many readers will want to know more about it. For more industry information, you can follow our industry information section.
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.