Installing MySQL on Windows

You need the following to install MySQL on a Windows machine:

  • An operating system in the Windows family—in other words, currently Windows 95/ 98/Me or Windows NT/2000/XP.

  • A copy of either the MySQL executables or the MySQL source (if you want to compile MySQL yourself ).

  • A program to unzip the distribution file.

  • Enough space on your system for MySQL.

  • Support for TCP/IP (Transmission Control Protocol/Internet Protocol). If your machine can connect to the Internet, you have this already. If not, install it (it's a network protocol).

  • If you want to connect to MySQL via ODBC (Open Database Connectivity)—for example, to connect Microsoft Access to MySQL—you'll also need the MyODBC driver.

Installing a Binary Distribution on Windows

To install onto one of Windows NT/2000/XP, you'll need to ensure that you're logged on as a user with administrator privileges. To upgrade from an earlier installation of MySQL, you'll need to stop the server. If it's running as a service, stop it with the following:

C:\> NET STOP MySQL 

Or you can use mysqladmin:

C:\mysql\bin> mysqladmin -u root -pg00r002b shutdown 

If you want to change the executable you're using (such as from mysqld-max-nt to mysqld-opt), on Windows NT/2000/XP you'll have to remove the service:

C:\mysql\bin> mysqld-max-nt --remove 

Now perform the following steps:

  1. Unzip the zipped distribution file and place it in a temporary directory.

  2. Run the executable setup.exe, which begins the installation. By default MySQL is installed into C:\mysql, although many Windows users prefer to place it in a location such as C:\Program Files\MySQL\. If you change the location, you must specify the new location in the configuration file (usually my.ini):

     basedir=D:/installation-path/ datadir=D:/data-path/ 
  3. MySQL comes with a number of executable files. Choose the one you want depending on your needs (see Table 15.3).

Table 15.3: Executable Files

File

Description

mysqld

A binary that supports debugging, automatic memory allocation checking, transactional tables (InnoDB and BDB), and symbolic links.

mysqld-opt

An optimized binary that comes with no support for transactional tables (InnoDB or BDB).

mysqld-nt

An optimized binary that supports named pipes (for use with NT/2000/XP). It can run on 95/98/Me, but no named pipes will be created, as these operating systems do not support it.

mysqld-max

An optimized binary that supports transactional tables (InnoDB and BDB) and symbolic links.

mysqld-max-nt

An optimized binary that supports transactional tables (InnoDB and BDB), which are named pipes when run on NT/2000/XP, and symbolic links.

Installing MySQL as a Service on Windows NT/2000/XP

If you're serious about running MySQL on Windows, you'll of course want to run it as a service. This allows the process to start automatically (which you'd want for a database server) when Windows starts, and shut down automatically when Windows shuts down. Services are run by Windows itself and are not affected by users logging in and out.

With NT/2000/XP, install MySQL as a service as follows:

C:\> c:\mysql\bin\mysqld-max-nt --install 

If you don't want MySQL to start automatically, but still want it as a service, run the same command with the manual option:

C:\mysql\bin> mysqld-max-nt --install-manual 

You can then start the service with the following:

C:\> net start mysql The MySql service is starting. The MySql service was started successfully.

And stop it with the usual mysqladmin shutdown or the following:

C:\> net stop mysql The MySql service is stopping............ The MySql service was stopped successfully.

To remove it as a service, run the following:

C:\> c:\mysql\bin\mysqld-max-nt -remove 

You can also use the Services Control Panel, and click Start or Stop.

Note that Windows NT has a problem shutting down MySQL automatically because it doesn't wait long enough for MySQL to shut down before killing it (so the shutdown is not clean, increasing the chances of corruption).

To overcome this in NT, open the Registry editor \winnt\system32\regedt32.exe and set a new value in milliseconds for WaitToKillServiceTimeout at HKEY_LOCAL_MACHINE\SYSTEM\
CurrentControlSet\Control
in the Registry tree.

For more details on starting MySQL, see Chapter 10, "Basic Administration." Refer to Table 15.1 earlier in this chapter for a brief overview of the contents of the newly created directories.



Mastering MySQL 4
Mastering MySQL 4
ISBN: 0782141625
EAN: 2147483647
Year: 2003
Pages: 230
Authors: Ian Gilfillan

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net