Project 1 - 1 Install MySQL on Windows and Start the MySQL Service


Project 1 “1 Install MySQL on Windows and Start the MySQL Service

In this project, you will install MySQL on your Windows machine. Then you will start the MySQL service, so that you can start using MySQL.

Note  

For the projects in this book, the MySQL installation default settings are more than adequate. The Ask the Expert section after the project covers questions about installing and running your database with the MySQL default settings.

Step by Step

  1. Open a web browser and go to http://www.mysql.com/downloads/index.html.

  2. Scroll down to MySQL database server & standard clients and click the link for the (highest numbered) MySQL x.x -- Production release (recommended) .

  3. Scroll down to Windows downloads and click the Pick a mirror link at the end of the Windows 95/98/NT/2000/XP/2003 (x86) line.

  4. Pick a mirror site close to you and click its link.

  5. Select to save the file to My Downloads or another directory of your choice. After the download is complete, minimize your browser.

  6. In Windows Explorer, go to My Downloads or the directory you chose and unzip the mysql-x.x.x-win.zip file. (You can either extract the files to a folder and save them in their unzipped format or install from within the ZIP program, which will save the files to a temporary folder during installation.)

  7. Double-click Setup.exe. The MySQL Servers and Clients installer wizard opens. No input is required on the Welcome screen.

  8. Click the Next button. The Information screen covers information about the configuration file (either my.cnf or my.ini) and the mandatory lines of information that are required for MySQL configuration. We ll discuss the configuration files briefly after your installation is complete.

  9. Click the Next button. The Choose Destination Location screen, shown next, appears.

  10. If possible, accept the default storage location and click Next. However, if you need to use a folder other than the default, click Browse and select it. After you choose the storage folder, the Setup Type screen appears.

  11. Make sure the radio button for Typical is chosen , and then click the Next button. Typical animated graphics will appear, indicating the progress of the installation. When it has completed, click the Finish button in the screen that appears.

  12. To start the MySQL service, open Windows Explorer to C:\mysql\bin and scroll down to winmysqladmin.exe.

    Note  

    For later convenience, you may want to place a shortcut on your desktop by right-clicking the winmysqladmin.exe file, selecting Create Shortcut, and then dragging the resulting icon onto your desktop area.

  13. Double-click winmysqladmin.exe. The WinMySQLAdmin window flashes briefly on the screen and is replaced by the Quick Setup window. In this window, enter a user name and password. We recommend root as the user name and a password that is not a word found in the dictionary.

    Caution  

    The user name and unencrypted password will appear in the my.ini file, which is located on the C:\ drive in either the \Windows or \WINNT folder, depending on your operating system. For security reasons, you may wish to make this password unique from your other passwords and also have a password on your screensaver to prevent unauthorized access.

  14. Click the OK button. The MySQL traffic light appears in the tray on the right side of the Windows toolbar. The green (or bottom) light should be on (the most noticeable), indicating that the MySQL service is running. If the red (or top) light is on, right-click the traffic light and click either WinNT or Win9X, and then click Start the Service. The amber (or middle) light indicates that the service is in the process of shutting down or coming up, and it is usually only a momentary status indicator.

Project Summary

If you followed the steps in Project 1-1, you now have MySQL installed on your Windows computer. You also started the MySQL service, which should be running now.

In step 8 of the project, you saw that the Information screen of the installer wizard gives some basic, if slightly confusing, information about the two types of configuration files: my.cnf and my.ini. The older name for the configuration files is my.cnf, and that filename is still supported. The newer name, and the name MySQL searches for first, is my.ini.

MySQL requires either the my.cnf or my.ini file in order to run. However, if you start MySQL for the first time without one of these files, the program will make the file for you, complete with default settings. MySQL recommends that novice users let its startup routine create the default configuration file for them. If you let the program create the my.ini file, you are operating with the MySQL recommended default settings.

Experienced users who may need different configuration settings can either use the program-generated configuration file (my.ini) or select one of the files provided in the \mysql\ directory: my-huge.ini, my-large.ini, my-medium.ini, or my-small.ini. See the Ask the Expert section after Project 1-2 for more information about changing configuration settings.

The WinMySQLAdmin Tool

Now that the MySQL service is installed and running, let s look at the type of information available from the WinMySQLAdmin tool. Right-click the traffic light in the toolbar tray and click Show Me. A window similar to Figure 1-1 will appear, with the traffic light in the upper-right corner.


Figure 1-1: The default view of the WinMySQLAdmin tool before MyODBC has been installed

Right-clicking anywhere in this window gives you the following menu options:

  • Hide Me Use to minimize WinMySQLAdmin but leave it running to continue to collect data about the MySQL service. There is also a Hide me button in the lower-left corner of the WinMySQLAdmin window.

    Note  

    Clicking the X button in the top-right corner of WinMySQLAdmin will close the WinMySQLAdmin window. It will not shut down the MySQL service.

  • Win9X or WinNT One or the other will be active, depending on your OS. Both lead to the next level of menu options.

  • Shutdown this Tool This closes WinMySQLAdmin but does not shut down the MySQL service.

  • Stop the Service This shuts down the MySQL service but does not close WinMySQLAdmin. It also activates the following two choices on the second level of menu options.

  • Start the Service This restarts the MySQL service.

  • Remove the Service This starts an uninstall wizard to remove MySQL from your computer.

If you choose Shutdown this Tool, Stop the Service, Start the Service, or Remove the Service, a window pops up, asking you for verification of the chosen procedure as a safety precaution.

Figure 1-1 also shows the rows of nine tabs at the top of WinMySQLAdmin: Environment, Start Check, Server, my.ini Setup, Err File, Variables, Process, Databases, and Report. The good news is that you do not need to know much about these tabs to start working with MySQL and building your first database. However, they do contain some useful information, so we will take a quick look at each of these tabs.

The Environment Tab

The Environment tab (Figure 1-1) shows basic information, such as the user and computer names you entered into your OS when you installed it. The Server section shows statistics like uptime (how long the MySQL service has been running since last started), the number of threads running, and the number of open tables. It also states what level of MySQL is currently installed and whether you have ODBC connections or an ODBC driver installed. The Not Found in the MyODBC window in Figure 1-1 means that there are no ODBC connections, and the Driver 3.51 Not Found means the ODBC Driver is not installed yet.

The Start Check and Server Tabs

The Start Check tab simply shows the system checks MySQL goes through when it starts the service. This information might be useful in debugging the database if it refuses to start.

The Server tab shows the number of processes that have been or are running and updates itself at regular intervals.

The my.ini Setup Tab

The my.ini Setup tab, shown in Figure 1-2, is interesting in several ways. It shows the my.ini file that MySQL created for you when it initially started up after installation, including some lines of code that are written in the correct format for use later, but commented out with a pound sign (#) until you decide that you need them.


Figure 1-2: The my.ini tab has buttons to safely edit and resave the my.ini file.

The Pick-up and Edit my.ini values and Save Modifications buttons allow you to edit the my.ini file through this interface without using an outside text editor. Using these buttons is a safe way to edit the my.ini file, because you can t accidentally resave it to the wrong place.

If you want WinMySQLAdmin to automatically open and start MySQL any time you start or reboot your computer, you can click the Create ShortCut on Start Menu button.

The Err File, Variables, Process, and Report Tabs

The Err File, Variables, Process, and Report tabs show information that may be useful as you become more familiar with MySQL. You may want to take a glance at their current contents to familiarize yourself with the types of information they hold. It s not important that you understand it all, but do try to get an idea of where you can find particular information later if you have problems or want to view statistics.

The Databases Tab

The Databases tab shows all the individual databases set up within MySQL and their component table structure and keys. Initially, mysql and test are the default databases, and you should be able to see those.

Figure 1-3 shows the Databases tab with the mysql database selected (clicked in the Databases list in the upper left) and the columns_priv table selected (click in the Database Tables list in the upper right). The Table Columns list box shows how each field in the selected table ( columns_priv ) is defined. The Table Indexes list box shows what, if any, indexing key or keys have been set in the selected table.


Figure 1-3: The Databases tab showing the columns_priv table information of the mysql database

If you select the test database, you will see that it does not have any tables defined yet. The mysql database holds the user information for your MySQL service in general. For instance, information about the user name and password you entered during startup and the existence of the two default databases is stored here. Any subsequent users you allow access to the system and databases you build will be added to the information stored in mysql .

You should not alter the mysql database for experimental purposes. If you want to try commands before creating your first database, do your experimenting in the test database only. As the name suggests, that is its purpose.

As you saw on the Environment tab of WinMySQLAdmin, you do not have an ODBC driver installed yet. Let s take care of that now.




MySQL(c) Essential Skills
MySQL: Essential Skills
ISBN: 0072255137
EAN: 2147483647
Year: 2006
Pages: 109

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