CentOS7系统yum方式安装MySQL5.7
最新的yum源可以去http://dev.mysql.com/downloads/repo/yum下载
1、获取mysql官方yum repository 可安装版的包;
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
2、安装下载rpm包;
yum -y install mysql57-community-release-el7-10.noarch.rpm
3、安装mysql-community-server
yum -y install mysql-community-server
4、启动mysql;
systemctl start mysqld.service
systemctl status mysqld.service
5、登录mysql,查找初始密码;
grep "password" /var/log/mysqld.log
6、临时修改密码策略,否则密码要求复杂度较高,8位以上,大小写字母加特殊符号;
set global validate_password_policy=0;
set global validate_password_length=1;
7、设置root密码;
ALTER USER 'root'@'localhost' IDENTIFIED BY '';
set password=password('root');
SHOW VARIABLES LIKE 'validate_password%';
8、卸载掉mysql的yum repository
yum -y remove mysql57-community-release-el7-10.noarch
9、远程连接关闭防火墙:
systemctl status firewalld
systemctl stop firewalld
10、修改用户root登录host配置;
use mysql;
update user set host='%' where user='root';