Setting Up MySQL Debugging Environment
2016-05-10 10:19
627 查看
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Setting Up MySQL Debugging Environment
Setting Up MySQL Debugging Environment
Table of Contents
1. Get the source files from mysql.2. Compile & Install with cmake/make.
3. Start mysqld, the server.
4. Start another termial window, and start a client.
5. Enjoy it!
It is strongly recommened to refer to the mysql documentation for debugging and
compiling mysql sources. After configuring the debugging environment, I write
this post to make further environment setting easier with just few scirpts
running for others who are trying to understanding the internals of MySQL.
In the following setting, I assume you are working on a linux machine, and you
are carrying on with the process of "modifying-recompiling-testing" the
functions of mysql. So I suggest installing the mysql binaries into a tempory
directory, /dev/shm, which is backed by DRAM, you will get good performance.
1 Get the source files from mysql.
I will leave out the details of this step, follow the guidelines from themysql website.
2 Compile & Install with cmake/make.
The latest mysql uses cmake to configure the features of mysql and usesmake to compile and install. Using the following scirpts to automate the
configuring and installation.
In the topmost directory of mysql source tree, issue the following commands:
mkdir bld |
cd bld |
#this makes the bld directory hold the output files |
cmake .. -DCMAKE_BUILD_TYPE=Debug |
make -j16 |
rm -rf /dev/shm/usr |
#install to the shm directory |
make install DESTDIR="/dev/shm" |
#Install the system tables |
/dev/shm/usr/local/mysql/scripts/mysql_install_db –basedir=/dev/shm/usr/local/mysql –datadir=/dev/shm/usr/local/mysql/data |
and execute that script each time you modify the source files.
3 Start mysqld, the server.
We use gdb to start the mysqld process so that we can debug the code.gdb –args /run/shm/usr/local/mysql/bin/mysqld –basedir=/run/shm/usr/local/mysql –datadir=/run/shm/usr/local/mysql/data –skip-networking |
Add a breakpoint:
Issue run command in gdb window, to start the server process.
The message in red box shows the client can connect to the server with the socket.
4 Start another termial window, and start a client.
/dev/shm/usr/local/mysql/bin/mysql -S /tmp/mysql.sock |
5 Enjoy it!
Author: wujingCreated: 2016-05-10 Tue 10:19
Emacs 24.5.1 (Org mode 8.2.10)
相关文章推荐
- 8.2 使用 MySQL 数据库
- 8.1 MySQL 应用基础
- mysql--多实例启动方法
- mysql一个事务中有DDL语句的binlog情况
- mysql主从复制(超简单)
- MYSQL workbench 创建存储过程
- MySQL服务无法启动(1067)问题
- 如何配置远程MySQL连接?
- windows 安装 mysql 5.7.12
- 如何创建MySQL数据库
- mysql存储方式MyISAM 和 InnoDB的区别
- mysql存储方式MyISAM 和 InnoDB的区别
- MySQL 数据备份与还原
- MySql数据库之引擎
- 高性能MySql进化论:常见索引类型的原理及其特点的介绍
- MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 的原因分解决办法
- mysqlshow命令的用法介绍
- MySQL联合索引是不支持不同排序规则解决方案
- mysql Using temporary Using filesort 优化
- MySQL二进制文件规范安装