[mysqld]
# set basedir to your installation path
#basedir=G:/mysql-5.1.61/mysql-5.1.61
basedir=G:/mysql-5.5.21/mysql-5.5.21
# set datadir to the location of your data directory
#datadir=G:/mysql-5.1.61/mysql-5.1.61/win/data
datadir=G:/mysql-5.5.21/mysql-5.5.21/win/data
在win下建立data目录,再把sql下的share内目录copy到mysql-5.5.21目录下
执行mysqld。打开data目录,发现有个错误日志。第一行是
mysqld: Table 'mysql.plugin' doesn't exist
120224 17:33:23 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
只生成了服务和客户端,没生成整个方案。生成方案又失败报错。
一些网贴
http://www.iyunv.com/nocode/archive/2011/04/10/2011844.html
http://www.iyunv.com/yuemenglong/archive/2011/06/14/2080262.html
http://blog.iyunv.com/yuyunliuhen/article/details/6143347
http://www.51testing.com/?uid-66291-action-viewspace-itemid-805844
http://bygreencn.wordpress.com/2011/08/19/vs2010%E7%BC%96%E8%AF%91mysql-5-5-15%E5%B9%B6%E7%94%9F%E6%88%90%E5%AE%89%E8%A3%85%E5%8C%85/
1.准备:
a. 下载mysql-5.5.15.zip http://dev.mysql.com/downloads/mysql/
b. 下载较新版本的CMake并安装,我使用的是CMake 2.85
c. 下载bison并安装,注意安装目录不能有空格.http://gnuwin32.sourceforge.net/packages/bison.htm
2. 解压mysql-5.5.15.zip,修改sql\sql_locale.cc,因该文件中有很多vs2010不能识别的多国语言的字符编码,实验发现及时改变成任何utf8类型的编码格式仍不行,后发现vs2010有对UTF8兼容的bug,故只好修改该文件,让它暂时只支持en_US一种语言。
3.将bison安装目录中bin\m4.exe拷贝到mysql-5.5.15\sql目录,使其与sql_yacc.cc在同一个目录下,此问题为bison调用m4.exe时无法找到其路径,应该是cmakelist.txt的问题。期间可能还会发生m4.exe找不到GNUWin32包的动态库的问题,去GNUWin32找相应的库下载并拷贝到mysql-5.5.15\sql下。
4.cmake gui 下配置生成工程文件MySQL.sln.
5.控制台下进到MySQL.sln所在目录执行:
"c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" MySQL.sln /build RelWithDebInfo
"c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" MySQL.sln /build RelWithDebInfo /project initial_database
"c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" MySQL.sln /build RelWithDebInfo /project PACKAGE
"c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" MySQL.sln /clean
至此如果没有异议会在MySQL.sln所在目录会找到_CPack_Packages\win32\ZIP,会有一个mysql-5.5.15-win32.zip和完整的安装包mysql-5.5.15-win32,这就是最终生成的可以使用的安装包了。
********************************************************************
updated for mysql-5.5.16:
同样是m4.exe生成sql_yacc.cc的问题,在此版本中,需要copy m4.exe及其依赖的动态库与MySQL.sln保持在同一个目录下。–2011-09-22
In the “Solution Explorer” view (far right-hand side of page), right-click on “PACKAGE” -> then “Build”.
If you have problems with this, it can be pieced together easily enough:
Make main dir mysql-5.5.xx
Make subdir bin/ - copy in all .exe files (from client/debug, sql/debug, */debug, etc.)*
Make subdir data/ - copy from sql/data/
Make subdir scripts/ – copy from scripts/ (at least all perl, sql, and sh scripts)
Make subdir share/ - copy from sql/share/
Create my.ini
* Notes re: .exe files: mysqld.exe is located in /sql/debug/ and mysql.exe is located in /client/debug/. The remaining .exe files are located in /client/debug/, /sql/debug/, /extra/debug/, /libmysql/debug/, /mysys/debug/, /scripts/debug/, /storage/myisam/debug/, /storage/heap/debug/, and /tests/debug/.