Starting Up and Shutting Down the MySQL Server


As we discussed in Chapter 1, "Installing MySQL," you will typically configure your system to start the MySQL server automatically. However, there will be situations in which you need to shut down or restart the server in the event of a problem.

We have already discussed how to start the MySQL server. The way you do this varies depending on your operating system, path settings, and install choices. Under Linux, you can start the server with

 
 /etc/init.d/mysqld start 

but only if you have a copy of the mysqld executable in the standard Red Hat location. If you have it somewhere else, you will need to use the correct path. See Chapter 1 for more information. You can also start the server by running

 
 safe_mysqld 

This script attempts to determine the correct startup options automatically and then starts MySQL with those options. Again, if the script is not in your path, you will need to enter the full path to find it.

To shut down your MySQL server under Linux, you have a couple of options. You can use

 
 /etc/init.d/mysqld stop 

or

 
 mysqladmin u root p shutdown 

You can, of course, use a different administrator account, but root will work. Normal user accounts should not be given this privilege.

Under Windows, if you have installed mysqld as a service, the easiest way to start the service is to open the Control Panel and go to Administrative Tools, Services. If you select the MySQL service, Windows will give you options to Stop, Pause, or Restart the service, as shown in Figure 13.1. (This screenshot is from Windows XP Professional, so your display may vary a little depending on the version.)

Figure 13.1. The Services window in Windows Administrative Tools

graphics/13fig01.gif

You can also shut down the server using the mysqladmin script for Linux, as stated previously.



MySQL Tutorial
MySQL Tutorial
ISBN: 0672325845
EAN: 2147483647
Year: 2003
Pages: 261

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