打开Mysql下载页面
https://downloads.mysql.com/archives/community/
选择版本号:
centos选择Red Hat版本,复制地址
复制地址后,链接ssh,添加储存库
yum install 粘贴地址;
yum install https://downloads.mysql.com/archives/get/p/23/file/mysql-community-server-8.0.28-1.el7.x86_64.rpm
安装
yum install mysql-community-server
如果安装失败,导入key
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
继续安装
yum install mysql-community-server
启动mysql
systemctl start mysqld
设置开机启动
systemctl enable mysqld
查看mysql安装后的初始密码
sudo grep 'temporary password' /var/log/mysqld.log
执行 MySQL 安全性设置:
sudo mysql_secure_installation