1:下载mysql包
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar
2:创建新的文件夹mysql,移动压缩包到mysql文件夹中
3:解压文件
tar -xvf mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar
3、逐步安装mysql注意:需要按照以下安装顺序进行安装,否则会出问题
安装顺序:common–> libs–> libs-compat --> client–> server
依次执行以下命令,提示100%字样表示安装成功
1:rpm -ivh mysql-community-common-8.0.22-1.el7.x86_64.rpm --nodeps --force
2:rpm -ivh mysql-community-libs-8.0.22-1.el7.x86_64.rpm --nodeps --force
3:rpm -ivh mysql-community-libs-compat-8.0.22-1.el7.x86_64.rpm --nodeps --force
4:rpm -ivh mysql-community-client-8.0.22-1.el7.x86_64.rpm --nodeps --force
5:rpm -ivh mysql-community-server-8.0.22-1.el7.x86_64.rpm --nodeps --force
4:初始化mysql
mysqld --initialize;
chown mysql:mysql /var/lib/mysql -R;
systemctl start mysqld.service;
systemctl enable mysqld;
查看数据库默认随记密码
cat /var/log/mysqld.log | grep password
使用随记密码登录 MySQL
mysql -uroot -p
5:使用随机密码进行登录
centos7 安装 mysql8 强制修改密码:https://blog.csdn.net/qq_26898033/article/details/120222699