1.新建目录mysql /usr/local/目录下
![enter image description here](/tfl/pictures/202208/tapd_46649215_1659349512_22.png)
2.检验服务器是否自带数据库:rpm -qa | grep mariadb*,有则删除:rpm -ev --nodeps mariadb-libs-5.5.68-1.el7.x86_64
![enter image description here](/tfl/pictures/202208/tapd_46649215_1659349607_36.png)
3.上传mysql安装包至/usr/local/mysql目录下
![enter image description here](/tfl/pictures/202208/tapd_46649215_1659349790_13.png)
4.切换至/usr/local/mysql目录并解压 tar -xf mysql-5.7.37-1.el7.x86_64.rpm-bundle.tar
![enter image description here](/tfl/pictures/202208/tapd_46649215_1659349846_85.png)
5.当前目录顺序安装如下rpm包
rpm -ivh mysql-community-common-5.7.37-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.37-1.el7.x86_64.rpm
rpm -ivh mysql-community-devel-5.7.37-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.37-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.37-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.37-1.el7.x86_64.rpm
![enter image description here](/tfl/pictures/202208/tapd_46649215_1659350056_53.png)
6.启动mysql服务:systemctl start mysqld 并查看状态:systemctl status mysqld
![enter image description here](/tfl/pictures/202208/tapd_46649215_1659350101_32.png)
7.获取临时密码:grep 'temporary password' /var/log/mysqld.log
![enter image description here](/tfl/pictures/202208/tapd_46649215_1659350205_34.png)
8.密码登录mysql -u root -p
![enter image description here](/tfl/pictures/202208/tapd_46649215_1659350252_78.png)
9.修改密码复杂度,设置时区,修改密码
set global validate_password_policy=LOW;
set global validate_password_length=5;
set global time_zone = '+8:00';
ALTER USER 'root'@'localhost' IDENTIFIED BY 'yunwei@123!';
![enter image description here](/tfl/pictures/202208/tapd_46649215_1659350372_37.png)
10.重新登录后修改远程或其他地址访问
use mysql;
update user set Host='%' where User='root';
flush privileges;
![enter image description here](/tfl/pictures/202208/tapd_46649215_1659350460_72.png)
11.防火墙放行3306端口,并登录数据库连接工具校验
firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --reload
![enter image description here](/tfl/pictures/202208/tapd_46649215_1659350677_28.png)
centos7离线部署mysql5.7参考指南
最新推荐文章于 2024-07-30 17:09:59 发布