Linux6.9用RPM方式安装MySQL5.7.21
1.下载安装包
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21-1.el6.x86_64.rpm-bundle.tar
2.解压缩
tar -xf mysql-5.7.21-1.el6.x86_64.rpm-bundle.tar
3.安装依赖包
yum install -y numactl
yum install -y perl
4.依次安装
rpm -ivh mysql-community-common-5.7.21-1.el6.x86_64.rpm rpm -ivh mysql-community-libs-5.7.21-1.el6.x86_64.rpm rpm -ivh mysql-community-devel-5.7.21-1.el6.x86_64.rpm rpm -ivh mysql-community-client-5.7.21-1.el6.x86_64.rpm rpm -ivh mysql-community-server-5.7.21-1.el6.x86_64.rpm
5.启动服务
service mysqld start
6.修改安全模式
vim /etc/my.cnf
在最后添加 skip-grant-tables,保存退出重启mysql服务
7.修改root密码
use mysql update user set password_expired='N' where user='root'; update user set authentication_string=password('123456') where user='root'; flush privileges;
退出并去掉之前的skip-grant-tables,之后重启MySQL服务