In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
I just heard a buddy say that he executed a sentence: revoke all on *. * from root@localhost;-- hehe, what kind of psychological activity at that time, what kind of hate this is.
So the small dish did an experiment, feeling that the solution should be the same as skipping permission to reset the password after the password was lost. Of course, this is just a train of thought, try to know.
First stop the database [root@mysql ~] # service mysql3306 stop-- shut down the database only by stopping the service because you forget your password.
Shutting down MySQL. [OK]
[root@mysql ~] #
[root@mysql] # / usr/local/mysql/bin/mysqld_safe-- defaults-file=/usr/local/mysql/etc/my.cnf-- skip-grant-tables &-- start the database by skipping password verification [2] 11254
[root@mysql ~] # 160330 16:56:22 mysqld_safe Logging to'/ usr/local/mysql/log/err3306.log'.
160330 16:56:22 mysqld_safe Starting mysqld daemon with databases from / usr/local/mysql/data
[root@mysql ~] # ps-ef | grep mysql-check that the database has been started
Root 11254 6904 0 16:56 pts/2 00:00:00 / bin/sh / usr/local/mysql/bin/mysqld_safe-- skip-grant-tables
Mysql 11771 11254 0 16:56 pts/2 00:00:00 / usr/local/mysql/bin/mysqld-basedir=/usr/local/mysql-datadir=/usr/local/mysql/data-plugin-dir=/usr/local/mysql/lib/plugin-user=mysql-skip-grant-tables-log-error=/usr/local/mysql/log/err3306.log-pid-file=/usr/local/mysql/data/mysql.lz.com.pid-socket=/usr/local/mysql/mysqld3306.sock-port=3306
Root 11795 6904 0 16:57 pts/2 00:00:00 grep mysql
[root@mysql ~] # / usr/local/mysql/bin/mysql-- socket=/usr/local/mysql/mysqld3306.sock-- port=3306-- log in to the database directly without specifying a user and password
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 2
Server version: 5.5.17-log Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
Mysql > select user ();-- defaults to root user login
+-+
| | user () |
+-+
| | root@ |
+-+
1 row in set (0.00 sec)
Root@master 08:41:31 > grant all on *. * to 'root'@'localhost'
ERROR 1290 (HY000): The MySQL server is running with the-- skip-grant-tables option so it cannot execute this statement
Find a solution online:
At this point, all we need
Once you flush privileges, you will OK when you add users.
Mysql > flush privileges
Query OK, 0 rows affected (0.01 sec)
Root@master 08:45:59 > grant all on *. * to 'ivan'@'localhost' identified by' mysql321' with grant option
Query OK, 0 rows affected (0.01 sec)
Root@master 08:46:24 > flush privileges
Query OK, 0 rows affected (0.01 sec)
Root@master 08:46:31 > quit
Bye
[root@mysql data] # service mysql3306 stop
Shutting down MySQL..160409 08:46:39 mysqld_safe mysqld from pid file / usr/local/mysql/mysql3306.pid ended
[OK]
[1] + Done / usr/local/mysql/bin/mysqld_safe-defaults-file=/usr/local/mysql/etc/my.cnf-skip-grant-tables
[root@mysql data] # ps-ef | grep msyql
Root 62709 57953 0 08:46 pts/1 00:00:00 grep msyql
[root@mysql data] # service mysql3306 start
Starting MySQL.. [OK]
[root@mysql data] # / usr/local/mysql/bin/mysql-uivan-p
Enter password:
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 1
Server version: 5.5.17-log Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
Ivan@master 08:47:36 > grant all on *. * to 'root'@'localhost' with grant option
Query OK, 0 rows affected (0.00 sec)
[root@mysql data] # / usr/local/mysql/bin/mysql-uroot-p
Enter password:
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 9
Server version: 5.5.17-log Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
Root@master 08:49:33 > show databases
+-+
| | Database |
+-+
| | information_schema |
| | c_test |
| | ivan |
| | mysql |
| | performance_schema |
| | test |
| | webcat |
+-+
So far, everything is fine. Ah ha ha.
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.