Mac下使用Clion调试MySQL版本5.7源码

Posted JavaEdge.

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mac下使用Clion调试MySQL版本5.7源码相关的知识,希望对你有一定的参考价值。

环境

macOS Catalina
clion2020.1
cmake
boost

首先从 GitHub 获取 mysql 源码,直接通过 git pull 拉取代码。切换到 5.7 分支。

操作

生成目录

// 生成编译后安装目录及数据目录
mkdir -p build_out/data

编译

cmake . -DWITH_DEBUG=1 \\
-DCMAKE_INSTALL_PREFIX=build_out \\
-DMYSQL_DATADIR=build_out/data


make && make install

初始化 mysql 数据库

cd build_out
➜  build_out git:(5.7) ✗ bin/mysql_install_db
2021-06-17 17:31:11 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2021-06-17 17:31:11 [ERROR]   The data directory needs to be specified.


➜  build_out git:(5.7) ✗ mysqld --initialize
2021-06-17T09:31:12.953002Z 0 [System] [MY-013169] [Server] /usr/local/Cellar/mysql/8.0.21_1/bin/mysqld (mysqld 8.0.21) initializing of server in progress as process 61881
2021-06-17T09:31:12.956680Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2021-06-17T09:31:12.956688Z 0 [ERROR] [MY-013236] [Server] The designated data directory /usr/local/var/mysql/ is unusable. You can remove all files that the server added to it.
2021-06-17T09:31:12.956739Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-06-17T09:31:12.956911Z 0 [System] [MY-010910] [Server] /usr/local/Cellar/mysql/8.0.21_1/bin/mysqld: Shutdown complete (mysqld 8.0.21)  Homebrew.

debug启动参数,并调试

客户端发起连接:

以上是关于Mac下使用Clion调试MySQL版本5.7源码的主要内容,如果未能解决你的问题,请参考以下文章

Mac环境下使用CLion调试redis 6.X源码

Mac10.14下使用Xcode10编译调试OpenJDK8最新教程(附源码)

Mac 10.14.4 编译openjdk1.9源码 及集成clion动态调试

mac OS下 安装MySQL 5.7

mac下安装MySQL 5.7

MAC 下 Mysql 5.7 的配置文件在哪