当前环境:VMware 15.1 、CentOS 7.6 、MySQL 5.7
软件包较大,请提前下载[1]好~
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.32-1.el7.x86_64.rpm-bundle.tar
如果是虚拟机环境请拷贝到Linux系统内
#1. 在线下载MySQl软件包
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.32-1.el7.x86_64.rpm-bundle.tar
#2. 安装依赖
yum install -y perl libaio net-tools
#3. 卸载mariadb数据库,以防安装冲突
rpm -qa | grep mariadb
yum remove mariadb-libs
#4. 解压 mysql5.7安装包
tar -xvf mysql-5.7.32-1.el7.x86_64.rpm-bundle.tar
#cd 切换到解压后的目录
#ls 查看该目录下有许多 rpm软件
切换到解压后的目录后,开始安装...
#服务端和客户端常用库文件
rpm -ivh mysql-community-common-5.7.32-1.el7.x86_64.rpm
#MySQL数据库客户端共享库
rpm -ivh mysql-community-libs-5.7.32-1.el7.x86_64.rpm
#MySQL 客户端
rpm -ivh mysql-community-client-5.7.32-1.el7.x86_64.rpm
#数据库服务端与相关工具
rpm -ivh mysql-community-server-5.7.32-1.el7.x86_64.rpm
#查看MySQL 服务的状态
systemctl status mysqld.service
#启动MySQL服务
systemctl start mysqld.service
#查看临时密码
grep "password" /var/log/mysqld.log
#用临时密码登录mysql
mysql -uroot –p
#修改成新的密码
mysql> set password = password("P@ssw0rd");
mysql> quit
[1]
下载: https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.32-1.el7.x86_64.rpm-bundle.tar