This section describes installation and use of MySQL on Win32. This
is also described in the `README' file that comes with the
MySQL Win32 distribution.
If you don't have a registered version of MySQL, you should first
download the shareware version from:
If you plan to connect to MySQL from some other program, you will
probably also need the MyODBC driver. You can find this at the
MySQL download page.
To install either distribution, unzip it in some empty directory and run the
Installation takes place in `C:\mysql'.
MySQL uses TCP/IP to connect a client to a server. (This will
allow any machine on your network to connect to your MySQL
server). Because of this, you must install TCP/IP on your machine before
starting MySQL. You can find TCP/IP on your Windows CD-ROM.
Note that if you are using an old Win95 release (for example OSR2), it's
likely that you have an old Winsock package! MySQL requires
Winsock 2! You can get the newest Winsock from
Microsoft. Win98 has as default the new
Winsock 2 library, so the above doesn't apply for Win98.
There are 2 different MySQL servers you can use:
| Compiled with full debugging and automatic memory allocation checking
| Optimized for a Pentium processor.
Both of the above should work on any Intel processor >= i386.
To start the
mysqld server, you should start a MS-DOS window and type:
This will start
mysqld in the background without a window.
You can kill the MySQL server by executing:
C:\mysql\bin\mysqladmin -u root shutdown
Note that Win95/Win98 don't support creation of named pipes. On
Win95/Win98, you can only use named pipes to connect to a remote
MySQL running on an NT server.
The Win95/Win98 section also applies to MySQL on NT, with the
To get MySQL to work with TCP/IP, you must install service pack 3
For NT, the server name is
mysqld-nt. Normally you should install
MySQL as a service on NT:
(You could use the
mysqld-opt servers on NT,
but those cannot be started as a service or use named pipes.)
You can start and stop the MySQL service with:
NET START mysql
NET STOP mysql
Note that in this case you can't use any other options for
You can also run
mysqld-nt as a standalone program on NT if you need
mysqld-nt with any options! If you start
without options on NT,
mysqld-nt tries to starts itself as a service
with the default service options. If you have stopped
have to start it with
NET START mysql.
The service is installed with the name
MySql. Once installed, it must
be started using Services Control Manager (SCM) Utility (found in Control
Panel) or by using the
NET START MySQL command. If any options are
desired, they must be specified as "Startup parameters" in the SCM utility
before you start the MySQL service. Once running,
can be stopped using
mysqladmin or from the SCM utility or by using
NET STOP MySQL. If you use SCM to stop
there is a strange message from SCM about
mysqld shutdown normally.
When run as a service,
mysqld-nt has no access to a console and so no
messages can be seen.
On NT you can get the following service error messages:
|Permission Denied || Means that it cannot find |
|Cannot Register || Means that the path is incorrect
If you have problems installing
mysqld-nt as a service, try starting
it with the full path:
If this doesn't work, you can get
mysqld-nt to start properly by fixing
the path in the registry!
If you don't want to start
mysqld-nt as a service, you can start it as
C:\mysql\bin\mysqld-nt --standalone --debug
The last version gives you a debug trace in `C:\mysqld.trace'.
MySQL supports TCP/IP on all Win32 platforms and named pipes on NT.
The default is to use named pipes for local connections on NT and TCP/IP for
all other cases if the client has TCP/IP installed. The host name specifies
which protocol is used:
|NULL (none) || On NT, try named pipes first; if that doesn't work, use TCP/IP. On Win95/Win98, TCP/IP is used.
|. || Named pipes
|localhost || TCP/IP to current host
|hostname || TCP/IP
You can force a MySQL client to use named pipes by specifying the
--pipe option. Use the
--socket option to specify the name of
You can test whether or not MySQL is working by executing the
C:\mysql\bin\mysqlshow -u root mysql
C:\mysql\bin\mysqladmin version status proc
By default, MySQL-Win32 is configured to be installed in
`C:\mysql'. If you want to install MySQL elsewhere, install it
in `C:\mysql', then move the installation to where you want it. If you
do move MySQL, you must tell
mysqld where everything is by
supplying options to
C:\mysql\bin\mysqld --help to
display all options! If, for example, you have moved the MySQL
distribution to `D:\programs\mysql', you must start
D:\programs\mysql\bin\mysqld --basedir D:\programs\mysql
With the registered version of MySQL, you can also create a
`C:\my.cnf' file that holds any default options for the
MySQL server. Copy the file `\mysql\my-example.cnf' to
`C:\my.cnf' and edit this to suit your setup. Note that you should
specify all paths with
/ instead of
\. If you use
\, you need to specify this twice, as
\ is the escape
character in MySQL.
4.15.4 Fichier d'options.
mysqld is slow to answer to connections on Win95/Win98, there is
probably a problem with your DNS. In this case, start
--skip-name-resolve and use only
localhost and IP numbers in
the MySQL grant tables. You can also avoid DNS when connecting to a
mysqld-nt MySQL server running on NT by using the
--pipe argument to specify use of named pipes. This works for most
There are two versions of the MySQL command line tool:
| Compiled on native Win32, which offers very limited text
| Compiled with the Cygnus GNU compiler and libraries, which offers |
If you want to use
mysqlc.exe, you must copy
`C:\mysql\lib\cygwinb19.dll' to `\windows\system' (or similar
The default privileges on Win32 give all local users full privileges
to all databases. To make MySQL more secure, you
should set a password for all users and remove the row in the
mysql.user table that has
You should also add a password for the
mysql> DELETE FROM user WHERE Host='localhost' AND User='';
C:\mysql\bin\mysqladmin -u root password your_password
After you've set the password, if you want to take down the
server, you can do so using this command:
mysqladmin --user=root --password=your_password shutdown
Here is a note about how to connect to get a secure connection to remote MySQL
server with SSH (by David Carlson).
That's it. It works very well with a direct Internet connection. I'm
having problems with SSH conflicting with my Win95 network and Wingate -
but that'll be the topic of a posting on another software company's
MySQL-Win32 has by now proven itself to be very stable. This version
of MySQL has the same features as the corresponding Unix version
with the following exceptions:
- Win95 and threads
Win95 leaks about 200 bytes of main memory for each thread creation. Because
of this, you shouldn't run
mysqld for an extended time on Win95 if
you do many connections, since each connection in MySQL creates
a new thread! WinNT and Win98 don't suffer from this bug.
- Blocking read
MySQL uses a blocking read for each connection.
This means that:
We plan to fix this in the near future.
A connection will not be disconnected automatically after 8 hours, as happens
with the Unix version of MySQL.
If a connection ``hangs,'' it's impossible to break it without killing
mysqladmin kill will not work on a sleeping connection.
mysqladmin shutdown can't abort as long as there are sleeping
- UDF functions
For the moment, MySQL-Win32 does not support user definable functions.
You can't drop a database that is in use by some thread.
- Killing MySQL from the task manager
You can't kill MySQL from the task manager or with the shutdown
utility in Windows95. You must take it down with
- Case-insensitive names
Filenames are case insensitive on Win32, so database and table names
are also case insensitive in MySQL for Win32. The only restriction is
that database and table names must be given in the same case throughout a
given statement. The following query would not work because it refers to
a table both as
my_table and as
SELECT * FROM my_table WHERE MY_TABLE.col=1;
- The `\' directory character
Pathname components in Win95 are separated by `\' characters, which is
also the escape character in MySQL. If you are using
DATA INFILE or
SELECT ... INTO OUTFILE, you must double the `\'
character or use Unix style filenames `/' characters:
LOAD DATA INFILE "C:\\tmp\\skr.txt" INTO TABLE skr;
SELECT * FROM skr INTO OUTFILE 'C:/tmp/skr.txt';
Can't open named pipe error
If you use the shareware version of MySQL-Win32 on NT with the
newest mysql-clients you will get the following error:
error 2017: can't open named pipe to host: . pipe...
This is because the release version of MySQL uses
named pipes on NT by default. You can avoid this error by using the
--host=localhost option to the new MySQL clients
or create a file `C:\my.cnf' that contains the following information:
host = localhost
Access denied for user error
If you get the error
Access denied for user: 'some-user@unknown'
to database 'mysql' when accessing a MySQL server on the same
machine, this means that MySQL can't resolve your host name
To fix this, you should create a file `\windows\hosts' with the
Here are some open issues for anyone who might want to help us with the Win32
Make a single user
MYSQL.DLL server. This should include everything in
a standard MySQL server, except thread creation. This will make
MySQL much easier to use in applications that don't need a true
client/server and don't need to access the server from other hosts.
Add some nice ``start'' and ``shutdown'' icons to the MySQL installation.
Create a tool to manage registry entries for the MySQL startup
options. The registry entry reading is already coded into
but it should be recoded to be more ``parameter'' oriented.
The tool should also be able to update the `\my.cnf' file if the user
would prefer to use this instead of the registry.
mysqld as a service with
--install (on NT)
it would be nice if you could also add default options on the command line.
For the moment, the workaround is to update the `C:\my.cnf' file
When you suspend a laptop running Win95, the
daemon doesn't accept new connections when the laptop is resumed.
We don't know if this is a problem with Win95, TCP/IP or MySQL.
It would be real nice to be able to kill
mysqld from the
task manager. For the moment, you must use
readline to Win32 for use in the
mysql command line tool.
GUI versions of the standard MySQL clients (
mysqldump) would be nice.
It would be nice if the socket ``read'' and ``write'' functions in
`net.c' were interruptible. This would make it possible to kill open
mysqladmin kill on Win32.
Documentation of which Windows programs work with
MySQL-Win32/MyODBC and what must be done to get them working.
mysqld always starts in the "C" locale and not in the default locale.
We would like to have
mysqld use the current locale for the sort order.
sqlclient to Win32 (almost done) and add more features to it!
Add more options to MysqlManager.
Change the communication protocol between the server and client to use Windows
internal communication instead of sockets and TCP/IP.
Implement UDF functions with
Add macros to use the faster thread-safe increment/decrement méthodes
provided by Win32.
Other Win32-specific issues are described in the `README' file that comes
with the MySQL-Win32 distribution.