重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 152|回复: 3
打印 上一主题 下一主题

[安装] 基于ORACLE LINUX 10.1 MYSQL 8.4 源码安装

[复制链接]
跳转到指定楼层
楼主
发表于 2026-3-13 18:55:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 郑全 于 2026-3-14 10:44 编辑

基于ORACLE LINUX 10.1 MYSQL 8.4 源码安装

看了官网,我向选择二级制安装MYSQL,结果发现针对ORACLE Linux 10,官方只有RPM安装包,没有二进制的10的安装包,有的只是针对 glibc2.28,2.17的二进制安装文件
,没有办法,只有自己动手,使用源码安装。
  glibc2.28 针对 red hat linux 8
  glibc2.17 针对 red hat linux 7

为了方便操作,尽量使用命令行。
下面具体列出源码操作的步骤:


1.环境
  oracle linux 11.1
  MYSQL:8.4.8

  操作安装:最小化安装即可。默认是带图形安装。

2.下载源码

  https://dev.mysql.com/downloads/file/?id=548465

3.配置YUM源
   我这里使用默认配置,但部分包在默认源里找不到,需要开启 ol10_codeready_builder 仓库

   [ol10_codeready_builder]
   name=Oracle Linux 10 CodeReady Builder ($basearch) - (Unsupported)
   baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL10/codeready/builder/$basearch/
   gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
   gpgcheck=1
   enabled=1

4.安装依赖包 make,bison,cmake,gcc-c++,ncurses 等
  这下面这些包都可以通过yum安装

  yum install -y gcc gcc-c++
  yum install -y ncurses-devel
  yum install -y cmake
  yum install -y libaio
  yum install -y bison
  yum install -y libtirpc-devel
  yum install -y rpcgen
  yum install -y cyrus-sasl-devel
  yum install -y openldap-devel
  yum install -y libfido2-devel
  yum install libquadmath-devel


5、cmake    解压源码  tar xvf mysql-8.4.8.tar.gz
  cd mysql-8.4.8
  mkdir bld

  cmake .. \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysql/ \
-DSYSCONFDIR=/etc/ \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_DEBUG=0 \
-DWITH_SSL=system \
-DWITH_LIBWRAP=0 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1   

编译选项说明:

-DCMAKE_INSTALL_PREFIX# MariaDB 的安装目录
-DMYSQL_DATADIR# MariaDB 数据存储路径
-DSYSCONFDIR# 配置文件目录
-DWITH_INNOBASE_STORAGE_ENGINE# 是否安装 innodb 存储引擎 - 参数:1 or 0
-DWITH_ARCHIVE_STORAGE_ENGINE# 是否安装 archive 存储引擎 - 参数:1 or 0
-DWITH_BLACKHOLE_STORAGE_ENGINE# 是否安装 blackhole 存储引擎 - 参数:1 or 0
-DWITH_DEBUG# 是 MariaDB 编译时的一个 CMake 参数,用于启用或禁用调试模式,1是启用,0是禁用
-DWITH_SSL# 用于指定是否启用 SSL 支持,system是使用系统已安装的 OpenSSL(推荐,依赖系统包)。
-DWITH_LIBWRAP# 用于控制是否启用 libwrap(TCP Wrappers)支持,0是禁用 libwrap,不启用 TCP Wrappers 支持,避免潜在的性能影响
-DENABLED_LOCAL_INFILE# 是否开启 load data infile 命令 - 参数:1 or 0
-DMYSQL_UNIX_ADDR# Unix socket 文件路径
-DDEFAULT_CHARSET# 默认字符集
-DDEFAULT_COLLATION# 校验字符
-DWITH_BOOST# 用于控制是否在构建项目时启用对 Boost 库 的支持。
-DFORCE_INSOURCE_BUILD# 用于 强制在源码目录内进行构建(in-source build),而不是推荐的外源码构建(out-of-source build)。设置该选项后:允许或强制你在源码目录中直接运行  cmake .  和  make ,不需要单独建 build 目录。
-DWITH_SYSTEMD# 是否 systemctl 管理 - 参数:1 or 0


6、编译安装
make -j$(nproc) && make install


7.创建用户
  useradd -s /sbin/nologin mysql

8、建立数据目录
  mkdir -p /data/mysql/
  chown  mysql:mysql /data/mysql


8.创建参数文件
  cat /etc/my.cnf

  [mysqld]
  user=mysql
  basedir=/usr/local/mysql
  datadir=/data/mysql/mysql_3306/data
  socket=/data/mysql/mysql_3306/tmp/mysql_3306.sock
  log-error = /data/mysql/mysql_3306/logs/error.log
  pid-file = mysql_3306.pid

  [client]
  socket=/data/mysql/mysql_3306/tmp/mysql_3306.sock


9.初始化
  /usr/local/mysql/bin/mysqld  --defaults-file=/data/mysql/mysql_3306/my_3306.cnf --initialize --user=mysql

10、启动数据库
/usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysql/mysql_3306/my_3306.cnf --user=mysql &

11、修改密码
  /usr/local/mysql/bin/mysql -S /data/mysql/mysql_3306/tmp/mysql_3306.sock -p
  mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'sztech_4U' PASSWORD EXPIRE NEVER ;
  mysql> create USER 'root'@'127.0.0.1' IDENTIFIED BY 'sztech_4U' PASSWORD EXPIRE NEVER ;
  mysql> grant all privileges on *.* to 'root'@'127.0.0.1' with grant option;

12、登录验证
  mysql -h 127.0.0.1 -uroot -p

  [root@sz-mgr-db01 ~]# mysql -uroot -h127.0.0.1 -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.4.8 Source distribution

Copyright (c) 2000, 2026, 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 8.4在ORACLE LINUX 8.1上的源码安装完毕。

如果前面的提前包安装上,就没有问题,否则,编译就有问题。


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

沙发
 楼主| 发表于 2026-3-14 10:46:54 | 只看该作者

cmake 安装报错之一:

root@mgr1 mysql-8.4.8]# cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysql/ \
-DSYSCONFDIR=/etc/ \
-DWITH_INNOBASE_STORAGE_ENGINE=1\
-DWITH_ARCHIVE_STORAGE_ENGINE=1\
-DWITH_BLACKHOLE_STORAGE_ENGINE=1\
-DWITH_DEBUG=0\
-DWITH_SSL=system \
-DWITH_LIBWRAP=0\
-DENABLED_LOCAL_INFILE=1\
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DFORCE_INSOURCE_BUILD=1\
-DWITH_SYSTEMD=1
-- Running cmake version 3.30.5
-- Could NOT find Git (missing: GIT_EXECUTABLE)
Hint: The project() command has not yet been called.  It sets up system-specific search paths.
-- This is .el10. as found from 'rpm -qf /'
-- CMAKE_MODULE_PATH is /root/mysql-8.4.8/cmake
-- MySQL 8.4.8
-- The C compiler identification is GNU 14.3.1
-- The CXX compiler identification is GNU 14.3.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Source directory /root/mysql-8.4.8
-- Binary directory /root/mysql-8.4.8
CMake Warning at CMakeLists.txt:578 (MESSAGE):
  This is an in-source build


-- CMAKE_GENERATOR: Unix Makefiles
-- Looking for SHM_HUGETLB
-- Looking for SHM_HUGETLB - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void *
-- Check size of void * - done
-- SIZEOF_VOIDP 8
-- Performing Test HAVE_C_FLOATING_POINT_FUSED_MADD
-- Performing Test HAVE_C_FLOATING_POINT_FUSED_MADD - Failed
-- Performing Test HAVE_CXX_FLOATING_POINT_FUSED_MADD
-- Performing Test HAVE_CXX_FLOATING_POINT_FUSED_MADD - Failed
-- Found verified platform LINUX for libbacktrace
-- Packaging as: mysql-8.4.8-Linux-x86_64
-- BOOST_PATCHES_DIR /root/mysql-8.4.8/include/boost_1_84_0/patches
-- BOOST_INCLUDE_DIR /root/mysql-8.4.8/extra/boost/boost_1_84_0
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Looking for floor
-- Looking for floor - not found
-- Looking for floor in m
-- Looking for floor in m - found
-- Looking for gethostbyname_r
-- Looking for gethostbyname_r - found
-- Looking for bind
-- Looking for bind - found
-- Looking for setsockopt
-- Looking for setsockopt - found
-- Looking for dlopen
-- Looking for dlopen - found
-- Looking for dlsym
-- Looking for dlsym - found
-- Looking for sched_yield
-- Looking for sched_yield - found
-- Looking for clock_gettime
-- Looking for clock_gettime - found
-- Looking for timer_create
-- Looking for timer_create - found
-- Looking for backtrace
-- Looking for backtrace - found
-- Performing Test HAVE_LIBWRAP
-- Performing Test HAVE_LIBWRAP - Failed
CMake Error at configure.cmake:173 (MESSAGE):
  WITH_LIBWRAP is defined, but can not find a working libwrap.  Make sure
  both the header files (tcpd.h) and the library (libwrap) are installed.
Call Stack (most recent call first):
  CMakeLists.txt:1595 (INCLUDE)


-- Configuring incomplete, errors occurred!


主要原因,就是 libtirpc-devel 没有安装导致,安装后,问题解决。

回复 支持 反对

使用道具 举报

板凳
 楼主| 发表于 2026-3-14 10:50:31 | 只看该作者
郑全 发表于 2026-3-14 10:46
cmake 安装报错之一:

root@mgr1 mysql-8.4.8]# cmake . \

cmake 报错之二:

-- Performing Test X_PUTLONG_NOT_USE_CONST
-- Performing Test X_PUTLONG_NOT_USE_CONST - Failed
CMake Warning at cmake/rpc.cmake:30 (MESSAGE):
  Cannot find rpcgen executable.  You need to install the required packages:

    Debian/Ubuntu:              apt install rpcsvc-proto
    RedHat/Fedora/Oracle Linux: yum install rpcgen
    SuSE:                       zypper install glibc-devel

Call Stack (most recent call first):
  plugin/group_replication/libmysqlgcs/cmake/rpcgen.cmake:123 (WARN_MISSING_RPCGEN_EXECUTABLE)
  plugin/group_replication/libmysqlgcs/CMakeLists.txt:51 (INCLUDE)


CMake Error at plugin/group_replication/libmysqlgcs/cmake/rpcgen.cmake:124 (MESSAGE):
  Could not find rpcgen
Call Stack (most recent call first):
  plugin/group_replication/libmysqlgcs/CMakeLists.txt:51 (INCLUDE)


-- Configuring incomplete, errors occurred!


原因:就是没有安装 rpcgen ,安装后,问题解决。
回复 支持 反对

使用道具 举报

地板
 楼主| 发表于 2026-3-14 10:52:37 | 只看该作者
郑全 发表于 2026-3-14 10:50
cmake 报错之二:

-- Performing Test X_PUTLONG_NOT_USE_CONST

make 编译报错:

[ 88%] Building CXX object sql/CMakeFiles/sql_gis.dir/gis/crosses.cc.o
包含于文件 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/core/coordinate_promotion.hpp:16,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/core/radian_access.hpp:30,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/geometry.hpp:50,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry.hpp:17,
        于 /root/mysql-8.4.8/sql/gis/area_functor.h:36,
        于 /root/mysql-8.4.8/sql/gis/area.cc:29:
/root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/multiprecision/cpp_bin_float.hpp:40:10: 致命错误:quadmath.h:没有那个文件或目录
   40 | #include <quadmath.h>
      |          ^~~~~~~~~~~~
包含于文件 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/core/coordinate_promotion.hpp:16,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/core/radian_access.hpp:30,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/geometry.hpp:50,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry.hpp:17,
        于 /root/mysql-8.4.8/sql/gis/crosses.cc:30:
/root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/multiprecision/cpp_bin_float.hpp:40:10: 致命错误:quadmath.h:没有那个文件或目录
   40 | #include <quadmath.h>
      |          ^~~~~~~~~~~~
编译中断。
编译中断。
包含于文件 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/core/coordinate_promotion.hpp:16,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/core/radian_access.hpp:30,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/geometry.hpp:50,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry.hpp:17,
        于 /root/mysql-8.4.8/sql/gis/covered_by.cc:28:
/root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/multiprecision/cpp_bin_float.hpp:40:10: 致命错误:quadmath.h:没有那个文件或目录
   40 | #include <quadmath.h>
      |          ^~~~~~~~~~~~
编译中断。
make[2]: *** [sql/CMakeFiles/sql_gis.dir/build.make:76:sql/CMakeFiles/sql_gis.dir/gis/area.cc.o] 错误 1
make[2]: *** 正在等待未完成的任务....
make[2]: *** [sql/CMakeFiles/sql_gis.dir/build.make:118:sql/CMakeFiles/sql_gis.dir/gis/crosses.cc.o] 错误 1
make[2]: *** [sql/CMakeFiles/sql_gis.dir/build.make:104:sql/CMakeFiles/sql_gis.dir/gis/covered_by.cc.o] 错误 1
包含于文件 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/core/coordinate_promotion.hpp:16,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/core/radian_access.hpp:30,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/strategies/spherical/point_in_point.hpp:29,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/algorithms/detail/disjoint/point_point.hpp:36,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/algorithms/detail/overlay/get_turns.hpp:30,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/algorithms/detail/within/implementation.hpp:27,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/algorithms/detail/covered_by/implementation.hpp:26,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/algorithms/covered_by.hpp:24,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp:32,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp:30,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/algorithms/detail/buffer/implementation.hpp:24,
        于 /root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/geometry/algorithms/buffer.hpp:22,
        于 /root/mysql-8.4.8/sql/gis/buffer.cc:28:
/root/mysql-8.4.8/extra/boost/boost_1_84_0/boost/multiprecision/cpp_bin_float.hpp:40:10: 致命错误:quadmath.h:没有那个文件或目录
   40 | #include <quadmath.h>
      |          ^~~~~~~~~~~~
编译中断。
make[2]: *** [sql/CMakeFiles/sql_gis.dir/build.make:90:sql/CMakeFiles/sql_gis.dir/gis/buffer.cc.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:49712:sql/CMakeFiles/sql_gis.dir/all] 错误 2
make: *** [Makefile:166:all] 错误 2
[root@mgr1 bld]#


原因:
     就是 libquadmath-devel 没有安装导致,安装后,重新 make 即可。

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2026-4-17 22:23 , Processed in 0.234537 second(s), 19 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表