skip-grant-tables

 #####################################

oot@localhost (mysql)> grant all privileges on *.* to 'tmp3308'@'%' identified by 'tmp3308' with grant option;
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
root@localhost (mysql)>

 

 

 

 

 

 

 

 

 

 

[work@a8-cloud-dba-db08 mysql_3306]$ ./bin/mysqld_safe --defaults-file=./conf/my.cnf --skip-grant-tables  &
[2] 21260
[1]   Killed                  ./bin/mysqld_safe --defaults-file=./conf/my.cnf --skip-grant-tables
[work@a8-cloud-dba-db08 mysql_3306]$ 2023-04-17T14:39:49.358081Z mysqld_safe Logging to '/home/work/mysql_3306/log/log.error'.
2023-04-17T14:39:49.391901Z mysqld_safe Starting mysqld daemon with databases from /home/work/mysql_3306/data

[work@a8-cloud-dba-db08 mysql_3306]$ ./bin/mysql  -S /home/work/mysql_3306/tmp/mysql.sock
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.25 Source distribution

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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> update mysql.user set authentication_string=MD5('root') where user='root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> 

 

 

 

 


加上--skip-grant-tables参数启动


#先将将密码置空

mysql>update
user set authentication_string = '' where user = 'root'; # 删掉步skip-grant-tables,重启 #

./bin/mysql -S /home/work/mysql_3306/tmp/mysql.sock -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.25 Source distribution


Copyright (c) 2000, 2021, Oracle and/or its affiliates.


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> alter user 'root'@localhost IDENTIFIED WITH mysql_native_password BY 'root';
Query OK, 0 rows affected (0.00 sec)


mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)


mysql>



 

 

 

 

 

 

 

 

 

 

 

 

#############################

posted @ 2019-11-23 00:01  igoodful  阅读(207)  评论(1编辑  收藏  举报