yi- 获取rpm包
(以8.0版本为例)
[yiki@ ~] wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
[yiki@ ~] rpm -ivh mysql80-community-release-el7-3.noarch.rpm
[yiki@ ~] yum repolist all |grep mysql
查看软件包发现默认开启了8.0版本,选择自己要装的版本,更改repo文件
/etc/yum.repos.d/mysql-community.repo 修改想要安装的版本和8.0版本的enable值。
[yiki@ ~] yum -y install mysql mysql-server
[yiki@ ~] systemctl start mysqld
[yiki@ ~] systemctl enable mysqld
- 修改初始密码,mysql支持强密码,可以更改强密码规则使用弱密码但不推荐。
(强密码:含大小写数字和特殊字符,至少8位)
[yiki@ ~] grep 'password' /var/log/mysql.log
2019-11-27T03:26:18.569535Z 1 [Note] A temporary password is generated
for root@localhost: sye&h?pk)4&G
[yiki@ ~] mysqladmin -uroot -p'sye&h?pk)4&G' password Yiki@12345
[yiki@ ~] mysql -uroot -pYiki@12345
即可登陆