rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
yum install mysql-community-server -y
systemctl start mysqld.service && systemctl enable mysqld.service
cat /var/log/mysqld.log | grep password
alter user 'root'@'localhost' identified by '14@dfa.';
use mysql;
update user set host='主机' where user='用户';
flush privileges;
create user '用户'@'主机' identified by '密码';
grant all privileges on *.* to '用户'@'主机';
- 默认身份插件: 旧:
mysql_native_password
新 caching_sha2_password
更改单个用户默认身份插件
alter user '用户名'@'主机' identified width mysql_native_password by '密码';
更改全局用户身份插件需要修改配置文件
[mysqld]
default_authentication_plugin=mysql_native_password
查看身份认证插件命令:
show variables like 'default_authentication_plugin%';
- 关于 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 的解决办法
mysql -uroot -p 直接回车登录到MySQL服务器,然后进行修改,可以输入命令:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '密码'
网友评论