如何编译mysql内核

在最新的版本中,windows环境与linux环境下使用一套代码。比如mysql-6.0.4-alpha版本中的INSTALL-WIN-SOURCE文件的描述:

   To  build MySQL on Windows from source, you must satisfy the

   following system, compiler, and resource requirements:

     * Windows 2000, Windows XP, or newer version. Windows Vista is

       not supported until Microsoft certifies Visual Studio 2005 on

       Vista.

     * CMake, which can be downloaded from http://www.cmake.org.

       After  installing, modify your path to include the cmake

       binary.

     * Microsoft Visual C++ 2005 Express Edition, Visual Studio .Net

       2003 (7.1), or Visual Studio 2005 (8.0) compiler system.

     * If you are using Visual C++ 2005 Express Edition, you must

       also install an appropriate Platform SDK. More information and

       links to downloads for various Windows platforms is available

       from http://msdn.microsoft.com/platformsdk/.

     * If you are compiling from a BitKeeper tree or making changes

       to  the parser, you need bison for Windows, which can be

       downloaded from

       http://gnuwin32.sourceforge.net/packages/bison.htm.Download

       the package labeled "Complete package, excluding sources".

       After installing the package, modify your path to include the

       bison binary and ensure that this binary is accessible from

       Visual Studio.

     * Cygwin might be necessary if you want to run the test script

       or package the compiled binaries and support files into a Zip

       archive.  (Cygwin  is needed only to test or package the

       distribution, not to build it.) Cygwin is available from

       http://cygwin.com.

     * 3GB to 5GB of disk space.

  通过这样的方法,生成项目文件,从而可以通过vs工具进行编译。在先前的版本中,windows下的代码和linux下的代码是两个压缩包,比如windows下的一个软件包名为,mysql-5.1.7-beta-win-src.zip。

  这里我选择5.1.7作为分析的对象。

 

安装代码的步骤:

1.解压缩文件包mysql-5.1.7-beta-win-src.zip。

2.使用vs2003打开项目文件mysql.sln。

3.设置mysqld项目为启动项目。

4.在mysqld的属性页设置命令参数为:--console。这样就可以用debug方式调试代码了。

 

图1:配置命令参数

5.设置断点,比如查询的总入口是handle_select函数。

6.编译mysql项目,将会在mysql-5.1.7-beta/client_debug目录下生成mysql.exe。

7.使用“启动新实例”或者“进入单步执行新实例”进行调试。

 

 

图2:执行调试操作

8. mysql-5.1.7-beta/client_debug目录下生成mysql.exe,执行语句,将会执行到断点进行调试。

 

图3:进入调试状态

9.相应的数据文件,见mysql-5.1.7-beta/data目录。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值