仓库安装
[root@localhost ~]# rpm -ivh https://repo.mysql.com//mysql80-community-release-el9-1.noarch.rpm
[root@hezhihao ~]# dnf install mysql-server -y
![](https://img-blog.csdnimg.cn/img_convert/14094bbb5cf8dd913075fc0d63ea3f7c.png)
![](https://img-blog.csdnimg.cn/img_convert/cc811916cb604e706f60d00e0b3cffaf.png)
本地安装
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.32-1.el9.x86_64.rpm-bundle.tar
tar xvf mysql-8.0.32-1.el9.x86_64.rpm-bundle.tar
dnf localinstall mysql-community-server-8.0.32-1.el9.x86_64.rpm
systemctl start mysqld
systemctl status mysqld
grep 'temporary password' /var/log/mysqld.log
![](https://img-blog.csdnimg.cn/img_convert/392e4db3e33f4915e42b66ca8843041f.png)
容器安装
nf install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
dnf install docker-ce --allowerasing -y
systemctl start docker
systemctl status docker
docker version
docker run hello-world
docker run --name mysqltest -e MYSQL_ROOT_PASSWORD=123456 -d mysql
docker ps
docker exec -it mysqltest /bin/bash
![](https://img-blog.csdnimg.cn/img_convert/43fdf7cc5c1d40f4bb19e4b5a9eb3d11.png)
源码安装
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
tar xvf mysql-boost-8.0.32.tar.gz
yum install gcc gcc-c++ cmake -y
yum install cmake gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-binutils openssl-devel ncurses-devel libtirpc rpcgen git -y
![](https://img-blog.csdnimg.cn/img_convert/67fe3e81607964750e8c2526a4f4ce8e.png)