系统要求:
CentOS 7.6 64位
卸载系统自带mariadb-lib
1、
rpm -qa|grep mariadb
2、
rpm -e mariadb-libs-5.5.68-1.el7.x86_64 --nodeps
解压tar包:
tar -xvf mysql*.tar
以下加粗rpm包需要安装:
mysql-community-common-5.7.23-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.23-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.23-1.el7.x86_64.rpm
mysql-community-server-5.7.23-1.el7.x86_64.rpm
mysql-community-devel-5.7.23-1.el7.x86_64.rpm
mysql-community-libs-5.7.23-1.el7.x86_64.rpm
mysql-community-client-5.7.23-1.el7.x86_64.rpm
mysql-community-server-minimal-5.7.23-1.el7.x86_64.rpm
mysql-community-test-5.7.23-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.23-1.el7.x86_64.rpm
mysql-community-embedded-5.7.23-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.23-1.el7.x86_64.rpm
tar包资源内容在文章最后链接获得
安装mysql:
依次执行下面的命令
1、
rpm -ivh mysql-community-common-5.7.23-1.el7.x86_64.rpm
2、
rpm -ivh mysql-community-libs-5.7.23-1.el7.x86_64.rpm
3、
rpm -ivh mysql-community-client-5.7.23-1.el7.x86_64.rpm
4、
rpm -ivh mysql-community-server-5.7.23-1.el7.x86_64.rpm
注意,如果在执行server rpm包时报错
error: Failed dependencies: libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.23-1.el7.x86_64 libnuma.so.1(libnuma_1.1)(64bit) is needed by mysql-community-server-5.7.23-1.el7.x86_64 libnuma.so.1(libnuma_1.2)(64bit) is needed by mysql-community-server-5.7.23-1.el7.x86_64
执行下面的命令然后重新执行server rpm包即可
sudo yum install numactl-libs
5、
rpm -ivh mysql-community-devel-5.7.23-1.el7.x86_64.rpm
启动mysql
systemctl start mysqld
修改密码及策略
查看初始密码
grep 'temporary password' /var/log/mysqld.log
如图中密码为 -l9qwXz.?elx
修改密码
mysql -uroot -p
#策略要求
set global validate_password_policy=0;
#密码长度
set global validate_password_length=4;
set password=password('123456');
grant all on *.* to root@'%' identified by '123456' with grant option;
flush privileges;
设置开机启动
systemctl enable mysqld
systemctl daemon-reload
链接:https://pan.baidu.com/s/1xr3pMqg4cyys0Snpr0T-Jg?pwd=taov
提取码:taov