随笔 - 224  文章 - 41  trackbacks - 0
<2012年4月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

享受编程

常用链接

留言簿(11)

随笔分类(159)

随笔档案(224)

文章分类(2)

文章档案(4)

经典c++博客

搜索

  •  

最新评论

阅读排行榜

评论排行榜

mysqlwindows下的编译和调试(vs2008)

环境准备

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

如下:


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;


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


参考地址:
http://qa.taobao.com/?p=9699
http://likydba.sinaapp.com/?p=578
http://www.cnblogs.com/yuemenglong/archive/2011/06/14/2080262.html

 

posted on 2012-04-15 10:37 漂漂 阅读(2879) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理