1.mysqld --defaults-file=my.cnf --skip-grant-tables &
2.mysql -uroot -S mysql.sock
mysql> alter user root@'192.168.0.%' identified by '111111'; ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement mysql> flush privileges; # 不进行flush privileges会报错 Query OK, 0 rows affected (0.16 sec) mysql> alter user root@'192.168.0.%' identified by '111111'; Query OK, 0 rows affected (0.03 sec)
3.重启mysql
参考:
https://www.cnblogs.com/mschen/p/11511578.html