编译环境Ubuntu22.04LTS
1 官方下载MySQL源码
https://dev.mysql.com/downloads/mysql/?spm=a2c6h.12873639.article-detail.4.68e61a14ghILh5
2 安装基础软件
- cmake
- clang
- pkg-config
- perl
参考:https://dev.mysql.com/doc/refman/5.7/en/source-installation-prerequisites.html
3 根据要求,安装openssl
bash
wget https://www.openssl.org/source/openssl-1.1.1v.tar.gz
通过文件读取安装
bash
cat INSTALL | more
4 编译MySQL的debug版本
参考:https://dev.mysql.com/doc/refman/5.7/en/installing-source-distribution.html
编译MySQL的debug版本
bash
$ mkdir bld
$ cd bld
$ cmake .. -DWITH_BOOST=../boost/ -DWITH_DEBUG=1
$ make
$ make install
5 验证debug版本
bash
# ./mysqld --verbose --help
...
connect-timeout 10
console FALSE
daemonize FALSE
datadir /usr/local/mysql/data/
date-format %Y-%m-%d
datetime-format %Y-%m-%d %H:%i:%s
debug (No default value)
debug-sync-timeout 0
default-authentication-plugin mysql_native_password
default-password-lifetime 0
default-storage-engine InnoDB
default-time-zone (No default value)
default-tmp-storage-engine InnoDB
default-week-format 0
...
执行命令,有debug字段标志;
bash
debug (No default value)