centos6.8使用yum安装mysql8.0以及远程连接

1、yum查看指定已安装的软件
yum list installed | grep mysql

2、删除yum源
yum -y remove xxx

3、下载mysql yum源
wget http://repo.mysql.com/mysql80-community-release-el6.rpm

centos6.8使用yum安装mysql8.0以及远程连接

4、查看已安装的mysql yum源
yum repolist all | grep mysql

centos6.8使用yum安装mysql8.0以及远程连接

5、yum安装mysql
yum install mysql-community-server -y

centos6.8使用yum安装mysql8.0以及远程连接

6、启动mysql服务
service mysqld start

centos6.8使用yum安装mysql8.0以及远程连接

7、设置mysql服务开机自启
chkconfig mysqld on

8、查看默认mysql密码

grep 'password' /var/log/mysql.log

centos6.8使用yum安装mysql8.0以及远程连接

报错问题解决
1、error 1819(HY000):
    查看mysql初始的密码策略 show global variables like 'validate_password%';
    调整MySQL密码验证规则,修改 policy 和 length 的值
    set global validate_password.policy=0;(验证策略 0-->low 1-->MEDIUM 2-->strong)
    set global validate_password.length=8;(密码最小长度)

centos6.8使用yum安装mysql8.0以及远程连接

2、error 1290(HY000):
    只需要刷新生效即可 flush privileges

centos6.8使用yum安装mysql8.0以及远程连接

3、error 1396(HY000):
    查看root账户的host
    select user,host from user;

centos6.8使用yum安装mysql8.0以及远程连接

注意看,我的host是“%”,你输入的命令可能是:
alter user'root'@'localhost' identified by 'test';
将命令改成:
alter user 'root'@'%' identified by 'test';

开启远程连接

grant all privileges on *.* 'root'@'%' identified by '' with grant option;