一、错误:1251
> cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"
> mysql -u root -p
Enter password: # 直接回车
mysql> use mysql
mysql> alter user 'root'@'localhost' identified with mysql_native_password by '123456';
mysql> flush privileges;
二、MySQL 服务无法启动
【已解决】MySQL 服务正在启动 MySQL 服务无法启动
三、ERROR 1064 (42000)
mysql> set password for root@localhost = password('123456');
# ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near'password('123456')' at line 1
# password改为authentication_string,依旧如此
按【错误:1251】的解决方法试一下
# ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('123456') where `user`='root'' at line 1
按【错误:1251】的解决方法试一下
> net stop mysql # 停止mysql服务(The service doesn't exist!的话,可试一下:net stop mysql8)
> mysqld --skip-grant-tables # 正常的话cmd窗口会卡住,需要重新起一个窗口继续下面的操作
按【错误:1251】的解决方法试一下
SET PASSWORD = '123456'
貌似也可。。。
其他可能用到的命令:
SET SQL_SAFE_UPDATES = 0; # 关闭安全模式
SET SQL_SAFE_UPDATES = 1; # 开启安全模式
好乱。。。