Compile the MySQL source code under Win7

Source: Internet
Author: User
Tags win32 zip


Mysql

MySQL is an excellent open source database, in Ali, NetEase and other Internet companies have a wide range of applications. Although NoSQL is a great way to go, a relational database is still essential.

As a novice, it is not easy to install MYSQL database under Win7 with source code . I've been tossing myself for days. Today, the installation process is recorded, one is to facilitate their later study, and the other is to share the process, so that learners can benefit from my article.

1.Compile the environment and download the source code

Compiling the Environment :Visual Studio (Win7 )

Compiling Tools :

Bison-2.4.1-setup.exe

: Http://nchc.dl.sourceforge.net/project/gnuwin32/bison/2.4.1/bison-2.4.1-setup.exe

Installation location:D:\GnuWin32

Cmake-3.0.0-win32-x86.exe

: Http://www.cmake.org/files/v3.0/cmake-3.0.0-win32-x86.exe

Installation location:D:\CMake

MySQL Source : Mysql-5.5.31.zip

: Http://downloads.skysql.com/archives/mysql-5.5/mysql-5.5.31.zip

Note: The installation paths of CMake and Bison do not have spaces, and cmake and Bison are added to the environment variable path ,cmake has a selection at the time of installation, andbison needs to be add manually.

2.compiling MySQL source code

the MySQL source code extracted to the D:\mysql-source directory, and finally formed the directory structure as follows:650) this.width=650; " Width= "482" height= "344" src= "http://s3.51cto.com/wyfs02/M01/30/74/wKiom1On3dujNgpVAAFpDttc1XQ743.jpg" title= " 2014-06-22_ compile the MySQL source under Win7 and install -922.png "alt=" wkiom1on3dujngpvaafpdttc1xq743.jpg "/>"

The first step : Open a command-line window in the directory and enter the following command:

650) this.width=650; "Width=" 523 "height=" "src=" http://s3.51cto.com/wyfs02/M00/30/74/ Wkiom1on3fcyki6baabg87oiwog074.jpg "title=" 2014-06-22_ compile the MySQL source under Win7 and install -953.png "alt=" Wkiom1on3fcyki6baabg87oiwog074.jpg "/>

This is the solution to build vs . CMake with the "." Represents the current directory.

Step Two : Save D:\mysql-source\mysql-5.5.31\sql\sql_locale.cc as UTF8 format with Notepad.

Step Three: Import the source project into VS . Files,openprojects / solutions, select d:\ Mysql-source\mysql-5.5.31\mysql.sln file, OK. The following are imported:

650) this.width=650; "Width=" 401 "height=" 315 "src=" http://s3.51cto.com/wyfs02/M01/30/74/ Wkiom1on3hczcshvaae8bghrfhg761.jpg "title=" 2014-06-22_ compile the MySQL source under Win7 and install -1162.png "alt=" Wkiom1on3hczcshvaae8bghrfhg761.jpg "/>

Fourth Step : Compiling mysqld. To the mysqld project, then "right mousebutton", "build", if the error, and then compile once, if the error again, please check your cmake and Bison installation and environment variable settings.

650) this.width=650; "width=" 525 "height=" 258 "src=" http://s3.51cto.com/wyfs02/M00/30/73/wKioL1On3fuj-bWAAAD_ 36b3mgc907.jpg "title=" 2014-06-22_ compile the MySQL source under Win7 and install -1206.png "alt=" Wkiol1on3fuj-bwaaad_36b3mgc907.jpg "/>

Finally, the Mysqld.exe is generated in the D:\mysql-source\mysql-5.5.31\sql\Debug directory , which indicates that the compilation was successful.

after compiling, you can try running, go to the D:\mysql-source\mysql-5.5.31\sql\Debug directory, open the command line tool, and enter the following command: Mysqld.exe--debug--standalone

650) this.width=650; "Width=" 554 "height=" 191 "src=" http://s3.51cto.com/wyfs02/M01/30/73/wKioL1On3hmgXeHrAAE_ 8zie90s140.jpg "title=" 2014-06-22_ compile the MySQL source under Win7 and install -1379.png "alt=" Wkiol1on3hmgxehraae_8zie90s140.jpg "/>

see an assertion error, and mark the source file and line number: mysqld.cc Line 4233, then we locate the source code:

650) this.width=650; "Width=" 553 "height=" 202 "src=" http://s3.51cto.com/wyfs02/M00/30/74/ Wkiom1on3l7cr-h1aadqk4y0jmo176.jpg "title=" 2014-06-22_ compile the MySQL source under Win7 and install -1435.png "alt=" Wkiom1on3l7cr-h1aadqk4y0jmo176.jpg "/>

and comment out the line code. and recompile the mysqld project. Run the command again, no error.

Fifth Step : Validation Program

to prove that the compiled Mysqld.exe works properly, download the mysql free install version mysql-5.5.31-win32 Zip,are:Http://cdn.mysql.com/archives/mysql-5.5/mysql-5.5.31-win32.zipafter extracting to the D:\MySql\official-mysql directory, compile it with your ownMysqld.exeReplace D:\MySql\official-mysql\Bin\mysqld.exe. Then run at the command lineMysqld.exeto start the service-side program.

650) this.width=650; "Width=" 554 "height=" 155 "src=" http://s3.51cto.com/wyfs02/M01/30/74/ Wkiom1on3muyd0h4aac0uy-vkpm475.jpg "title=" 2014-06-22_ compile the MySQL source under Win7 and install -1776.png "alt=" Wkiom1on3muyd0h4aac0uy-vkpm475.jpg "/>

then open a command-line window and enter Mysql-uroot-p, because there is no password, enter the password at the direct return, connect to the database.

650) this.width=650; "Width=" 554 "height=" 389 "src=" http://s3.51cto.com/wyfs02/M00/30/73/ Wkiol1on3kuqncihaaf54z-ep1o621.jpg "title=" 2014-06-22_ compile the MySQL source under Win7 and install -1837.png "alt=" Wkiol1on3kuqncihaaf54z-ep1o621.jpg "/>

Finally, don't forget to enter in the command line window: mysqladmin.exe-uroot shutdown command to shut down the MySQL service.

650) this.width=650; "Width=" 554 "height=" 121 "src=" http://s3.51cto.com/wyfs02/M01/30/73/wKioL1On3lbzGtJ_ Aabl-2tqlke996.jpg "title=" 2014-06-22_ compile the MySQL source under Win7 and install -1899.png "alt=" Wkiol1on3lbzgtj_aabl-2tqlke996.jpg "/>

This article is from a "little progress every Day" blog, make sure to keep this source http://sbp810050504.blog.51cto.com/2799422/1429838

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.