mysql-5.5.25a源码编译

 

环境准备

1.下载mysql源代码:http://dev.mysql.com/downloads/mysql/#downloads 这里最新的版本是mysql-5.5.25a

如下:


2.安装CMake

下载地址:http://www.cmake.org/cmake/resources/software.html 编译器记得Linux下的 make么, 没错这个就是他哥,进阶版。 

3.安装GNUWin32 Bison 

下载地址为:http://gnuwin32.sourceforge.net/packages/bison.htm 同样安装路径最好为英文,并且不要有空格。安装后将bin路径添加到系统环境变量。


编译

进入mysql的根目录下,输入cmake . -G "Visual Studio 9 2008",正常的话会有XXX done什么的 

成功的话会有MySQL.sln和一大堆.vcproj文件,打开MySQL.sln,就可以看到整个解决方案

在编译之前,建议打开sql/sql_locale.cc文件,将其用utf-8格式再保存一遍,不然编译过程当中会有大量错误。 

应该就可以编译成功。

到sql/debug 下执行

mysqld-debug --debug –-standalone 


应该会出现错误,提示你mysqld.cc中的某个断言有问题,把那段注解掉重新编译。

编译完以后继续

mysqld-debug --debug –-standalone


发现还是起不来mysqld的进程。

查看log文件

mysqld.exe: Table 'mysql.plugin' doesn't exist

120414 11:34:08 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

120414 11:34:08 InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!

120414 11:34:08 InnoDB: The InnoDB memory heap is disabled

120414 11:34:08 InnoDB: Mutexes and rw_locks use Windows interlocked functions

120414 11:34:08 InnoDB: Compressed tables use zlib 1.2.3

120414 11:34:08 InnoDB: Initializing buffer pool, size = 128.0M

120414 11:34:08 InnoDB: Completed initialization of buffer pool

120414 11:34:08 InnoDB: highest supported file format is Barracuda.

InnoDB: The log sequence number in ibdata files does not match

InnoDB: the log sequence number in the ib_logfiles!

120414 11:34:08  InnoDB: Database was not shut down normally!

InnoDB: Starting crash recovery.

InnoDB: Reading tablespace information from the .ibd files...

InnoDB: Restoring possible half-written data pages from the doublewrite

InnoDB: buffer...

120414 11:34:09  InnoDB: Waiting for the background threads to start

120414 11:34:10 InnoDB: 1.1.8 started; log sequence number 1595675

120414 11:34:10 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

意思是mysl下的表没有建立,很奇怪这个不知道是什么原因,我是到别的地方拷贝了mysql下的文件放到sql/data/mysql




如果没有什么意外

执行

mysqld-debug --debug –-standalone

就可以建立启动mysqld进程了。

使用vs2008进行调试

测试---》附加到进程




选择mysqld

定位到 \client\Debug,执行命令“mysql -u root -p”,进入mysql客户端, 

在这边下断点:


在mysql 客户端下:

 show authors;


就可以进入断点进行调试:


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章