0
0
MySQL8修改密码
文章摘要
|
MySql 从8.0开始修改密码有了变化,在user表加了字段authentication_string,修改密码前先检查authentication_string是否为空
1、如果不为空
use mysql;
将字段置为空
update user set authentication_string='' where user='root';
修改密码为123456
ALTER user 'root'@'localhost' IDENTIFIED BY '123456';
2、如果为空,直接修改
ALTER user 'root'@'localhost' IDENTIFIED BY '123456';
如果出现类似如下错误
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> GRANT ALL PRIVILEGES ON *.* TO IDENTIFIED BY '123' WITH GRANT OPTION;
需要刷新权限
flush privileges;
然后再执行
ALTER user 'root'@'localhost' IDENTIFIED BY '123456';
