1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
|
2.4.14.6 Installing MySQL from Source on Windows
................................................
* Menu:
* windows-vc-plus-plus-build:: Building MySQL Using VC++
* windows-bitkeeper-build:: Creating a Windows Source Package from the Latest Development Source
This section does not apply to MySQL Enterprise Server users.
These instructions describe how to build binaries from source for MySQL
5.0 on Windows. Instructions are provided for building binaries from a
standard source distribution or from the BitKeeper tree that contains
the latest development source.
*Note*: The instructions here are strictly for users who want to test
MySQL on Windows from the latest source distribution or from the
BitKeeper tree. For production use, MySQL AB does not advise using a
MySQL server built by yourself from source. Normally, it is best to use
precompiled binary distributions of MySQL that are built specifically
for optimal performance on Windows by MySQL AB. Instructions for
installing a binary distributions are available in *Note
windows-installation::.
To build MySQL on Windows from source, you need the following compiler
and resources available on your Windows system:
* Visual Studio .Net 2003 (7.1) compiler system
* Between 3GB and 5GB disk space.
* Windows XP, Windows 2000 or higher.
The exact system requirements can be found here:
`http://msdn.microsoft.com/vstudio/Previous/2003/sysreqs/default.aspx'
You also need a MySQL source distribution for Windows. There are two
ways to obtain a source distribution:
1. Obtain a Windows source distribution packaged by MySQL AB for the
particular version of MySQL in which you are interested. These are
available from `http://dev.mysql.com/downloads/'.
2. You can package a source distribution yourself from the latest
BitKeeper developer source tree. If you plan to do this, you must
create the package on a Unix system and then transfer it to your
Windows system. (Some of the configuration and build steps require
tools that work only on Unix.) The BitKeeper approach thus
requires:
* A system running Unix, or a Unix-like system such as Linux.
* BitKeeper installed on that system. See *Note
installing-source-tree::, for instructions how to download
and install BitKeeper.
If you are using a Windows source distribution, you can go directly to
*Note windows-vc-plus-plus-build::. To build from the BitKeeper tree,
proceed to *Note windows-bitkeeper-build::.
If you find something not working as expected, or you have suggestions
about ways to improve the current build process on Windows, please send
a message to the `win32' mailing list. See *Note mailing-lists::.
File: manual.info, Node: windows-vc-plus-plus-build, Next: windows-bitkeeper-build, Prev: windows-source-build, Up: windows-source-build
2.4.14.7 Building MySQL Using VC++
..................................
This section does not apply to MySQL Enterprise Server users.
*Note*: VC++ workspace files for MySQL 4.1 and above are compatible
with Microsoft Visual Studio 7.1 and tested by MySQL AB staff before
each release.
Follow this procedure to build MySQL:
1. Create a work directory (for example, `C:\workdir').
2. Unpack the source distribution in the aforementioned directory
using `WinZip' or another Windows tool that can read `.zip' files.
3. Start Visual Studio .Net 2003 (7.1).
4. From the `File menu', select `Open Solution...'.
5. Open the `mysql.sln' solution you find in the work directory.
6. From the `Build' menu, select `Configuration Manager...'.
7. In the `Active Solution Configuration' pop-up menu, select the
configuration to use. You likely want to use one of `nt' (normal
server, not for Windows 98/ME), `Max nt' (more engines and
features, not for 98/ME) or `Debug' configuration.
8. From the `Build' menu, select `Build Solution'.
9. Debug versions of the programs and libraries are placed in the
`client_debug' and `lib_debug' directories. Release versions of
the programs and libraries are placed in the `client_release' and
`lib_release' directories.
10. Test the server. The server built using the preceding instructions
expects that the MySQL base directory and data directory are
`C:\mysql' and `C:\mysql\data' by default. If you want to test
your server using the source tree root directory and its data
directory as the base directory and data directory, you need to
tell the server their pathnames. You can either do this on the
command line with the `--basedir' and `--datadir' options, or by
placing appropriate options in an option file. (See *Note
option-files::.) If you have an existing data directory elsewhere
that you want to use, you can specify its pathname instead.
11. Start your server from the `client_release' or `client_debug'
directory, depending on which server you built or want to use. The
general server startup instructions are in *Note
windows-installation::. You must adapt the instructions
appropriately if you want to use a different base directory or
data directory.
12. When the server is running in standalone fashion or as a service
based on your configuration, try to connect to it from the `mysql'
interactive command-line utility that exists in your
`client_release' or `client_debug' directory.
When you are satisfied that the programs you have built are working
correctly, stop the server. Then install MySQL as follows:
1. Create the directories where you want to install MySQL. For
example, to install into `C:\mysql', use these commands:
C:\> mkdir C:\mysql
C:\> mkdir C:\mysql\bin
C:\> mkdir C:\mysql\data
C:\> mkdir C:\mysql\share
C:\> mkdir C:\mysql\scripts
If you want to compile other clients and link them to MySQL, you
should also create several additional directories:
C:\> mkdir C:\mysql\include
C:\> mkdir C:\mysql\lib
C:\> mkdir C:\mysql\lib\debug
C:\> mkdir C:\mysql\lib\opt
If you want to benchmark MySQL, create this directory:
C:\> mkdir C:\mysql\sql-bench
Benchmarking requires Perl support. See *Note perl-support::.
2. From the `workdir' directory, copy into the `C:\mysql' directory
the following directories:
C:\> cd \workdir
C:\workdir> copy client_release\*.exe C:\mysql\bin
C:\workdir> copy client_debug\mysqld.exe C:\mysql\bin\mysqld-debug.exe
C:\workdir> xcopy scripts\*.* C:\mysql\scripts /E
C:\workdir> xcopy share\*.* C:\mysql\share /E
If you want to compile other clients and link them to MySQL, you
should also copy several libraries and header files:
C:\workdir> copy lib_debug\mysqlclient.lib C:\mysql\lib\debug
C:\workdir> copy lib_debug\libmysql.* C:\mysql\lib\debug
C:\workdir> copy lib_debug\zlib.* C:\mysql\lib\debug
C:\workdir> copy lib_release\mysqlclient.lib C:\mysql\lib\opt
C:\workdir> copy lib_release\libmysql.* C:\mysql\lib\opt
C:\workdir> copy lib_release\zlib.* C:\mysql\lib\opt
C:\workdir> copy include\*.h C:\mysql\include
C:\workdir> copy libmysql\libmysql.def C:\mysql\include
If you want to benchmark MySQL, you should also do this:
C:\workdir> xcopy sql-bench\*.* C:\mysql\bench /E
Set up and start the server in the same way as for the binary Windows
distribution. See *Note windows-installation::.
File: manual.info, Node: windows-bitkeeper-build, Prev: windows-vc-plus-plus-build, Up: windows-source-build
2.4.14.8 Creating a Windows Source Package from the Latest Development Source
.............................................................................
This section does not apply to MySQL Enterprise Server users.
To create a Windows source package from the current BitKeeper source
tree, use the instructions here. This procedure must be performed on a
system running a Unix or Unix-like operating system because some of the
configuration and build steps require tools that work only on Unix. For
example, the following procedure is known to work well on Linux.
1. Copy the BitKeeper source tree for MySQL 5.0. For instructions on
how to do this, see *Note installing-source-tree::.
2. Configure and build the distribution so that you have a server
binary to work with. One way to do this is to run the following
command in the top-level directory of your source tree:
shell> ./BUILD/compile-pentium-max
3. After making sure that the build process completed successfully,
run the following utility script from top-level directory of your
source tree:
shell> ./scripts/make_win_src_distribution
This script creates a Windows source package to be used on your
Windows system. You can supply different options to the script
based on your needs. It accepts the following options:
* `--help'
Display a help message.
* `--debug'
Print information about script operations, do not create
package.
* `--tmp'
Specify the temporary location.
* `--suffix'
The suffix name for the package.
* `--dirname'
Directory name to copy files (intermediate).
* `--silent'
Do not print verbose list of files processed.
* `--tar'
Create `tar.gz' package instead of `.zip' package.
By default, `make_win_src_distribution' creates a Zip-format
archive with the name `mysql-VERSION-win-src.zip', where VERSION
represents the version of your MySQL source tree.
4. Copy or upload the Windows source package that you have just
created to your Windows machine. To compile it, use the
instructions in *Note windows-vc-plus-plus-build::.
File: manual.info, Node: windows-client-compiling, Prev: windows-source-build, Up: installing-source
2.4.14.9 Compiling MySQL Clients on Windows
...........................................
This section does not apply to MySQL Enterprise Server users.
In your source files, you should include `my_global.h' before `mysql.h':
#include <my_global.h>
#include <mysql.h>
`my_global.h' includes any other files needed for Windows compatibility
(such as `windows.h') if you compile your program on Windows.
You can either link your code with the dynamic `libmysql.lib' library,
which is just a wrapper to load in `libmysql.dll' on demand, or link
with the static `mysqlclient.lib' library.
The MySQL client libraries are compiled as threaded libraries, so you
should also compile your code to be multi-threaded.
|