1、(跳权限)cd:C:\Program Files\MySQL\MySQL Server 8.0\bin:mysqld --console --skip-grant-tables --shared-memory
2、ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘新密码’;
如报以下错误:The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
解决办法:
mysql> set global read_only=0;
(关掉新主库的只读属性)
flush privileges;
3、ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘新密码’;
flush privileges;
4、mysql -u rooy -p; 试验