MySQL 8.4版本离线部署的实现
目录
- 1、查看系统信息
- 2、下载对应版本的mysql8.4
- 3、下载完后上传到机器,上传到rpm目录下
- 4、清理机器遗留数据库环境
- 5、解压mysql的tar包,并安装
- 6、修改MySQL配置文件
- 7、修改MySQL目录的属主属组
- 8、初始化mysql,配置远程登录,设置开机自启
1、查看系统信息
[root@test3 ~]# cat /etc/RedHat-release Red Hat Enterprise linux Server release 7.6 (Maipo) [root@test ~]# uname -a Linux TVVMOF0063 3.10.0-1160.el7.x86_64 #1 SMP Tue Aug 18 14:50:17 EDT 2020 x86_64 x86_64 x86_64 GNU/Linux
系统版本为red hat 7.6 x86_64
2、下载对应版本的MySQL8.4
https://dev.mysql.com/downloads/mysql/
3、下载完后上传到机器,上传到rpm目录下
创建MySQL目录 [root@test ~]# mkdir -p /data/apps/mysql-8.4/{data,log,mysqld,rpm} [root@test ~javascript]# cd /data/apps/mysql-8.4/rpm [root@test rpm]# ll -rw-r--r-- 1 root root 1036984320 6月 4 13:33 mysql-8.4.0-1.el7.x86_64.rpm-bundle.tar
4、清理机器遗留数据库环境
[root@test rpm]# rpm -qa |grep mariadb [root@test rpphpm编程]# rpm -e mariadb-libs-5.5.65-1.el7.x86_64 --nodeps
5、解压mysql的tar包,并安装
[root@test rpm]# tar xf mysql-8.4.0-1.el7.x86_64.rpm-bundle.tar [root@test rpm]# ll -rw-r--r-- 1 root root 15319156 4月 11 03:20 mysql-community-client-8.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 3624848 4月 11 03:20 mysql-community-client-plugins-8.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 705472 4月 11 03:20 mysql-community-common-8.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 565343084 4月 11 03:21 mysql-community-debuginfo-8.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 2022488 4月 11 03:21 mysql-community-devel-8.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 4218804 4月 11 03:21 mysql-community-embedded-compat-8.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 2346044 4月 11 03:21 mysql-community-icu-data-files-8.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 1591356 4月 11 03:21 mysql-community-libs-8.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 686984 4月 11 03:21 mysql-community-libs-compat-8.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 63789924 4月 11 03:21 mysql-community-server-8.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 26371104 4月 11 03:22 mysql-community-server-debug-8.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 350952856 4月 11 03:23 mysql-community-test-8.4.0-1.el7.x86_64.rpm ---------------------#开始rpm安装------------------------ [root@test rpm]# rpm -ivh mysql-community-common-8.4.0-1.el7.x86_64.rpm [root@test rpm]# rpm -ivh mysql-community-icu-data-files-8.4.0-1.el7.x86_64.rpm [root@test rpm]# rpm -ivh mysql-community-client-plugins-8.4.0-1.el7.x86_64.rpm [root@test rpm]# rpm -ivh mysql-community-libs-8.4.0-1.el7.x86_64.rpm [root@test rpm]# rpm -ivh mysql-community-client-8.4.0-1.el7.x86_64.rpm [root@test rpm]# rpm -ivh mysql-community-server-8.4.0-1.el7.x86_64.rpm [root@test rpm]# rpm -ivh mysql-community-libs-compat-8.4.0-1.el7.x86_64.rpm [root@test rpm]# rpm -qa | grep mysql mysql-community-client-plugins-8.4.0-1.el7.x86_64 mysql-community-libs-compat-8.4.0-1.el7.x86_64 mysql-community-icu-data-files-8.4.0-1.el7.x86_64 mysql-community-libs-8.4.0-1.el7.x86_64 mysql-community-server-8.4.0-1.el7.x86_64 mysql-community-common-8.4.0-1.el7.x86_64 mysql-community-client-8.4.0-1.el7.x86_64
安装mysql-community-libs-compat(php依赖文件,也可以在7.4以后安装)
注意:如果需要搭载php使用,需要安装7.7,因为mysql-community-libs-compat是php的依赖。;如果不安装php,则无需安装7.7的依赖。
6、修改MySQL配置文件
[root@test rpm]# vim /etc/my.cnf [mysqld] datadir=/data/apps/mysql-8.4/data socket=/data/apps/mysql-8.4/data/mysql.sock log-error=/data/apps/mysql-8.4/log/mysqld.log pid-file=/data/apps/mysql-8.4/mysqld/mysqld.pid #表、列名大小写不敏感,0为区分大小写 lower_case_table_names=1 #启用8版本以前的加密认证,默认是废弃的 mysql_native_password=ON
7、修改MySQL目录的属主属组
[root@test rpm]# chown -R mysql.mysql /data/apps/mysql-8.4
8、初始化mysql,配置远程登录,设置开机自启
这里笔者踩了一个大坑,mysql8如果想要不去分大小写的话,需要在初始化的时候指定这个参数,否则就只能重新初始化再进行指定
mysqld --defaults-file=/etc/my.cnf --basedir=/data/apps/mysql-8.4/data --datadir=/data/apps/mysql-8.4/datpythona/ --initialize --lower_case_table_names=1 --mysql_native_password=ON
[root@teest rpm]# mysqld --defaults-file=/etc/my.cnf --basedir=/data/apps/mysql-8.4/data --datadir=/data/apps/mysql-8.4/data/ --initialize --lower_case_table_names=1 --mysql_native_password=ON [root@teest rpm]# systemctl enable mysqld --now [root@teest rpm]# grep 'temporary password' /data/apps/mysql-8.4/log/mysqld.log 2024-01-05T02:49:43.997196Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: YeVRoX*pz219 [root@teest rpm]# mysql -uroot -pYeVRoX*pz219_ #如果报socket 文件找不到可以后面添加 --socket 参数指定socket文件位置 #修改密码 mysql> alter user 'root'@'localhost' identified by '新密码'; #刷新配置 mysql> flush privileges; #配置远程登录 mysql> use mysql; mysql> select host, user from user; #百分号%,所有的IP地址都可以访问 mysql> update user set host = '%'http://www.devze.com where user = 'root'; mysql> select host, user from user; mysql> flush privileges; #密码设置完成后再用新密码登录测试
到此这篇关于MySQL 8.4版本离线部署的实现的文章就介绍到这了,更多相关MySQL 8.4离线部署内容请搜索编程客栈(www.devze.com)以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程客栈(www.devze.com)!
精彩评论