问小白 wenxiaobai
资讯
历史
科技
环境与自然
成长
游戏
财经
文学与艺术
美食
健康
家居
文化
情感
汽车
三农
军事
旅行
运动
教育
生活
星座命理

MySQL编译安装常见问题及解决方法

创作时间:
作者:
@小白创作中心

MySQL编译安装常见问题及解决方法

引用
CSDN
1.
https://blog.csdn.net/qq_24428851/article/details/141366017

MySQL编译安装常见问题及解决方法

MySQL编译安装时需要安装的依赖(全):

yum install -y cmake
yum install ncurses ncurses-devel -y
yum install -y libarchive
yum install -y gcc gcc-c++
yum install -y openssl openssl-devel
yum install -y libtirpc libtirpc-devel

问题1

错误提示:

-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:71 (MESSAGE):
Curses library not found. Please install appropriate package,
remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:100 (FIND_CURSES)
cmake/readline.cmake:193 (MYSQL_USE_BUNDLED_EDITLINE)
CMakeLists.txt:581 (MYSQL_CHECK_EDITLINE)

原因:缺少依赖

解决方法:

yum install ncurses ncurses-devel -y

问题2

错误提示:

CMake Error at cmake/boost.cmake:88 (MESSAGE):
You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory>
This CMake script will look for boost in <directory>. If it is not there,
it will download and unpack it (in that directory) for you.
If you are inside a firewall, you may need to use an http proxy:
export http_proxy=http://example.com:80
Call Stack (most recent call first):
cmake/boost.cmake:174 (COULD_NOT_FIND_BOOST)
CMakeLists.txt:547 (INCLUDE)

原因:没有指定boost位置,或boost位置错误

解决方法:
使用cd指令或ls等指令验证boost路径是否正确,修改即可。如果没有boost就需要下载,然后指定就可以了。

问题3

错误提示:

-bash: cmake: command not found

原因:没有安装cmake

解决方法:

yum install -y cmake

问题4

错误提示:

cmake: symbol lookup error: cmake: undefined symbol: archive_write_add_filter_zstd

原因:缺少依赖

解决方法:

yum install -y libarchive

问题5

错误提示:

CMake Error at CMakeLists.txt:146 (PROJECT):
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.

原因:缺少gcc-c++

解决方法:

yum install -y gcc gcc-c++

问题6

错误提示:

Cannot find appropriate system libraries for WITH_SSL=system.
Make sure you have specified a supported SSL version.
Valid options are :
system (use the OS openssl library),
yes (synonym for system),
</path/to/custom/openssl/installation>
CMake Error at cmake/ssl.cmake:63 (MESSAGE):
Please install the appropriate openssl developer package.
Call Stack (most recent call first):
cmake/ssl.cmake:280 (FATAL_SSL_NOT_FOUND_ERROR)
CMakeLists.txt:579 (MYSQL_CHECK_SSL)

原因:缺少依赖

解决方法:

yum install -y openssl openssl-devel

问题7

错误提示:

-- Found PkgConfig: /usr/bin/pkg-config (found version "1.4.2")
-- Checking for module 'libtirpc'
-- Package 'libtirpc', required by 'virtual:world', not found
CMake Error at cmake/rpc.cmake:76 (MESSAGE):
Could not find rpc/rpc.h in /usr/include or /usr/include/tirpc
Call Stack (most recent call first):
rapid/plugin/group_replication/configure.cmake:60 (MYSQL_CHECK_RPC)
rapid/plugin/group_replication/CMakeLists.txt:25 (INCLUDE)

原因:缺少依赖

解决方法:

yum install -y libtirpc libtirpc-devel

问题8

错误提示:

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

原因:缺少依赖

解决方法:
安装rpcsvc-proto

安装rpcsvc-proto方法如下:
下载rpcsvs-proto
https://github.com/thkukuk/rpcsvc-proto/releases/download/v1.4.2/rpcsvc-proto-1.4.2.tar.xz
解压

tar -xvf rpcsvc-proto-1.4.2.tar.xz

配置编译安装

./configure
make && make install

注意:如果下载的是tar.gz包,这个包需要手动生成configure文件后才能编译安装rpcvsc-proto,需要安装很多依赖项,很繁琐,后面单独介绍
https://github.com/thkukuk/rpcsvc-proto/archive/refs/tags/v1.4.2.tar.gz

MySQL编译安装常用选项

cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ #指定MySQL安装目录
-DSYSCONFDIR=/usr/local/mysql/etc \ #指定MySQL配置文件my.cnf文件目录
-DMYSQL_USER=mysql \ #指定MySQL运行用户
-DDEFAULT_CHARSET=utf8 \ #指定默认字符集
-DDEFAULT_COLLATION=utf8_general_ci \ #指定默认排序字符集
-DMYSQL_DATADIR=/mysql/data \ #指定数据文件存放路径
-DWITH_BOOST=/usr/local/src/mysql-5.7.30/boost/boost_1_59_0 \ #指定boost 文件存放路径
-DENABLED_LOCAL_INFILE=1 \ #启用本地加载数据
-DMYSQL_UNIX_ADDR=/usr/local/mysql/tmp/mysql.sock \ #指定mysql.sock文件路径
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DMYSQL_TCP_PORT=3306 \

最后编辑于:2024-07-27 15:21:30

© 2023 北京元石科技有限公司 ◎ 京公网安备 11010802042949号