源码安装mysql5.7

 本文使用debian系统,源码安装mysql5.7.38为例。

1. 安装依赖库

apt-get install libncurses5 libncurses5-dev

2. 下载安装包

wget -c https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.38.tar.gz
# mysql从5.7版本开始依赖于boost库,如果系统没有安装boost库或者其他情况可以下载包含boost库的mysql源码
# wget -c https://downloads.mysql.com/archives/get/p/23/file/mysql-boost-5.7.38.tar.gz

3. 解压及安装

tar zxvf mysql-5.7.38.tar.gz
cd mysql-5.7.38
mkdir build
cd build

cmake .. -DCMAKE_INSTALL_PREFIX=/home/zhongyouyule/mysql-5.7.38 \
-DMYSQL_DATADIR=/home/zhongyouyule/data \
-DMYSQL_UNIX_ADDR=/home/scictor/zhongyouyule/tmp/mysql.sock \
-DWITH_BOOST=/home/zhongyouyule/boost_1_69_0 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITH_ZLIB=bundled \
-DWITH_SSL=system \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLE_DOWNLOADS=1 \
-DWITH_DEBUG=1

make -j64
make install

 

4. 遇到问题及解决方法

1)cc: error: unrecognized command line option ‘-Wimplicit-fallthrough=2’

解决方法:更新gcc版本,可以参考5-3部分。

2)mysql-5.7.38/mysys_ssl/my_aes_openssl.cc:163: undefined reference to `EVP_EncryptFinal'

collect2: error: ld returned 1 exit status

解决方法:修改ssl.cmake配置文件,主要是libssl.so与libcrypto.so链接问题。

3) item_geofunc_internal.cc:44 Error: expected unqualified-id before '&' token

解决方法:self_ip_exception -> no_interrupt_policy

5. 参考资料

1)ubuntu安装mysql server & mysql client

2)Centos6安装mysql5.5

3)ubuntu系统使用update-alternatives 管理多版本gcc/g++

如有其他问题,可以留言,共同交流。

posted @ 2022-11-22 20:08  PKICA  阅读(551)  评论(2编辑  收藏  举报