配置YUM源
在MySQL官网中下载YUM源rpm安装包:http://dev.mysql.com/downloads/repo/yum/
wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
sudo yum localinstall -y mysql80-community-release-el7-1.noarch.rpm
安装
sudo yum install -y mysql mysql-server mysql-devel
启动
sudo systemctl start mysqld
查看是否启动成功
sudo systemctl status mysqld
开机启动
systemctl enable mysqld
systemctl daemon-reload
修改root本地登录密码
mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改
grep 'temporary password' /var/log/mysqld.log
默认安装了密码安全检查插件(validate_password),默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。否则会提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements错误
mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456Ex!';