重置mysql root
1、打开配置文件/etc/my.cnf
,添加一行
skip-grant-tables
2、重启 service mysqld restart 或 systemctl restart mysqld
3、mysql -uroot -p进入
3.1 select host, user, authentication_string, plugin from user;
3.2 root 清空密码 update user set authentication_string='' where user='root';
3.3 修改密码 字母(大小写)数字特殊符
alter user 'root'@'localhost' identified by '你的新密码';
1. 使用 caching_sha2_password 插件
修改用户密码,并且用插件生成。
ALTER USER 'user'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'password';
2、修改 /etc/mysql/my.cnf
[mysqld]
default_authentication_plugin= mysql_native_password
3、修改密码
ALTER USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';