| 1 |
|
| 2 |
2.4.15.6. Installing MySQL from Source on Windows |
| 3 |
|
| 4 |
This section does not apply to MySQL Enterprise Server users. |
| 5 |
|
| 6 |
These instructions describe how to build binaries from source for |
| 7 |
MySQL 5.0 on Windows. Instructions are provided for building |
| 8 |
binaries from a standard source distribution or from the Bazaar |
| 9 |
tree that contains the latest development source. |
| 10 |
|
| 11 |
Note |
| 12 |
|
| 13 |
The instructions here are strictly for users who want to test |
| 14 |
MySQL on Microsoft Windows from the latest source distribution or |
| 15 |
from the Bazaar tree. For production use, MySQL AB does not advise |
| 16 |
using a MySQL server built by yourself from source. Normally, it |
| 17 |
is best to use precompiled binary distributions of MySQL that are |
| 18 |
built specifically for optimal performance on Windows by MySQL AB. |
| 19 |
Instructions for installing binary distributions are available in |
| 20 |
Section 2.4.8, "Installing MySQL on Windows." |
| 21 |
|
| 22 |
To build MySQL on Windows from source, you must satisfy the |
| 23 |
following system, compiler, and resource requirements: |
| 24 |
* Windows 2000, Windows XP, or newer version. |
| 25 |
Windows Vista is supported when using Visual Studio 2005 |
| 26 |
provided you have installed the following updates: |
| 27 |
+ Microsoft Visual Studio 2005 Professional Edition - ENU |
| 28 |
Service Pack 1 (KB926601) |
| 29 |
(http://support.microsoft.com/?kbid=926601) |
| 30 |
+ Security Update for Microsoft Visual Studio 2005 |
| 31 |
Professional Edition - ENU (KB937061) |
| 32 |
(http://support.microsoft.com/?kbid=937061) |
| 33 |
+ Update for Microsoft Visual Studio 2005 Professional |
| 34 |
Edition - ENU (KB932232) |
| 35 |
(http://support.microsoft.com/?kbid=932232) |
| 36 |
* To build from the standard source distribution, you will need |
| 37 |
CMake, which can be downloaded from http://www.cmake.org. |
| 38 |
After installing, modify your path to include the cmake |
| 39 |
binary. |
| 40 |
* Microsoft Visual C++ 2005 Express Edition, Visual Studio .Net |
| 41 |
2003 (7.1), or Visual Studio 2005 (8.0) compiler system. |
| 42 |
* If you are using Visual C++ 2005 Express Edition, you must |
| 43 |
also install an appropriate Platform SDK. More information and |
| 44 |
links to downloads for various Windows platforms is available |
| 45 |
from |
| 46 |
http://www.microsoft.com/downloads/details.aspx?familyid=0baf2 |
| 47 |
b35-c656-4969-ace8-e4c0c0716adb/. |
| 48 |
* If you are compiling from a Bazaar tree or making changes to |
| 49 |
the parser, you need bison for Windows, which can be |
| 50 |
downloaded from |
| 51 |
http://gnuwin32.sourceforge.net/packages/bison.htm.Download |
| 52 |
the package labeled "Complete package, excluding sources". |
| 53 |
After installing the package, modify your path to include the |
| 54 |
bison binary and ensure that this binary is accessible from |
| 55 |
Visual Studio. |
| 56 |
* Cygwin might be necessary if you want to run the test script |
| 57 |
or package the compiled binaries and support files into a Zip |
| 58 |
archive. (Cygwin is needed only to test or package the |
| 59 |
distribution, not to build it.) Cygwin is available from |
| 60 |
http://cygwin.com. |
| 61 |
* 3GB to 5GB of disk space. |
| 62 |
|
| 63 |
The exact system requirements can be found here: |
| 64 |
http://msdn.microsoft.com/vstudio/Previous/2003/sysreqs/default.as |
| 65 |
px and |
| 66 |
http://msdn.microsoft.com/vstudio/products/sysreqs/default.aspx |
| 67 |
|
| 68 |
There are three solutions available for building from the source |
| 69 |
code on Windows: |
| 70 |
* Build from the standard MySQL source distribution. For this |
| 71 |
you will need CMake and Visual C++ Express Edition or Visual |
| 72 |
Studio. Using this method you can select the storage engines |
| 73 |
that are included in your build. To use this method, see |
| 74 |
Section 2.4.15.6.1, "Building MySQL from the Standard Source |
| 75 |
Distribution." |
| 76 |
* Build from the MySQL Windows source distribution. The Windows |
| 77 |
source distribution includes ready-made Visual Studio solution |
| 78 |
files that enable support for all storage engines (except |
| 79 |
NDB). To build using using method you only need Visual C++ |
| 80 |
Express Edition or Visual Studio. To use this method, see |
| 81 |
Section 2.4.15.6.2, "Building MySQL from a Windows Source |
| 82 |
Distribution." |
| 83 |
* Build directly from the Bazaar source repository. For this you |
| 84 |
will need CMake, Visual C++ Express Edition or Visual Studio, |
| 85 |
and bison. For this method you need to create the distribution |
| 86 |
on a Unix system and then copy the generated files to your |
| 87 |
Windows build environment. To use this method, see Section |
| 88 |
2.4.15.6.5, "Creating a Windows Source Package from the Bazaar |
| 89 |
Repository." |
| 90 |
|
| 91 |
If you find something not working as expected, or you have |
| 92 |
suggestions about ways to improve the current build process on |
| 93 |
Windows, please send a message to the win32 mailing list. See |
| 94 |
Section 1.6.1, "MySQL Mailing Lists." |
| 95 |
|
| 96 |
2.4.15.6.1. Building MySQL from the Standard Source Distribution |
| 97 |
|
| 98 |
This section does not apply to MySQL Enterprise Server users. |
| 99 |
|
| 100 |
You can build MySQL on Windows by using a combination of cmake and |
| 101 |
Microsoft Visual Studio .NET 2003 (7.1), Micrsofot Visual Studio |
| 102 |
2005 (8.0) or Microsoft Visual C++ 2005 Express Edition. You must |
| 103 |
have the appropriate Microsoft Platform SDK installed. |
| 104 |
|
| 105 |
Note |
| 106 |
|
| 107 |
To compile from the source code usin CMake you must use the |
| 108 |
standard source distribution (for example, mysql-5.0.45.tar.gz). |
| 109 |
You build from the same distribution as used to build MySQL on |
| 110 |
Unix, Linux and other platforms. Do not use the Windows Source |
| 111 |
distributions as they do not contain the necessary configuration |
| 112 |
script and other files. |
| 113 |
|
| 114 |
Follow this procedure to build MySQL: |
| 115 |
1. If you are installing from a packaged source distribution, |
| 116 |
create a work directory (for example, C:\workdir), and unpack |
| 117 |
the source distribution there using WinZip or another Windows |
| 118 |
tool that can read .zip files. This directory is the work |
| 119 |
directory in the following instructions. |
| 120 |
2. If you are installing from a Bazaar tree, the root directory |
| 121 |
of that tree is the work directory in the following |
| 122 |
instructions. |
| 123 |
3. Using a command shell, navigate to the work directory and run |
| 124 |
the following command: |
| 125 |
C:\workdir>win\configure options |
| 126 |
These options are available: |
| 127 |
+ WITH_INNOBASE_STORAGE_ENGINE: Enable the InnoDB storage |
| 128 |
engine. |
| 129 |
+ WITH_PARTITION_STORAGE_ENGINE: Enable user-defined |
| 130 |
partitioning. |
| 131 |
+ WITH_ARCHIVE_STORAGE_ENGINE: Enable the ARCHIVE storage |
| 132 |
engine. |
| 133 |
+ WITH_BLACKHOLE_STORAGE_ENGINE: Enable the BLACKHOLE |
| 134 |
storage engine. |
| 135 |
+ WITH_EXAMPLE_STORAGE_ENGINE: Enable the EXAMPLE storage |
| 136 |
engine. |
| 137 |
+ WITH_FEDERATED_STORAGE_ENGINE: Enable the FEDERATED |
| 138 |
storage engine. |
| 139 |
+ __NT__: Enable support for named pipes. |
| 140 |
+ MYSQL_SERVER_SUFFIX=suffix: Server suffix, default none. |
| 141 |
+ COMPILATION_COMMENT=comment: Server comment, default |
| 142 |
"Source distribution". |
| 143 |
+ MYSQL_TCP_PORT=port: Server port, default 3306. |
| 144 |
+ DISABLE_GRANT_OPTIONS: Disables the the --bootstrap, |
| 145 |
--skip-grant-tables, and --init-file options for mysqld. |
| 146 |
This option is available as of MySQL 5.0.36. |
| 147 |
For example (type the command on one line): |
| 148 |
C:\workdir>win\configure WITH_INNOBASE_STORAGE_ENGINE �� |
| 149 |
WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro |
| 150 |
4. From the work directory, execute the win\build-vs8.bat or |
| 151 |
win\build-vs71.bat file, depending on the version of Visual |
| 152 |
Studio you have installed. The script invokes CMake, which |
| 153 |
generates the mysql.sln solution file you will need to build |
| 154 |
MySQL using Visual Studio.. |
| 155 |
You can also use win\build-vs8_x64.bat to build the 64-bit |
| 156 |
version of MySQL. However, you cannot build the 64-bit version |
| 157 |
with Visual Studio Express Edition. You must use Visual Studio |
| 158 |
2005 (8.0) or higher. |
| 159 |
5. From the work directory, open the generated mysql.sln file |
| 160 |
with Visual Studio and select the proper configuration using |
| 161 |
the Configuration menu. The menu provides Debug, Release, |
| 162 |
RelwithDebInfo, MinRelInfo options. Then select Solution > |
| 163 |
Build to build the solution. |
| 164 |
The build process will take some time. Please be patient. |
| 165 |
Remember the configuration that you use in this step. It is |
| 166 |
important later when you run the test script because that |
| 167 |
script needs to know which configuration you used. |
| 168 |
6. You should test you build before installation. See Section |
| 169 |
2.4.15.6.4, "Testing a Windows Source Build." |
| 170 |
7. To install, use the instructions in Section 2.4.15.6.3, |
| 171 |
"Installing MySQL from a Source Build on Windows." |
| 172 |
|
| 173 |
2.4.15.6.2. Building MySQL from a Windows Source Distribution |
| 174 |
|
| 175 |
This section does not apply to MySQL Enterprise Server users. |
| 176 |
|
| 177 |
The Windows source distribution includes the necessary solution |
| 178 |
file and the vcproj files required to build each component. Using |
| 179 |
this method you are not able to select the storage engines that |
| 180 |
are included in your build. |
| 181 |
|
| 182 |
Note |
| 183 |
|
| 184 |
VC++ workspace files for MySQL 4.1 and above are compatible with |
| 185 |
Microsoft Visual Studio 7.1 and tested by MySQL AB staff before |
| 186 |
each release. |
| 187 |
|
| 188 |
Follow this procedure to build MySQL: |
| 189 |
1. Create a work directory (for example, C:\workdir). |
| 190 |
2. Unpack the source distribution in the aforementioned directory |
| 191 |
using WinZip or another Windows tool that can read .zip files. |
| 192 |
3. Start Visual Studio .Net 2003 (7.1). |
| 193 |
4. From the File menu, select Open Solution.... |
| 194 |
5. Open the mysql.sln solution you find in the work directory. |
| 195 |
6. From the Build menu, select Configuration Manager.... |
| 196 |
7. In the Active Solution Configuration pop-up menu, select the |
| 197 |
configuration to use. You likely want to use one of nt (normal |
| 198 |
server), Max nt (more engines and features), or Debug |
| 199 |
configuration. |
| 200 |
8. From the Build menu, select Build Solution. |
| 201 |
9. Debug versions of the programs and libraries are placed in the |
| 202 |
client_debug and lib_debug directories. Release versions of |
| 203 |
the programs and libraries are placed in the client_release |
| 204 |
and lib_release directories. |
| 205 |
10. You should test you build before installation. See Section |
| 206 |
2.4.15.6.4, "Testing a Windows Source Build." |
| 207 |
11. To install, use the instructions in Section 2.4.15.6.3, |
| 208 |
"Installing MySQL from a Source Build on Windows." |
| 209 |
|
| 210 |
2.4.15.6.3. Installing MySQL from a Source Build on Windows |
| 211 |
|
| 212 |
When you are satisfied that the program you have built is working |
| 213 |
correctly, stop the server. Now you can install the distribution. |
| 214 |
There are two ways to do this, either by using the supplied |
| 215 |
installation script or by copying the files individually by hand. |
| 216 |
|
| 217 |
To use the script method you must have Cygwin installed as the |
| 218 |
script is a Shell script. To execute the installation process, run |
| 219 |
the make_win_bin_dist script in the scripts directory of the MySQL |
| 220 |
source distribution (see Section 4.4.2, "make_win_bin_dist --- |
| 221 |
Package MySQL Distribution as ZIP Archive"). This is a shell |
| 222 |
script, so you must have Cygwin installed if you want to use it. |
| 223 |
It creates a Zip archive of the built executables and support |
| 224 |
files that you can unpack to your desired installation location. |
| 225 |
|
| 226 |
It is also possible to install MySQL by copying directories and |
| 227 |
files manually: |
| 228 |
1. Create the directories where you want to install MySQL. For |
| 229 |
example, to install into C:\mysql, use these commands: |
| 230 |
C:\> mkdir C:\mysql |
| 231 |
C:\> mkdir C:\mysql\bin |
| 232 |
C:\> mkdir C:\mysql\data |
| 233 |
C:\> mkdir C:\mysql\share |
| 234 |
C:\> mkdir C:\mysql\scripts |
| 235 |
If you want to compile other clients and link them to MySQL, |
| 236 |
you should also create several additional directories: |
| 237 |
C:\> mkdir C:\mysql\include |
| 238 |
C:\> mkdir C:\mysql\lib |
| 239 |
C:\> mkdir C:\mysql\lib\debug |
| 240 |
C:\> mkdir C:\mysql\lib\opt |
| 241 |
If you want to benchmark MySQL, create this directory: |
| 242 |
C:\> mkdir C:\mysql\sql-bench |
| 243 |
Benchmarking requires Perl support. See Section 2.4.21, "Perl |
| 244 |
Installation Notes." |
| 245 |
2. From the work directory, copy into the C:\mysql directory the |
| 246 |
following directories: |
| 247 |
C:\> cd \workdir |
| 248 |
C:\workdir> copy client_release\*.exe C:\mysql\bin |
| 249 |
C:\workdir> copy client_debug\mysqld.exe C:\mysql\bin\mysqld-debug.ex |
| 250 |
e |
| 251 |
C:\workdir> xcopy scripts\*.* C:\mysql\scripts /E |
| 252 |
C:\workdir> xcopy share\*.* C:\mysql\share /E |
| 253 |
If you want to compile other clients and link them to MySQL, |
| 254 |
you should also copy several libraries and header files: |
| 255 |
C:\workdir> copy lib_debug\mysqlclient.lib C:\mysql\lib\debug |
| 256 |
C:\workdir> copy lib_debug\libmysql.* C:\mysql\lib\debug |
| 257 |
C:\workdir> copy lib_debug\zlib.* C:\mysql\lib\debug |
| 258 |
C:\workdir> copy lib_release\mysqlclient.lib C:\mysql\lib\opt |
| 259 |
C:\workdir> copy lib_release\libmysql.* C:\mysql\lib\opt |
| 260 |
C:\workdir> copy lib_release\zlib.* C:\mysql\lib\opt |
| 261 |
C:\workdir> copy include\*.h C:\mysql\include |
| 262 |
C:\workdir> copy libmysql\libmysql.def C:\mysql\include |
| 263 |
If you want to benchmark MySQL, you should also do this: |
| 264 |
C:\workdir> xcopy sql-bench\*.* C:\mysql\bench /E |
| 265 |
|
| 266 |
After installation, set up and start the server in the same way as |
| 267 |
for binary Windows distributions. See Section 2.4.8, "Installing |
| 268 |
MySQL on Windows." |
| 269 |
|
| 270 |
2.4.15.6.4. Testing a Windows Source Build |
| 271 |
|
| 272 |
You should test the server that you have built from source before |
| 273 |
using the distribution. |
| 274 |
|
| 275 |
To test the server you need to run the built mysqld. By default, |
| 276 |
using the source build examples, the MySQL base directory and data |
| 277 |
directory are C:\mysql and C:\mysql\data. If you want to test your |
| 278 |
server using the source tree root directory and its data directory |
| 279 |
as the base directory and data directory, you need to tell the |
| 280 |
server their pathnames. You can either do this on the command line |
| 281 |
with the --basedir and --datadir options, or by placing |
| 282 |
appropriate options in an option file. (See Section 4.2.3.2, |
| 283 |
"Using Option Files.") If you have an existing data directory |
| 284 |
elsewhere that you want to use, you can specify its pathname |
| 285 |
instead. |
| 286 |
|
| 287 |
When the server is running in standalone fashion or as a service |
| 288 |
based on your configuration, try to connect to it from the mysql |
| 289 |
interactive command-line utility. |
| 290 |
|
| 291 |
You can also run the standard test script, mysql-test-run.pl. This |
| 292 |
script is written in Perl, so you'll need either Cygwin or |
| 293 |
ActiveState Perl to run it. You may also need to install the |
| 294 |
modules required by the script. To run the test script, change |
| 295 |
location into the mysql-test directory under the work directory, |
| 296 |
set the MTR_VS_CONFIG environment variable to the configuration |
| 297 |
you selected earlier (or use the --vs-config option), and invoke |
| 298 |
mysql-test-run.pl. For example (using Cygwin and the bash shell): |
| 299 |
shell> cd mysql-test |
| 300 |
shell> export MTS_VS_CONFIG=debug |
| 301 |
shell> ./mysqltest-run.pl --force --timer |
| 302 |
shell> ./mysqltest-run.pl --force --timer --ps-protocol |
| 303 |
|
| 304 |
2.4.15.6.5. Creating a Windows Source Package from the Bazaar |
| 305 |
Repository |
| 306 |
|
| 307 |
This section does not apply to MySQL Enterprise Server users. |
| 308 |
|
| 309 |
To create a Windows source package from the current Bazaar source |
| 310 |
tree, use the instructions here. This procedure must be performed |
| 311 |
on a system running a Unix or Unix-like operating system because |
| 312 |
some of the configuration and build steps require tools that work |
| 313 |
only on Unix. For example, the following procedure is known to |
| 314 |
work well on Linux. |
| 315 |
1. Copy the Bazaar source tree for MySQL 5.0. For instructions on |
| 316 |
how to do this, see Section 2.4.15.3, "Installing from the |
| 317 |
Development Source Tree." |
| 318 |
2. Configure and build the distribution so that you have a server |
| 319 |
binary to work with. One way to do this is to run the |
| 320 |
following command in the top-level directory of your source |
| 321 |
tree: |
| 322 |
shell> ./BUILD/compile-pentium-max |
| 323 |
3. After making sure that the build process completed |
| 324 |
successfully, run the following utility script from top-level |
| 325 |
directory of your source tree: |
| 326 |
shell> ./scripts/make_win_src_distribution |
| 327 |
This script creates a Windows source package to be used on |
| 328 |
your Windows system. You can supply different options to the |
| 329 |
script based on your needs. See Section 4.4.3, |
| 330 |
"make_win_src_distribution --- Create Source Distribution for |
| 331 |
Windows," for a list of allowable options. |
| 332 |
By default, make_win_src_distribution creates a Zip-format |
| 333 |
archive with the name mysql-VERSION-win-src.zip, where VERSION |
| 334 |
represents the version of your MySQL source tree. |
| 335 |
4. Copy or upload the Windows source package that you have just |
| 336 |
created to your Windows machine. To compile it, use the |
| 337 |
instructions in Section 2.4.15.6.2, "Building MySQL from a |
| 338 |
Windows Source Distribution." |