3.1. Checking the MySQL Installation

You might or might not need to install MySQL. In many cases, MySQL is already installed. For instance, most recent Linux and Mac distributions automatically install MySQL. MySQL isn't provided with the Windows operating system.

Before installing MySQL, be sure that you actually need to install it. It might already be running on your computer, or it might be installed but not running. For instance, many Linux distributions automatically install MySQL. Here's how to check whether MySQL is currently running:

  • Linux/Unix/Mac: At the command line, type the following:

    ps –ax

    The output should be a list of programs. Some operating systems (usually flavors of Unix) have different options for the ps command. If the preceding doesn't produce a list of programs that are running, type man ps to see which options you need to use.


    In the list of programs that appears, look for one called mysqld. If you find it, MySQL is running.

  • Windows: If MySQL is running, it will be running as a service. To check this, choose StartControl PanelAdministrative ToolsServices and scroll down the alphabetical list of services. If MySQL is installed as a service, it appears in the list. If it's currently running, its status displays Started.

    If you found MySQL in the service list, as described, but it isn't started, you can start it by highlighting MySQL in the service list and clicking Start the Service in the left panel.

Even if MySQL isn't currently running, it might be installed but just not started. Here's how to check to see whether MySQL is installed on your computer:

  • Linux/Unix/Mac: Type the following:

    find / -name "mysql*"

    If a directory named mysql is found, MySQL has been installed.

  • Windows: If you didn't find MySQL in the list of current services, look for a MySQL directory or files. You can search by choosing StartSearch. The default installation directory is C:Program FilesMySQLMySQL Server versionnumber for recent versions or C:mysql for older versions.

If you find MySQL on your computer but did not find it in the list of running programs (Linux/Unix/Mac) or the list of current services (Windows), the following steps show you how to start it.

To start MySQL on Linux/Unix/Mac, follow these steps:

  1. Change to the directory mysql/bin.

    This is the directory that you should have found when you were checking whether MySQL was installed.

  2. Type mysqld_safe &.

    When this command finishes, the prompt is displayed.

  3. Check that the MySQL server started by typing ps -ax.

    In the list of programs that appears, look for one called mysqld. If you find it, MySQL is running.

To start MySQL on Windows, follow these steps:

  1. Open a Command Prompt window.

    In Windows XP, choose StartAll ProgramsAccessoriesCommand Prompt.

  2. Change to the folder where MySQL is installed.

    For example, type cd C:Program FilesMySQLMySQL Server 5.0. Your cursor is now located in the MySQL folder.

  3. Change to the bin subfolder by typing cd bin.

    Your cursor is now located in the bin subfolder.

  4. Start the MySQL Server by typing mysqld --install.

    The MySQL server starts as a Windows service. You can check the installation by going to the service list, as described previously, and making sure that MySQL now appears in the service list and its status is Started.

If MySQL isn't installed on your computer, you need to download it and install it from www.mysql.com. Instructions are provided in the remainder of this chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.32.46