# mysql 8安装步骤和遇到的问题
基本命令
安装 :
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
yum install mysql80-community-release-el7-3.noarch.rpm
yum install mysql-community-server
启动 : service mysqld start/restart
停止 : service mysqld stop
查看状态: service mysqld status
查看默认密码:cat /var/log/mysqld.log | grep password
登录:mysql -u root -p [password]
问题1:host is not allowed to connect to this mysql server
解决办法:mysql -u root -p 进入mysql
use mysql;
select host from user where user='root';
可以看到host只能允许localhost登录,不允许远程登录,将"localhost"改称"%"
update user set host = '%' where user ='root';`
最后刷新配置
flush privileges;
问题2:Authentication plugin ‘caching_sha2_password’ cannot be loaded
解决办法:进入mysql
ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用户的密码
flush privileges; #刷新
alter user 'root'@'%' identified by '123456'; #修改密码