1.在/usr/local下创建mysql目录
cd /usr/local
mkdir /mysql
2.在mysql目录中下载
cd mysql/
wget https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.34-1.el9.x86_64.rpm-bundle.tar
3.解压
tar xvf mysql-8.0.34-1.el9.x86_64.rpm-bundle.tar
4.安装
dnf localinstall mysql-community-server-8.0.34-1.el9.x86_64.rpm mysql-community-client-8.0.34-1.el9.x86_64.rpm mysql-community-common-8.0.34-1.el9.x86_64.rpm mysql-community-icu-data-files-8.0.34-1.el9.x86_64.rpm mysql-community-client-plugins-8.0.34-1.el9.x86_64.rpm mysql-community-libs-8.0.34-1.el9.x86_64.rpm
5.启动服务
systemctl start mysqld
6.检查启动状况
systemctl status mysqld
7.获取初始登录密码,并复制
grep password /var/log/mysqld.log
8.登录mysql
mysql -uroot -p
.....初始密码.....
9.修改登录密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Openlab123!';
ctrl + D:退出mysql