Centos7.9离线环境安装mysql5.7.40步骤

因为客户这边服务器无法上外网,做个记录方便下次使用。

lrzsz 下载
http://mirror.centos.org/centos/7/os/x86_64/Packages/lrzsz-0.12.20-36.el7.x86_64.rpm

安装上传工具

rpm -ivh lrzsz-0.12.20-36.el7.x86_64.rpm 

 Mysql5.7 rpm包下载
https://downloads.mysql.com/archives/community/ 

#下载这4个包:
mysql-community-server-5.7.40-1.el7.x86_64.rpm
mysql-community-client-5.7.40-1.el7.x86_64.rpm
mysql-community-common-5.7.40-1.el7.x86_64.rpm
mysql-community-libs-5.7.40-1.el7.x86_64.rpm

#开始安装mysql5.7

安装前先卸载默认安装的libs和mysql。

#卸载系统自带的mysql相关依赖包
rpm -qa | grep mariadb |grep -v grep |xargs rpm -e --nodeps
rpm -qa | grep -i mysql |grep -v grep |xargs rpm -e --nodeps

 最后按顺序安装:

1.rpm -ivh mysql-community-common-5.7.40-1.el7.x86_64.rpm
2.rpm -ivh mysql-community-libs-5.7.40-1.el7.x86_64.rpm 
3.rpm -ivh mysql-community-client-5.7.40-1.el7.x86_64.rpm
4.rpm -ivh mysql-community-server-5.7.40-1.el7.x86_64.rpm

Centos7.9离线环境安装mysql5.7.40步骤_第1张图片

 数据库启动后root会有一个随机密码,需要手动修改下。
#执行grep 'temporary password' /var/log/mysqld.log 获取到随机密码:.&!O)vP*i8ph

[root@localhost opt]# grep 'temporary password' /var/log/mysqld.log
2023-04-12T07:24:04.209666Z 1 [Note] A temporary password is generated for root@localhost: .&!O)vP*i8ph

 #输入密码登录进数据库修改root密码,密码需要满足复杂性要求。

Enter password: 

mysql> SET PASSWORD FOR 'root'@'localhost'= "Xyz@#123";
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye
#设置开机启动
systemctl enable mysqld.service 

 授权root用户远程登录权限。

use mysql               //选择访问mysql库
update user set host = '%' where user = 'root';
GRANT ALL PRIVILEGES ON *.* TO '*'@'%' WITH GRANT OPTION;
flush privileges;     //刷新

 

你可能感兴趣的:(安装部署记录,服务器,linux,centos)