|< Day Day Up >|
11.1 Running MySQL on Windows
This section describes MySQL installation, startup, and shutdown procedures for Windows systems.
11.1.1 Installing the MySQL Distribution
The Windows installer automatically sets up the data directory under the MySQL base installation directory. The default data directory is C:\mysql\data. Under this directory, the installer also creates a mysql directory for the mysql database that contains the initial MySQL accounts. Note that these accounts at this point have no passwords. Chapter 12, "Security Issues," discusses how to set up passwords.
11.1.2 Starting and Stopping the MySQL Server
Windows MySQL distributions include several servers. You should choose the one you want to use:
The examples in the following discussion use mysqld for the server name; make the appropriate substitutions to use a different server. Note that even if you use a server that supports named pipes, it will not allow named pipe connections by default. To allow that type of connection, you must start the server with the --enable-named-pipe option.
See section 11.3, "Runtime MySQL Configuration," for instructions on specifying any server startup options you need.
22.214.171.124 Running the Server Manually
By default, Windows servers write error messages to the file host_name.err in the data directory, where host_name is the MySQL server hostname. (If you have an older version of MySQL 4, the error log might be named mysql.err instead.) If the server does not start properly, check the error log to see why. Alternatively, to display diagnostic output in the console window instead, invoke the server with the --console option:
shell> mysqld --console
Other server options may be specified on the command line or in option files. See section 11.3, "Runtime MySQL Configuration."
Note that when you invoke the server at the command prompt, the command interpreter might not display another prompt until the server exits. To invoke other MySQL programs while the server is running, open a new console window.
shell> mysqladmin shutdown
Another way to stop the server is to use the MySQLCC program. It's also possible to use the Windows Task Manage2, although you should avoid that if you can because the Task Manager terminates the server forcibly without giving it a chance to perform a clean shutdown. The result might be data corruption or loss.
126.96.36.199 Running the Server as a Windows Service
shell> mysqld --install
This command does not actually start the server; it tells Windows to handle the server as a service. When Windows starts up or shuts down, it starts or stops mysqld automatically. The service also can be started or stopped manually from the command line. To do so, use these commands:
shell> net start MySQL shell> net stop MySQL
MySQL is the service name for MySQL. It can be given in any lettercase.
You can also shut down the server manually using mysqladmin shutdown or with MySQLCC.
If the server does not start properly when run as a service, check the error log or run the server manually with the --console option as described in section 188.8.131.52, "Running the Server Manually."
If you want to specify runtime options for a MySQL server that is to run as a service, don't give them on the --install command line. Instead, put the options in an option file. The server normally reads options from the [mysqld] group of the standard Windows option files when it starts up. (These files are described in section 11.3, "Runtime MySQL Configuration.") To use a specific option file, use a command like this to install the service:
shell> mysqld --install MySQL --defaults-file=file_name
shell> mysqld --remove
|< Day Day Up >|