Centos7.x通过yum 安装MySQL指定版本(5.7.x-8.0)
1,新建MySQL的repo仓库
vim /etc/yum.repos.d/mysql-community.repo
[mysql-server]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=0
#8.0的数据库repo安装
[mysql-server]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch/
enabled=1
gpgcheck=0
2,yum 安装MySQL数据库,安装一整套MySQL的软件
yum -y install mysql mysql-community-server
3,启动MySQL并初始化数据库
systemctl start mysqld.service
4,修改初始密码
grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyxpklPass4!';
参考链接:https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
Great content! Super high-quality! Keep it up! 🙂