Sunteți pe pagina 1din 12

Installing MySQL on Windows

Installing MySQL
After the installation file has finished downloading, double-click it, which begins the MySQL Setup Wizard.

At the welcome dialog box, click the "Next" button.

The MySQL Setup Wizard allows you to choose the installation directory on your computer, and whether or not to have optional components installed. In the "Setup Type" dialog box, you can choose from three setup types: Typical, Complete, and Custom. Choose the first one if you would like MySQL to be installed in the default directory, "C:\Program Files\MySQL\MySQL Server 5.0", and you also want all three client programs to be included (Command-Line Shell, Command Line Utilities, and Server Instance Config), but none of the C language 'include' or library files. For most users, this setup type should work fine. Choose a "Complete" setup to get all of the above, which probably would only be of interest to C programmers who want to examine MySQL's source code. In this tutorial, we won't be using the default directory, and so we choose the "Custom" option, and specify an alternate installation directory, "C:\_a\MySQL". Some developers elect to install all of their applications in the default Windows directory, "C:\Program Files". But using a different directory has the advantage that it immediately distinguishes user-installed programs from those already installed by Windows or forcibly installed by any inconsiderate application that fails to allow one to specify its installation directory. The top-level directory name "_a" is short, saving space in the PATH environment variable, and its underscore pushes it to the top of any directory listing sorted alphabetically by filename, thus making it more visible.

After you have made all of your choices, click the "Next" button.

You are now ready to install MySQL's files. Click the "Install" button.

You may see some MySQL Enterprise advertisement dialog boxes.

Click through any ad boxes.

After the Setup Wizard has completed, you can and should configure your new server. Click the "Finish" button.

Configuring MySQL

At the initial Server Instance Configuration Wizard dialog box, click the "Next" button.

The configuration wizard allows you to choose either a detailed configuration, which gives you more control, or a standard configuration. Most developers, and this tutorial, will use the former option, which is also the default. Click the "Next" button.

At this point, you must indicate how MySQL is going to be used on your PC simply for development purposes, or as one of several server applications, or as an exclusively MySQL database server. For our purposes, choose the first option, which is the default. Click the "Next" button.

MySQL has two different built-in database storage engines: InnoDB and MyISAM. Only the former offers transaction functionality, but does so at a cost of somewhat reduced performance. At this point in the installation process, you should decide whether you will need or simply want to try out transactional operations for any of the database applications that you will be using with this particular MySQL instance. If you are sure that you will not be needing transactions, then you can choose the third option, "Non-Transactional Database Only", which is what we will be using in this tutorial. Otherwise, if your applications will be making heavy use of transactions, then choose the second option, "Transactional Database Only". This choice does not, however, preclude you from using the MyISAM engine. If you are not sure as to your need for transactions, or you see them as a limited portion of all anticipated transactions, then choose the first option, "Multifunctional Database", which is the default. Note that use of the InnoDB engine does require a considerable amount of disk space for the tablespace.

If your database is going to be hit by a large number of applications running concurrently, then it will need to allow a proportionally larger number of active connections. In that case, choose the second option in the dialog box shown above, "Online Transaction Processing (OLTP)". But this probably will not be the case for your development PC, and so you can leave the default option, "Decision Support (DSS)/OLAP", and then click the "Next" button.

For MySQL's networking, it is recommended to go with the defaults, namely, to enable TCP/IP networking, using port number 3306. The option to enable strict mode is not adequately explained in the dialog box. You should make a choice based upon whether or not there is a chance you will be using your database with applications, such as a proprietary shopping cart, whose code you cannot modify specifically, any SQL queries. If that is the case, then do not enable strict mode, because it could result in an error if and when the application tries to set a non-nullable column to a default value by specifying an empty value of a different type, and you get an error 1366. Click the "Next" button.

Choose the standard character set, which is the default option.

MySQL can be run by Windows as a service, and started automatically when you boot up your PC. Those are the default and recommended settings. MySQL's binary directory in our case, "C:\_a\MySQL\bin" contains more than a dozen executable programs. The Configuration Wizard can add the directory to your Path environment variable, so the programs can be run at the command line without specifying the directory. Click the checkbox to enable that, and then click the "Next" button.

At the security options dialog box, enter a new root password, twice. Do not check the option to "Enable root access for remote machines", for security reasons. Do not bother creating an anonymous account, since you should do everything with named accounts. When you are satisfied with your chosen root password, record it somewhere safe, and then click the "Next" button.

The Configuration Wizard is now ready to execute all of the settings that you have made in the earlier dialog boxes. Click the "Execute" button. If you tried to install MySQL in a directory that still contained the "data" subdirectory, then the security settings will fail, and you will get an Error 1045.

But if the configuration does not encounter any errors, then you will be informed that the configuration file was created, the MySQL service was installed and started, and your security settings have been applied.

S-ar putea să vă placă și