How to compile or debug MySql in Windows)

Source: Internet
Author: User
Tags mysql code

Original link http://www.mysqlsupport.cn/category/code/

 

Author: Wu Bingxi Source:Http://www.mysqlsupport.cn/ Contact info:Select unhex ('777562696e67786940676d61696c2e636f6d ');Specify/The translator and the source, and cannot be used for commercial purposes.

In WindowsCompile MySQL?

Compiling MySql in Linux is very convenient and easy to handle. With the increase in MySQL usage time, I am gradually interested in MySQL code analysis. So I want to find a tool to learn MySQL Code. For Linux users, I can use VIM + ctags for analysis,

However, most users work on Windows platforms. Therefore, you need to debug MySQL on Windows.

The downloaded MySQL files cannot be directly compiled on the Windows platform, but the project file is gone. The problem of off-configuration is how to create a project file. The following describes how to create a project file, how to debug it, and how to compile it.

 

Preparations:

Install a compiler. We recommend Microsoft Visual Studio 2008.

In addition, you need to install:

GNU bison for Windows: http://gnuwin32.sourceforge.net/packages/bison.htm

Cmake 2.6.0 or later: http://www.cmake.org

Start Compilation:

Here the source code compilation of mysql-5.1.38 as an example:

Mysql-5.1.38 code download can be downloaded to the MySQL official website, the specific how to download is not described.

 

Open a cmd window:

 Input:

Cscript // H: cscript

Then:

CD/path/mysql-5.1.38

Win/configure with_innobase_storage_engine _ nt __

Win/build-vs9.bat

 

At this point, we will create a MySQL. SLN project file. If you want to learn the code, you can click here. Then you can open this file with Microsoft Visual Studio 2008 to view the corresponding code.

 

 If you need to debug or perform debugging in one step:

Here, the mysqld project is used as an example:

Open the properties of the Project mysqld and click debugging.

On the properties page of mysqld, set the command parameter (command arguments) to-console. In this way, you can debug the code in debug mode.

 

The same is true for debugging of other projects. For properties, add the command line parameter-console.

 

You can execute build for the project you want to track, and then generate the corresponding execution file under the mysql-5.1.38/client/debug.

 

If you really want to compile a Windows MySQL, you can skip the above steps. Then, after completing the bat above, proceed directly:

Vcbuild mysql. sln "release"

. After that, upload mysqld.exe and the corresponding file to the corresponding directory. The installation method is not described here. The core purpose of this document is to teach you how to create project files and debug them.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.