Oracle linux 8 二进制安装 MySQL 8.4企业版

本文涉及的产品
RDS DuckDB + QuickBI 企业套餐,8核32GB + QuickBI 专业版
RDS MySQL DuckDB 分析主实例,集群系列 4核8GB
RDS AI 助手,专业版
简介: Oracle linux 8 二进制安装 MySQL 8.4企业版

使用命令ldd --version ldd 检查,确定MySQL 8二进制包版本

[root@mysql8_3 ~]# ldd --version ldd

安装libaio

[root@mysql8_3 ~]#yum install libaio

安装ncurses-compat-libs

[root@mysql8_3 ~]#yum install ncurses-compat-libs

创建安装目录

[root@mysql8_3 ]#mkdir /u01

创建用户

[root@mysql8_3 ]# useradd -r -g mysql -s /bin/false mysql

进入安装目录

[root@mysql8_3 u01]# cd /u01

解压安装包

[root@mysql8_3 u01]# tar xvf mysql-commercial-8.4.4-linux-glibc2.28-x86_64.tar.xz

修改安装目录名字

[root@mysql8_3 u01]# mv mysql-commercial-8.4.4-linux-glibc2.28-x86_64 mysql3308

创建程序目录

[root@mysql8_3 mysql3308]# mkdir base

把解压包的文件及文件夹移动到base目录

[root@mysql8_3 mysql3308]# mv * base/

创建数据目录

[root@mysql8_3 mysql3308]# mkdir data

给整个数据库目录赋予mysql用户及组

[root@mysql8_3 mysql3308]# cd ..
[root@mysql8_3 u01]# chown -R mysql.mysql mysql3308

对数据库进行初始化,记住初始root密码

[root@mysql8_3 mysql3308]# base/bin/mysqld --initialize --datadir=/u01/mysql3308/data/ --user=mysql
2025-04-09T06:10:07.862792Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start.
2025-04-09T06:10:07.866074Z 0 [System] [MY-013169] [Server] /u01/mysql-commercial-8.4.4-linux-glibc2.28-x86_64/base/bin/mysqld (mysqld 8.4.4-commercial) initializing of server in progress as process 11898
2025-04-09T06:10:08.040918Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2025-04-09T06:10:11.812516Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2025-04-09T06:10:25.552364Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: fc9%Xt<E5eF/
2025-04-09T06:10:38.228926Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end.

测试数据库启动

[root@mysql8_3 mysql3308]# ./base/bin/mysqld_safe --datadir=/u01/mysql3308/data/ --user=mysql &
[1] 12586
[root@mysql8_3 mysql3308]# 2025-04-09T06:15:10.255451Z mysqld_safe Logging to '/u01/mysql3308/data/mysql8_3.52.err'.
2025-04-09T06:15:10.330480Z mysqld_safe Starting mysqld daemon with databases from /u01/mysql3308/data

查看启动端口

[root@mysql8_3 mysql3308]# netstat -antupl

修改root 密码

[root@mysql8_3 mysql3308]# ./base/bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.

Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.4.4-commercial
Copyright (c) 2000, 2025, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql> set password='123456';

测试修改后root密码登陆

[root@mysql8_3 mysql3308]# ./base/bin/mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.
Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.4.4-commercial MySQL Enterprise Server - Commercial
Copyright (c) 2000, 2025, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> exit
Bye

添加mysql启动脚本

[root@mysql8_3 mysql3308]# cp base/support-files/mysql.server /etc/init.d/mysql.server

修改mysql启动脚本,并添加程序目录和数据目录

[root@mysql8_3 mysql3308]# vim /etc/init.d/mysql.server

If you change base dir, you must also change datadir. These may get

overwritten by settings in the MySQL configuration files.

basedir=/u01/mysql3308/base
datadir=/u01/mysql3308/data

测试mysql启动脚本

[root@mysql8_3 mysql3308]# /etc/init.d/mysql.server start
Starting MySQL.... SUCCESS!
[root@mysql8_3 mysql3308]# netstat -antupl

添加mysql环境变量

[root@mysql8_3 mysql3308]# echo "export PATH=$PATH:/u01/mysql3308/base/bin" >> /etc/profile
[root@mysql8_3 mysql3308]# source /etc/profile
[root@mysql8_3 mysql3308]# mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.
Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.4.4-commercial MySQL Enterprise Server - Commercial
Copyright (c) 2000, 2025, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>

添加mysql配置文件

[root@mysql8_3 mysql3308]# vim my.cnf
[mysqld]
user=mysql
port=3308
mysqlx_port=33080
basedir=/u01/mysql3308/base
datadir=/u01/mysql3308/data
socket = /u01/mysql3308/data/mysql.sock
pid-file = /u01/mysql3308/data/mysql.pid
log_error = /u01/mysql3308/data/mysql-error.log
log_timestamps=SYSTEM
character_set_server=utf8mb4
skip_name_resolve=1
binlog_format=row
log-bin = /u01/mysql3308/data/binlog
server-id = 03533308
skip_slave_start=1
open_files_limit=65535
innodb_buffer_pool_size=3G
innodb_log_buffer_size=16M
innodb_log_file_size=256M
sort_buffer_size = 6M

修改my.cnf文件属主

[root@mysql8_3 mysql3308]# chown mysql:mysql my.cnf

增加mysql系统自启动脚本

[root@mysql8_3 mysql3308]#

vim /usr/lib/systemd/system/mysqld83308.service

[Unit]
Description=MySQL Server
Documentation=mysqld.service
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/u01/mysql3308/base/bin/mysqld --defaults-file=/u01/mysql3308/my.cnf
LimitNOFILE = 5000

测试mysql自启动脚本

[root@mysql8_3 mysql3308]# systemctl restart mysqld83308.service
[root@mysql8_3 mysql3308]# netstat -antupl

测试mysql自启动脚本后,root登陆,由于改了sock的路径不是默认的/tmp/mysql.sock,所以登录root需要手动指定sock路径

[root@mysql8_3 mysql3308]# mysql -uroot -p123456 -S /u01/mysql3308/data/mysql.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.

Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.4.4-commercial MySQL Enterprise Server - Commercial
Copyright (c) 2000, 2025, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>

图片
6qrt4xwe6vjg6_048af03f2c4d4dc783e437bf6c59d206.png

相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
本实验从Web应用上云这个最基本的、最普遍的需求出发,帮助IT从业者们通过“阿里云Web应用上云解决方案”,了解一个企业级Web应用上云的常见架构,了解如何构建一个高可用、可扩展的企业级应用架构。
MySQL数据库入门学习
本课程通过最流行的开源数据库MySQL带你了解数据库的世界。 &nbsp; 相关的阿里云产品:云数据库RDS MySQL 版 阿里云关系型数据库RDS(Relational Database Service)是一种稳定可靠、可弹性伸缩的在线数据库服务,提供容灾、备份、恢复、迁移等方面的全套解决方案,彻底解决数据库运维的烦恼。 了解产品详情:&nbsp;https://www.aliyun.com/product/rds/mysql&nbsp;
相关文章
|
10月前
|
关系型数据库 应用服务中间件 nginx
Docker一键安装中间件(RocketMq、Nginx、MySql、Minio、Jenkins、Redis)
本系列脚本提供RocketMQ、Nginx、MySQL、MinIO、Jenkins和Redis的Docker一键安装与配置方案,适用于快速部署微服务基础环境。
|
7月前
|
Ubuntu 关系型数据库 MySQL
MySQL源码编译安装
本文详细介绍了MySQL 8.0及8.4版本的源码编译安装全过程,涵盖用户创建、依赖安装、cmake配置、编译优化等步骤,并提供支持多Linux发行版的一键安装脚本,适用于定制化数据库部署需求。
1809 4
MySQL源码编译安装
|
7月前
|
Ubuntu 关系型数据库 MySQL
MySQL二进制包安装
本文详细介绍了在多种Linux系统上通过二进制包安装MySQL 8.0和8.4版本的完整过程,涵盖用户创建、glibc版本匹配、程序解压、环境变量配置、初始化数据库及服务启动等步骤,并提供支持多发行版的一键安装脚本,助力高效部署MySQL环境。
1008 4
MySQL二进制包安装
|
7月前
|
安全 关系型数据库 MySQL
MySQL包安装 -- SUSE系列(离线RPM包安装MySQL)
本文详细介绍在openSUSE系统上通过离线RPM包安装MySQL 8.0和8.4版本的完整步骤,包括下载地址、RPM包解压、GPG密钥导入、使用rpm或zypper命令安装及服务启动验证,涵盖初始密码获取与安全修改方法,适用于无网络环境下的MySQL部署。
745 3
MySQL包安装 -- SUSE系列(离线RPM包安装MySQL)
|
7月前
|
关系型数据库 MySQL Linux
MySQL包安装 -- SUSE系列(SUSE资源库安装MySQL)
本文介绍了在openSUSE系统上通过SUSE资源库安装MySQL 8.0和8.4版本的完整步骤,包括配置国内镜像源、安装MySQL服务、启动并验证运行状态,以及修改初始密码等操作,适用于希望在SUSE系列系统中快速部署MySQL的用户。
712 3
MySQL包安装 -- SUSE系列(SUSE资源库安装MySQL)
|
7月前
|
NoSQL 算法 Redis
【Docker】(3)学习Docker中 镜像与容器数据卷、映射关系!手把手带你安装 MySql主从同步 和 Redis三主三从集群!并且进行主从切换与扩容操作,还有分析 哈希分区 等知识点!
Union文件系统(UnionFS)是一种**分层、轻量级并且高性能的文件系统**,它支持对文件系统的修改作为一次提交来一层层的叠加,同时可以将不同目录挂载到同一个虚拟文件系统下(unite several directories into a single virtual filesystem) Union 文件系统是 Docker 镜像的基础。 镜像可以通过分层来进行继承,基于基础镜像(没有父镜像),可以制作各种具体的应用镜像。
775 6
|
8月前
|
安全 关系型数据库 MySQL
CentOS 7 yum 安装 MySQL教程
在CentOS 7上安装MySQL 8,其实流程很清晰。首先通过官方Yum仓库来安装服务,然后启动并设为开机自启。最重要的环节是首次安全设置:需要先从日志里找到临时密码来登录,再修改成你自己的密码,并为远程连接创建用户和授权。最后,也别忘了在服务器防火墙上放行3306端口,这样远程才能连上。
1885 16
|
7月前
|
运维 Ubuntu 关系型数据库
MySQL包安装 -- Debian系列(Apt资源库安装MySQL)
本文介绍了在Debian系列系统(如Ubuntu、Debian 11/12)中通过APT仓库安装MySQL 8.0和8.4版本的完整步骤,涵盖添加官方源、配置国内镜像、安装服务及初始化设置,并验证运行状态,适用于各类Linux运维场景。
2139 0
MySQL包安装 -- Debian系列(Apt资源库安装MySQL)
|
7月前
|
Oracle 关系型数据库 MySQL
MySQL包安装 -- RHEL系列(离线RPM包安装MySQL)
本文详细介绍在Rocky、CentOS、AlmaLinux、openEuler等主流Linux系统上,通过离线RPM包安装MySQL 8.0和8.4版本的完整步骤,涵盖下载、依赖处理、rpm/yum安装、服务启动、密码设置等关键环节,适用于多种企业级环境部署需求。
2071 0
MySQL包安装 -- RHEL系列(离线RPM包安装MySQL)

相关产品

  • 云数据库 RDS MySQL 版