mysql failed to modify root password

 After logging in with the mysql-u root -p password, use the following command to prepare to update the password (assuming the following mysql),

set password for root@localhost=password('mysql');

The result is as follows, an error message appears, showing a grammatical error. At first I thought it was a wrong character or password length format.

 

It turns out that the version above 8.0 does not support changing the password above.

Change to the following command:

alter user 'root'@'localhost' identified by 'mysql';

It should be noted that after execution, you need to execute the following command:

flush privileges;

 

mysql-8.0.14 reinstallation steps:

1 卸载
 mysqld -remove
2 初始化(my.ini文件中需要用\\ 单\会报错) mysqld --initialize --console

3 安装 mysql --install

4 启动服务 ,net start mysql 

5 登录(第一次在\data\.err文件里面有默认密码), mysql -u xxx -p xxxxxxx

 

Guess you like

Origin blog.csdn.net/qq_39463175/article/details/109715334