Cari di MySQL 
    MySQL User Manual
Daftar Isi
(Sebelumnya) 1. Informasi Umum2.8. Installing MySQL on HP-UX (Berikutnya)

Chapter 2. Installing and Upgrading MySQL

Daftar Isi

2.1. General Installation Guidance
2.1.1. Operating Systems Supported by MySQL Community Server
2.1.2. Choosing Which MySQL Distribution to Install
2.1.3. How to Get MySQL
2.1.4. Verifying Package Integrity Using MD5 Checksums or GnuPG
2.1.5. Installation Layouts
2.1.6. Compiler-Specific Build Characteristics
2.2. Installing MySQL from Generic Binaries on Unix/Linux
2.3. Installing MySQL on Microsoft Windows
2.3.1. MySQL Installation Layout on Microsoft Windows
2.3.2. Choosing An Installation Package
2.3.3. Installing MySQL on Microsoft Windows Using MySQL Installer
2.3.4. Installing MySQL on Microsoft Windows Using an MSI Package
2.3.5. MySQL Notifier for Microsoft Windows
2.3.6. MySQL Server Instance Configuration Wizard
2.3.7. Installing MySQL on Microsoft Windows Using a noinstall Zip Archive
2.3.8. Troubleshooting a Microsoft Windows MySQL Server Installation
2.3.9. Upgrading MySQL on Windows
2.3.10. Windows Postinstallation Procedures
2.4. Installing MySQL on Mac OS X
2.4.1. General Notes on Installing MySQL on Mac OS X
2.4.2. Installing MySQL on Mac OS X Using Native Packages
2.4.3. Installing the MySQL Startup Item
2.4.4. Installing and Using the MySQL Preference Pane
2.4.5. Using the Bundled MySQL on Mac OS X Server
2.5. Installing MySQL on Linux
2.5.1. Installing MySQL from RPM Packages on Linux
2.5.2. Installing MySQL on Linux using Native Package Manager
2.6. Installing MySQL Using Unbreakable Linux Network (ULN)
2.7. Installing MySQL on Solaris and OpenSolaris
2.7.1. Installing MySQL on Solaris using a Solaris PKG
2.7.2. Installing MySQL on OpenSolaris using IPS
2.8. Installing MySQL on HP-UX
2.8.1. General Notes on Installing MySQL on HP-UX
2.8.2. Installing MySQL on HP-UX using DEPOT
2.9. Installing MySQL on FreeBSD
2.10. Installing MySQL from Source
2.10.1. MySQL Layout for Source Installation
2.10.2. Installing MySQL from a Standard Source Distribution
2.10.3. Installing MySQL from a Development Source Tree
2.10.4. MySQL Source-Configuration Options
2.10.5. Dealing with Problems Compiling MySQL
2.10.6. MySQL Configuration and Third-Party Tools
2.11. Postinstallation Setup and Testing
2.11.1. Unix Postinstallation Procedures
2.11.2. Securing the Initial MySQL Accounts
2.12. Upgrading or Downgrading MySQL
2.12.1. Upgrading MySQL
2.12.2. Downgrading MySQL
2.12.3. Checking Whether Tables or Indexes Must Be Rebuilt
2.12.4. Rebuilding or Repairing Tables or Indexes
2.12.5. Copying MySQL Databases to Another Machine
2.13. Environment Variables
2.14. Perl Installation Notes
2.14.1. Installing Perl on Unix
2.14.2. Installing ActiveState Perl on Windows
2.14.3. Problems Using the Perl DBI/DBDInterface

This chapter describes how to obtain and install MySQL. A summary of the procedure follows and later sections provide the details. If you plan to upgrade an existing version of MySQL to a newer version rather than install MySQL for the first time, see Section 2.12.1, "Upgrading MySQL", for information about upgrade procedures and about issues that you should consider before upgrading.

If you are interested in migrating to MySQL from another database system, you may wish to read Section B.8, "MySQL 5.5 FAQ: Migration", which contains answers to some common questions concerning migration issues.

If you are migrating from MySQL Enterprise Edition to MySQL Community Server, see Section 2.12.2.2, "Downgrading from MySQL Enterprise Edition to MySQL Community Server".

Installation of MySQL generally follows the steps outlined here:

  1. Determine whether MySQL runs and is supported on your platform.

    Please note that not all platforms are equally suitable for running MySQL, and that not all platforms on which MySQL is known to run are officially supported by Oracle Corporation:

  2. Choose which distribution to install.

    Several versions of MySQL are available, and most are available in several distribution formats. You can choose from pre-packaged distributions containing binary (precompiled) programs or source code. When in doubt, use a binary distribution. We also provide public access to our current source tree for those who want to see our most recent developments and help us test new code. To determine which version and type of distribution you should use, see Section 2.1.2, "Choosing Which MySQL Distribution to Install".

  3. Download the distribution that you want to install.

    For instructions, see Section 2.1.3, "How to Get MySQL". To verify the integrity of the distribution, use the instructions in Section 2.1.4, "Verifying Package Integrity Using MD5 Checksums or GnuPG".

  4. Install the distribution.

    To install MySQL from a binary distribution, use the instructions in Section 2.2, "Installing MySQL from Generic Binaries on Unix/Linux".

    To install MySQL from a source distribution or from the current development source tree, use the instructions in Section 2.10, "Installing MySQL from Source".

  5. Perform any necessary postinstallation setup.

    After installing MySQL, read Section 2.11, "Postinstallation Setup and Testing". This section contains important information about making sure the MySQL server is working properly. It also describes how to secure the initial MySQL user accounts, which have no passwords until you assign passwords. The section applies whether you install MySQL using a binary or source distribution.

  6. If you want to run the MySQL benchmark scripts, Perl support for MySQL must be available. See Section 2.14, "Perl Installation Notes".

Instructions for installing MySQL on different platforms and environments is available on a platform by platform basis:

2.1. General Installation Guidance

The immediately following sections contain the information necessary to choose, download, and verify your distribution. The instructions in later sections of the chapter describe how to install the distribution that you choose. For binary distributions, see the instructions at Section 2.2, "Installing MySQL from Generic Binaries on Unix/Linux" or the corresponding section for your platform if available. To build MySQL from source, use the instructions in Section 2.10, "Installing MySQL from Source".

2.1.1. Operating Systems Supported by MySQL Community Server

This section lists the operating systems on which MySQL Community Server is known to run.

Important

Oracle Corporation does not necessarily provide official support for all the platforms listed in this section. For information about those platforms that are officially supported, see http://www.mysql.com/support/supportedplatforms.html on the MySQL Web site.

We use CMake, so it is possible to port MySQL to all modern systems that have a C++ compiler and a working implementation of POSIX threads. (Thread support is needed for the server. To compile only the client code, the only requirement is a C++ compiler.)

MySQL has been reported to compile successfully on the following combinations of operating system and thread package.

MySQL has also been known to run on other systems in the past. See Section 2.1, "General Installation Guidance". Some porting effort might be required for current versions of MySQL on these systems.

Not all platforms are equally well-suited for running MySQL. How well a certain platform is suited for a high-load mission-critical MySQL server is determined by the following factors:

  • General stability of the thread library. A platform may have an excellent reputation otherwise, but MySQL is only as stable as the thread library it calls, even if everything else is perfect.

  • The capability of the kernel and the thread library to take advantage of symmetric multi-processor (SMP) systems. In other words, when a process creates a thread, it should be possible for that thread to run on a CPU different from the original process.

  • The capability of the kernel and the thread library to run many threads that acquire and release a mutex over a short critical region frequently without excessive context switches. If the implementation of pthread_mutex_lock() is too anxious to yield CPU time, this hurts MySQL tremendously. If this issue is not taken care of, adding extra CPUs actually makes MySQL slower.

  • General file system stability and performance.

  • Table size. If your tables are large, performance is affected by the ability of the file system to deal with large files and dealing with them efficiently.

  • Our level of expertise here at Oracle Corporation with the platform. If we know a platform well, we enable platform-specific optimizations and fixes at compile time. We can also provide advice on configuring your system optimally for MySQL.

  • The amount of testing we have done internally for similar configurations.

  • The number of users that have run MySQL successfully on the platform in similar configurations. If this number is high, the likelihood of encountering platform-specific surprises is much smaller.

2.1.2. Choosing Which MySQL Distribution to Install

When preparing to install MySQL, you should decide which version to use. MySQL development occurs in several release series, and you can pick the one that best fits your needs. After deciding which version to install, you can choose a distribution format. Releases are available in binary or source format.

2.1.2.1. Choosing Which Version of MySQL to Install

The first decision to make is whether you want to use a production (stable) release or a development release. In the MySQL development process, multiple release series co-exist, each at a different stage of maturity.

Production Releases
  • MySQL 5.5: Latest General Availability (Production) release

  • MySQL 5.1: Previous stable (production-quality) release

  • MySQL 5.0: Older stable release nearing the end of the product lifecycle

Development Release
  • MySQL 5.6: Current release under development (pre-Production)

MySQL 4.1, 4.0, and 3.23 are old releases that are no longer supported.

See http://www.mysql.com/about/legal/lifecycle/ for information about support policies and schedules.

Normally, if you are beginning to use MySQL for the first time or trying to port it to some system for which there is no binary distribution, use the most recent General Availability series listed in the preceding descriptions. All MySQL releases, even those from development series, are checked with the MySQL benchmarks and an extensive test suite before being issued.

If you are running an older system and want to upgrade, but do not want to take the chance of having a nonseamless upgrade, you should upgrade to the latest version in the same release series you are using (where only the last part of the version number is newer than yours). We have tried to fix only fatal bugs and make only small, relatively "safe" changes to that version.

If you want to use new features not present in the production release series, you can use a version from a development series. Be aware that development releases are not as stable as production releases.

We do not use a complete code freeze because this prevents us from making bugfixes and other fixes that must be done. We may add small things that should not affect anything that currently works in a production release. Naturally, relevant bugfixes from an earlier series propagate to later series.

If you want to use the very latest sources containing all current patches and bugfixes, you can use one of our source code repositories (see Section 2.10.3, "Installing MySQL from a Development Source Tree"). These are not "releases" as such, but are available as previews of the code on which future releases are to be based.

The naming scheme in MySQL 5.5 uses release names that consist of three numbers and a suffix; for example, mysql-5.5.6-m3. The numbers within the release name are interpreted as follows:

  • The first number (5) is the major version and describes the file format. All MySQL 5 releases have the same file format.

  • The second number (5) is the release level. Taken together, the major version and release level constitute the release series number.

  • The third number (6) is the version number within the release series. This is incremented for each new release. Usually you want the latest version for the series you have chosen.

For each minor update, the last number in the version string is incremented. When there are major new features or minor incompatibilities with previous versions, the second number in the version string is incremented. When the file format changes, the first number is increased.

Release names also include a suffix to indicates the stability level of the release. Releases within a series progress through a set of suffixes to indicate how the stability level improves. The possible suffixes are:

  • mN (for example, m1, m2, m3, ...) indicate a milestone number. MySQL development uses a milestone model, in which each milestone proceeds through a small number of versions with a tight focus on a small subset of thoroughly tested features. Following the releases for one milestone, development proceeds with another small number of releases that focuses on the next small set of features, also thoroughly tested. Features within milestone releases may be considered to be of pre-production quality.

  • rc indicates a Release Candidate. Release candidates are believed to be stable, having passed all of MySQL's internal testing, and with all known fatal runtime bugs fixed. However, the release has not been in widespread use long enough to know for sure that all bugs have been identified. Only minor fixes are added.

  • If there is no suffix, it indicates that the release is a General Availability (GA) or Production release. GA releases are stable, having successfully passed through all earlier release stages and are believed to be reliable, free of serious bugs, and suitable for use in production systems. Only critical bugfixes are applied to the release.

All releases of MySQL are run through our standard tests and benchmarks to ensure that they are relatively safe to use. Because the standard tests are extended over time to check for all previously found bugs, the test suite keeps getting better.

All releases have been tested at least with these tools:

  • An internal test suite. The mysql-test directory contains an extensive set of test cases. We run these tests for every server binary. See Section 23.1.2, "The MySQL Test Suite", for more information about this test suite.

  • The MySQL benchmark suite. This suite runs a range of common queries. It is also a test to determine whether the latest batch of optimizations actually made the code faster. See Section 8.12.2, "The MySQL Benchmark Suite".

We also perform additional integration and nonfunctional testing of the latest MySQL version in our internal production environment. Integration testing is done with different connectors, storage engines, replication modes, backup, partitioning, stored programs, and so forth in various combinations. Additional nonfunctional testing is done in areas of performance, concurrency, stress, high volume, upgrade and downgrade.

2.1.2.2. Choosing a Distribution Format

After choosing which version of MySQL to install, you should decide whether to use a binary distribution or a source distribution. In most cases, you should probably use a binary distribution, if one exists for your platform. Binary distributions are available in native format for many platforms, such as RPM files for Linux or PKG package installers for Mac OS X or Solaris. Distributions also are available as Zip archives or compressed tar files.

Reasons to choose a binary distribution include the following:

  • Binary distributions generally are easier to install than source distributions.

  • To satisfy different user requirements, we provide several servers in binary distributions. mysqld is an optimized server that is a smaller, faster binary. mysqld-debug is compiled with debugging support.

    Each of these servers is compiled from the same source distribution, though with different configuration options. All native MySQL clients can connect to servers from either MySQL version.

Under some circumstances, you may be better off installing MySQL from a source distribution:

  • You want to install MySQL at some explicit location. The standard binary distributions are ready to run at any installation location, but you might require even more flexibility to place MySQL components where you want.

  • You want to configure mysqld to ensure that features are available that might not be included in the standard binary distributions. Here is a list of the most common extra options that you may want to use to ensure feature availability:

  • You want to configure mysqld without some features that are included in the standard binary distributions. For example, distributions normally are compiled with support for all character sets. If you want a smaller MySQL server, you can recompile it with support for only the character sets you need.

  • You want to use the latest sources from one of the Bazaar repositories to have access to all current bugfixes. For example, if you have found a bug and reported it to the MySQL development team, the bugfix is committed to the source repository and you can access it there. The bugfix does not appear in a release until a release actually is issued.

  • You want to read (or modify) the C and C++ code that makes up MySQL. For this purpose, you should get a source distribution, because the source code is always the ultimate manual.

  • Source distributions contain more tests and examples than binary distributions.

2.1.2.3. How and When Updates Are Released

MySQL is evolving quite rapidly and we want to share new developments with other MySQL users. We try to produce a new release whenever we have new and useful features that others also seem to have a need for.

We also try to help users who request features that are easy to implement. We take note of what our licensed users want, and we especially take note of what our support customers want and try to help them in this regard.

No one is required to download a new release. The Release Notes help you determine whether the new release has something you really want.

We use the following policy when updating MySQL:

  • Enterprise Server releases are meant to appear every 18 months, supplemented by quarterly service packs and monthly rapid updates. Community Server releases are meant to appear 2 to 3 times per year.

  • Releases are issued within each series. For each release, the last number in the version is one more than the previous release within the same series.

  • Binary distributions for some platforms are made by us for major releases. Other people may make binary distributions for other systems, but probably less frequently.

  • We make fixes available as soon as we have identified and corrected small or noncritical but annoying bugs. The fixes are available in source form immediately from our public Bazaar repositories, and are included in the next release.

  • If by any chance a security vulnerability or critical bug is found in a release, our policy is to fix it in a new release as soon as possible. (We would like other companies to do this, too!)

2.1.3. How to Get MySQL

Check our downloads page at http://dev.mysql.com/downloads/ for information about the current version of MySQL and for downloading instructions. For a complete up-to-date list of MySQL download mirror sites, see http://dev.mysql.com/downloads/mirrors.html. You can also find information there about becoming a MySQL mirror site and how to report a bad or out-of-date mirror.

To obtain the latest development source, see Section 2.10.3, "Installing MySQL from a Development Source Tree".

2.1.4. Verifying Package Integrity Using MD5 Checksums orGnuPG

After you have downloaded the MySQL package that suits your needs and before you attempt to install it, you should make sure that it is intact and has not been tampered with. There are three means of integrity checking:

  • MD5 checksums

  • Cryptographic signatures using GnuPG, the GNU Privacy Guard

  • For RPM packages, the built-in RPM integrity verification mechanism

The following sections describe how to use these methods.

If you notice that the MD5 checksum or GPG signatures do not match, first try to download the respective package one more time, perhaps from another mirror site.

2.1.4.1. Verifying the MD5 Checksum

After you have downloaded a MySQL package, you should make sure that its MD5 checksum matches the one provided on the MySQL download pages. Each package has an individual checksum that you can verify with the following command, where package_name is the name of the package you downloaded:

shell> md5sum package_name

Example:

shell> md5sum mysql-standard-5.5.31-linux-i686.tar.gzaaab65abbec64d5e907dcd41b8699945  mysql-standard-5.5.31-linux-i686.tar.gz

You should verify that the resulting checksum (the string of hexadecimal digits) matches the one displayed on the download page immediately below the respective package.

Note

Make sure to verify the checksum of the archive file (for example, the .zip or .tar.gz file) and not of the files that are contained inside of the archive.

Note that not all operating systems support the md5sum command. On some, it is simply called md5, and others do not ship it at all. On Linux, it is part of the GNU Text Utilities package, which is available for a wide range of platforms. You can download the source code from http://www.gnu.org/software/textutils/ as well. If you have OpenSSL installed, you can use the command openssl md5 package_name instead. A Windows implementation of the md5 command line utility is available from http://www.fourmilab.ch/md5/. winMd5Sum is a graphical MD5 checking tool that can be obtained from http://www.nullriver.com/index/products/winmd5sum.

2.1.4.2. Signature Checking Using GnuPG

Another method of verifying the integrity and authenticity of a package is to use cryptographic signatures. This is more reliable than using MD5 checksums, but requires more work.

We sign MySQL downloadable packages with GnuPG (GNU Privacy Guard). GnuPG is an Open Source alternative to the well-known Pretty Good Privacy (PGP) by Phil Zimmermann. See http://www.gnupg.org/ for more information about GnuPG and how to obtain and install it on your system. Most Linux distributions ship with GnuPG installed by default. For more information about GnuPG, see http://www.openpgp.org/.

To verify the signature for a specific package, you first need to obtain a copy of our public GPG build key, which you can download from http://pgp.mit.com/. The key that you want to obtain is named [email protected]. Alternatively, you can cut and paste the key directly from the following text:

-----BEGIN PGP PUBLIC KEY BLOCK-----Version: PGP Universal 2.9.1 (Build 347)mQGiBD4+owwRBAC14GIfUfCyEDSIePvEW3SAFUdJBtoQHH/nJKZyQT7h9bPlUWC3RODjQReyCITRrdwyrKUGku2FmeVGwn2u2WmDMNABLnpprWPkBdCk96+OmSLN9brZfw2vOUgCmYv2hW0hyDHuvYlQA/BThQoADgj8AW6/0Lo7V1W9/8VuHP0gQwCgvzV3BqOxRznNCRCRxAuAuVztHRcEAJooQK1+iSiunZMYD1WufeXfshc57S/+yeJkegNWhxwR9pRWVArNYJdDRT+rf2RUe3vpquKNQU/hnEIUHJRQqYHo8gTxvxXNQc7fJYLVK2HtkrPbP72vwsEKMYhhr0eKCbtLGfls9krjJ6sBgACyP/Vb7hiPwxh6rDZ7ITnEkYpXBACmWpP8NJTkamEnPCia2ZoOHODANwpUkP43I7jsDmgtobZX9qnrAXw+uNDIQJEXM6FSbi0LLtZciNlYsafwAPEOMDKpMqAK6IyisNtPvaLd8lH0bPAnWqcyefeprv0sxxqUEMcM3o7wwgfN83POkDasDbs3pjwPhxvhz6//62zQJ7Q2TXlTUUwgUmVsZWFzZSBFbmdpbmVlcmluZyA8bXlzcWwtYnVpbGRAb3NzLm9yYWNsZS5jb20+iGYEExECACYCGyMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAUCTnc+KgUJE/sCFQAKCRCMcY07UHLh9SbMAJ4l1+qBz2BZNSGCZwwA6YbhGPC7FwCgp8z5TzIw4YQuL5NGJ/sy0oSazqmJASIEEAECAAwFAk53QS4FAwASdQAACgkQlxC4m8pXrXwJ8Qf/be/UO9mqfoc2sMyhwMpN4/fdBWwfLkA12FXQDOQMvwH9HsmEjnfUgYKXschZRi+DuHXe1P7l8G2aQLubhBsQf9ejKvRFTzuWMQkdIq+6Koulxv6ofkCcv3d1xtO2W7nb5yxcpVBPrRfGFGebJvZa58DymCNgyGtAU6AOz4veavNmI2+GIDQsY66+tYDvZ+CxwzdYu+HDV9HmrJfc6deM0mnBn7SRjqzxJPgoTQhihTav6q/R5/2p5NvQ/H84OgS6GjosfGc2duUDzCP/kheMRKfzuyKCOHQPtJuIj8++gfpHtEU7IDUX1So3c9n0PdpeBvclsDbpRnCNxQWU4mBot7kCDQQ+PqMdEAgA7+GJfxbMdY4wslPnjH9rF4N2qfWsEN/lxaZoJYc3a6M02WCnHl6ahT2/tBK2w1QI4YFteR47gCvtgb6O1JHffOo2HfLmRDRiRjd1DTCHqeyX7CHhcghj/dNRlW2Z0l5QFEcmV9U0Vhp3aFfWC4Ujfs3LU+hkAWzE7zaD5cH9J7yv/6xuZVw411x0h4UqsTcWMu0iM1BzELqX1DY7LwoPEb/O9Rkbf4fmLe11EzIaCa4PqARXQZc4dhSinMt6K3X4BrRsKTfozBu74F47D8Ilbf5vSYHbuE5p/1oIDznkg/p8kW+3FxuWrycciqFTcNz215yyX39LXFnlLzKUb/F5GwADBQf+Lwqqa8CGrRfsOAJxim63CHfty5mUc5rUSnTslGYEIOCR1BeQauyPZbPDsDD9MZ1ZaSafanFvwFG6Llx9xkU7tzq+vKLoWkm4u5xf3vn55VjnSd1aQ9eQnUcXiL4cnBGoTbOWI39EcyzgslzBdC++MPjcQTcA7p6JUVsP6oAB3FQWg54tuUo0Ec8bsM8b3Ev42LmuQT5NdKHGwHsXTPtl0klk4bQk4OajHsiy1BMahpT27jWjJlMiJc+IWJ0mghkKHt926s/ymfdf5HkdQ1cyvsz5tryVI3Fx78XeSYfQvuuwqp2H139pXGEkg0n6KdUOetdZWhe70YGNPw1yjWJT1IhUBBgRAgAMBQJOdz3tBQkT+wG4ABIHZUdQRwABAQkQjHGNO1By4fUUmwCbBYr2+bBEn/L2BOcnw9Z/QFWuhRMAoKVgCFm5fadQ3Afi+UQlAcOphrnJ=Eto8-----END PGP PUBLIC KEY BLOCK-----

To import the build key into your personal public GPG keyring, use gpg --import. For example, if you have saved the key in a file named mysql_pubkey.asc, the import command looks like this:

shell> gpg --import mysql_pubkey.ascgpg: key 5072E1F5: public key "MySQL Release Engineering<[email protected]>" importedgpg: Total number processed: 1gpg:   imported: 1gpg: no ultimately trusted keys found

You can also download the key from the public keyserver using the public key id, 5072E1F5:

shell> gpg --recv-keys 5072E1F5gpg: requesting key 5072E1F5 from hkp server keys.gnupg.netgpg: key 5072E1F5: "MySQL Release Engineering <[email protected]>"1 new user IDgpg: key 5072E1F5: "MySQL Release Engineering <[email protected]>"53 new signaturesgpg: no ultimately trusted keys foundgpg: Total number processed: 1gpg:   new user IDs: 1gpg: new signatures: 53

If you want to import the key into your RPM configuration to validate RPM install packages, you should be able to import the key directly:

shell> rpm --import mysql_pubkey.asc

If you experience problems, try exporting the key from gpg and importing:

shell> gpg --export -a 5072e1f5 > 5072e1f5.ascshell> rpm --import 5072e1f5.asc

Alternatively, rpm also supports loading the key directly from a URL, and you cas use this manual page:

shell> rpm --import http://dev.mysql.com/doc/refman/5.5/en/checking-gpg-signature.html

After you have downloaded and imported the public build key, download your desired MySQL package and the corresponding signature, which also is available from the download page. The signature file has the same name as the distribution file with an .asc extension, as shown by the examples in the following table.

Table 2.1. MySQL Package and Signature Files

File TypeFile Name
Distribution filemysql-standard-5.5.31-linux-i686.tar.gz
Signature filemysql-standard-5.5.31-linux-i686.tar.gz.asc

Make sure that both files are stored in the same directory and then run the following command to verify the signature for the distribution file:

shell> gpg --verify package_name.asc

Example:

shell> gpg --verify mysql-standard-5.5.31-linux-i686.tar.gz.ascgpg: Signature made Tue 01 Feb 2011 02:38:30 AM CST using DSA key ID 5072E1F5gpg: Good signature from "MySQL Release Engineering <[email protected]>"

The Good signature message indicates that everything is all right. You can ignore any insecure memory warning you might obtain.

See the GPG documentation for more information on how to work with public keys.

2.1.4.3. Signature Checking Using RPM

For RPM packages, there is no separate signature. RPM packages have a built-in GPG signature and MD5 checksum. You can verify a package by running the following command:

shell> rpm --checksig package_name.rpm

Example:

shell> rpm --checksig MySQL-server-5.5.31-0.glibc23.i386.rpmMySQL-server-5.5.31-0.glibc23.i386.rpm: md5 gpg OK
Note

If you are using RPM 4.1 and it complains about (GPG) NOT OK (MISSING KEYS: GPG#5072e1f5), even though you have imported the MySQL public build key into your own GPG keyring, you need to import the key into the RPM keyring first. RPM 4.1 no longer uses your personal GPG keyring (or GPG itself). Rather, RPM maintains a separate keyring because it is a system-wide application and a user's GPG public keyring is a user-specific file. To import the MySQL public key into the RPM keyring, first obtain the key as described in Section 2.1.4.2, "Signature Checking Using GnuPG". Then use rpm --import to import the key. For example, if you have saved the public key in a file named mysql_pubkey.asc, import it using this command:

shell> rpm --import mysql_pubkey.asc

If you need to obtain the MySQL public key, see Section 2.1.4.2, "Signature Checking Using GnuPG".

2.1.5. Installation Layouts

The installation layout differs for different installation types (for example, native packages, binary tarballs, and source tarballs), which can lead to confusion when managing different systems or using different installation sources. The individual layouts are given in the corresponding installation type or platform chapter, as described following. Note that the layout of installations from vendors other than Oracle may differ from these layouts.

2.1.6. Compiler-Specific Build Characteristics

In some cases, the compiler used to build MySQL affects the features available for use. The notes in this section apply for binary distributions provided by Oracle Corporation or that you compile yourself from source.

icc (Intel C++ Compiler) Builds

A server built with icc has these characteristics:

  • SSL support is not included.

2.2. Installing MySQL from Generic Binaries on Unix/Linux

Oracle provides a set of binary distributions of MySQL. These include binary distributions in the form of compressed tar files (files with a .tar.gz extension) for a number of platforms, as well as binaries in platform-specific package formats for selected platforms.

This section covers the installation of MySQL from a compressed tar file binary distribution. For other platform-specific package formats, see the other platform-specific sections. For example, for Windows distributions, see Section 2.3, "Installing MySQL on Microsoft Windows".

To obtain MySQL, see Section 2.1.3, "How to Get MySQL".

MySQL compressed tar file binary distributions have names of the form mysql-VERSION-OS.tar.gz, where VERSION is a number (for example, 5.5.31), and OS indicates the type of operating system for which the distribution is intended (for example, pc-linux-i686 or winx64).

To install MySQL from a compressed tar file binary distribution, your system must have GNU gunzip to uncompress the distribution and a reasonable tar to unpack it. If your tar program supports the z option, it can both uncompress and unpack the file.

GNU tar is known to work. The standard tar provided with some operating systems is not able to unpack the long file names in the MySQL distribution. You should download and install GNU tar, or if available, use a preinstalled version of GNU tar. Usually this is available as gnutar, gtar, or as tar within a GNU or Free Software directory, such as /usr/sfw/bin or /usr/local/bin. GNU tar is available from http://www.gnu.org/software/tar/.

Warning

If you have previously installed MySQL using your operating system native package management system, such as yum or apt-get, you may experience problems installing using a native binary. Make sure your previous MySQL previous installation has been removed entirely (using your package management system), and that any additional files, such as old versions of your data files, have also been removed. You should also check the existence of configuration files such as /etc/my.cnf or the /etc/mysql directory have been deleted.

If you run into problems and need to file a bug report, please use the instructions in Section 1.7, "How to Report Bugs or Problems".

On Unix, to install a compressed tar file binary distribution, unpack it at the installation location you choose (typically /usr/local/mysql). This creates the directories shown in the following table.

Table 2.2. MySQL Installation Layout for Generic Unix/Linux Binary Package

DirectoryContents of Directory
binClient programs and the mysqld server
dataLog files, databases
docsManual in Info format
manUnix manual pages
includeInclude (header) files
libLibraries
scriptsmysql_install_db
shareMiscellaneous support files, including error messages, sampleconfiguration files, SQL for database installation
sql-benchBenchmarks

Debug versions of the mysqld binary are available as mysqld-debug. To compile your own debug version of MySQL from a source distribution, use the appropriate configuration options to enable debugging support. For more information on compiling from source, see Section 2.10, "Installing MySQL from Source".

To install and use a MySQL binary distribution, the basic command sequence looks like this:

shell> groupadd mysqlshell> useradd -r -g mysql mysqlshell> cd /usr/localshell> tar zxvf /path/to/mysql-VERSION-OS.tar.gzshell> ln -s full-path-to-mysql-VERSION-OS mysqlshell> cd mysqlshell> chown -R mysql .shell> chgrp -R mysql .shell> scripts/mysql_install_db --user=mysqlshell> chown -R root .shell> chown -R mysql data# Next command is optionalshell> cp support-files/my-medium.cnf /etc/my.cnfshell> bin/mysqld_safe --user=mysql &# Next command is optionalshell> cp support-files/mysql.server /etc/init.d/mysql.server

A more detailed version of the preceding description for installing a binary distribution follows.

Note

This procedure assumes that you have root (administrator) access to your system. Alternatively, you can prefix each command using the sudo (Linux) or pfexec (OpenSolaris) command.

The procedure does not set up any passwords for MySQL accounts. After following the procedure, proceed to Section 2.11, "Postinstallation Setup and Testing".

Create a mysql User and Group

If your system does not already have a user and group for mysqld to run as, you may need to create one. The following commands add the mysql group and the mysql user. You might want to call the user and group something else instead of mysql. If so, substitute the appropriate name in the following instructions. The syntax for useradd and groupadd may differ slightly on different versions of Unix, or they may have different names such as adduser and addgroup.

shell> groupadd mysqlshell> useradd -r -g mysql mysql
Note

Because the user is required only for ownership purposes, not login purposes, the useradd command uses the -r option to create a user that does not have login permissions to your server host. Omit this option to permit logins for the user (or if your useradd does not support the option).

Obtain and Unpack the Distribution

Pick the directory under which you want to unpack the distribution and change location into it. The example here unpacks the distribution under /usr/local. The instructions, therefore, assume that you have permission to create files and directories in /usr/local. If that directory is protected, you must perform the installation as root.

shell> cd /usr/local

Obtain a distribution file using the instructions in Section 2.1.3, "How to Get MySQL". For a given release, binary distributions for all platforms are built from the same MySQL source distribution.

Unpack the distribution, which creates the installation directory. Then create a symbolic link to that directory. tar can uncompress and unpack the distribution if it has z option support:

shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gzshell> ln -s full-path-to-mysql-VERSION-OS mysql

The tar command creates a directory named mysql-VERSION-OS. The ln command makes a symbolic link to that directory. This enables you to refer more easily to the installation directory as /usr/local/mysql.

If your tar does not have z option support, use gunzip to unpack the distribution and tar to unpack it. Replace the preceding tar command with the following alternative command to uncompress and extract the distribution:

shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -

Perform Postinstallation Setup

The remainder of the installation process involves setting up the configuration file, creating the core databases, and starting the MySQL server. For instructions, see Section 2.11, "Postinstallation Setup and Testing".

Note

The accounts that are listed in the MySQL grant tables initially have no passwords. After starting the server, you should set up passwords for them using the instructions in Section 2.11, "Postinstallation Setup and Testing".

2.3. Installing MySQL on Microsoft Windows

A native Windows distribution of MySQL has been available since version 3.21 and represents a sizable percentage of the daily downloads of MySQL. This section describes the process for installing MySQL on Windows.

Note

If you are upgrading MySQL from an existing installation older than MySQL 4.1.5, you must first perform the procedure described in Section 2.3.9, "Upgrading MySQL on Windows".

To run MySQL on Windows, you need the following:

  • A Windows operating system such as Windows 2000, Windows XP, Windows Vista, Windows Server 2003, or Windows Server 2008. Both 32-bit and 64-bit versions are supported.

    A Windows operating system permits you to run the MySQL server as a service. See Section 2.3.7.7, "Starting MySQL as a Windows Service".

    Generally, you should install MySQL on Windows using an account that has administrator rights. Otherwise, you may encounter problems with certain operations such as editing the PATH environment variable or accessing the Service Control Manager. Once installed, MySQL does not need to be executed using a user with Administrator privileges.

  • TCP/IP protocol support.

  • Enough space on the hard drive to unpack, install, and create the databases in accordance with your requirements (generally a minimum of 200 megabytes is recommended.)

For a list of limitations within the Windows version of MySQL, see Section E.10.5, "Windows Platform Limitations".

There may also be other requirements, depending on how you plan to use MySQL:

MySQL for Windows is available in several distribution formats:

  • Binary distributions are available that contain a setup program that installs everything you need so that you can start the server immediately. Another binary distribution format contains an archive that you simply unpack in the installation location and then configure yourself. For details, see Section 2.3.2, "Choosing An Installation Package".

  • The source distribution contains all the code and support files for building the executables using the Visual Studio compiler system.

Generally speaking, you should use a binary distribution that includes an installer. It is simpler to use than the others, and you need no additional tools to get MySQL up and running. The installer for the Windows version of MySQL, combined with a GUI Configuration Wizard, automatically installs MySQL, creates an option file, starts the server, and secures the default user accounts.

Caution

Using virus scanning software such as Norton/Symantec Anti-Virus on directories containing MySQL data and temporary tables can cause issues, both in terms of the performance of MySQL and the virus-scanning software mis-identifying the contents of the files as containing spam. This is because of the fingerprinting mechanism used by the virus scanning software, and the way in which MySQL rapidly updates different files, which may be identified as a potential security risk.

After installing MySQL Server, it is recommended that you disable virus scanning on the main directory (datadir) being used to store your MySQL table data. There is usually a system built into the virus scanning software to enable certain directories to be specifically ignored during virus scanning.

In addition, by default, MySQL creates temporary files in the standard Windows temporary directory. To prevent the temporary files also being scanned, you should configure a separate temporary directory for MySQL temporary files and add this to the virus scanning exclusion list. To do this, add a configuration option for the tmpdir parameter to your my.ini configuration file. For more information, see Section 2.3.7.2, "Creating an Option File".

The following section describes how to install MySQL on Windows using a binary distribution. To use an installation package that does not include an installer, follow the procedure described in Section 2.3.7, "Installing MySQL on Microsoft Windows Using a noinstall Zip Archive". To install using a source distribution, see Section 2.10, "Installing MySQL from Source".

MySQL distributions for Windows can be downloaded from http://dev.mysql.com/downloads/. See Section 2.1.3, "How to Get MySQL".

2.3.1. MySQL Installation Layout on Microsoft Windows

For MySQL 5.5 on Windows, the default installation directory is C:\Program Files\MySQL\MySQL Server 5.5. Some Windows users prefer to install in C:\mysql, the directory that formerly was used as the default. However, the layout of the subdirectories remains the same.

All of the files are located within this parent directory, using the structure shown in the following table.

Table 2.3. MySQL Installation Layout for Windows

DirectoryContents of Directory
binClient programs and the mysqld server
C:\Documents and Settings\All Users\Application Data\MySQLLog files, databases (Windows XP, Windows Server 2003)
C:\ProgramData\MySQLLog files, databases (Windows 7, Windows Server 2008)
examplesExample programs and scripts
includeInclude (header) files
libLibraries
scriptsUtility scripts
shareMiscellaneous support files, including error messages, character set files, sample configuration files, SQL for databaseinstallation

If you install MySQL using a Windows MSI package, this package creates and sets up the data directory that the installed server will use, but as of MySQL 5.5.5, it also creates a pristine "template" data directory named data under the installation directory. This directory can be useful when the machine will be used to run multiple instances of MySQL: After an installation has been performed using an MSI package, the template data directory can be copied to set up additional MySQL instances. See Section 5.3, "Running Multiple MySQL Instances on One Machine".

2.3.2. Choosing An Installation Package

For MySQL 5.5, there are installation package formats to choose from when installing MySQL on Windows:

Note

MySQL Installer and the "Complete Package" methods for installing MySQL are similar, but different. The MySQL Installer is the newer and more advanced option, and it includes all functionality found within the "Complete Package."

  • MySQL Installer: This package has a file name similar to mysql-installer-community-5.5.31.0.msi and utilizes MSI's to automatically install MySQL server and other products. It will download and apply updates to itself, and for each of the installed products. It also configures the additional non-server products, such as MySQL Workbench.

    The installed products are configurable, and this includes: documentation with samples and examples, connectors (such as C, C++, J, NET, and ODBC), MySQL Workbench, and the MySQL Server with its components.

    MySQL Installer will run on all Windows platforms that are supported by MySQL. Note: because MySQL is not a native component of Windows, and depends on .NET, it will not work on minimal installation options like the "Server Core" version of Windows Server 2008.

  • The Complete Package: This package has a file name similar to mysql-5.5.31-win32.msi and contains all files needed for a complete Windows installation, including the Configuration Wizard. This package includes optional components such as the embedded server and benchmark suite.

  • The Noinstall Archive: This package has a file name similar to mysql-5.5.31-win32.zip and contains all the files found in the Complete install package, with the exception of the Configuration Wizard. This package does not include an automated installer, and must be manually installed and configured.

MySQL Installer is recommended for most users. Both MySQL Installer and the alternative "Complete distribution" versions are available as .msi files for use with installations on Windows. The Noinstall distribution is packaged as a Zip archive. To use a Zip archive, you must have a tool that can unpack .zip files.

Your choice of install package affects the installation process you must follow. If you choose to install using MySQL Installer, see Section 2.3.3, "Installing MySQL on Microsoft Windows Using MySQL Installer". If you choose to install a standard MSI package, see Section 2.3.4, "Installing MySQL on Microsoft Windows Using an MSI Package". If you choose to install a Noinstall archive, see Section 2.3.7, "Installing MySQL on Microsoft Windows Using a noinstall Zip Archive".

2.3.3. Installing MySQL on Microsoft Windows Using MySQL Installer

MySQL Installer is an application that simplifies the installation and updating process for a wide range of MySQL products, including MySQL Notifier for Microsoft Windows, MySQL Workbench, and MySQL for Excel. From this central application, you can see which MySQL products are already installed, configure them, and update or remove them if necessary. The installer can also install plugins, documentation, tutorials, and example databases. The MySQL Installer is only available for Microsoft Windows, and includes both a GUI and command-line interface.

Download MySQL Installer at http://dev.mysql.com/downloads/installer/

For release notes detailing the changes in each release of MySQL Installer, see MySQL Installer Release Notes.

MySQL Installer is compatible with pre-existing installations, and adds them to its list of installed components. And while the MySQL Installer is bundled with a specific version of MySQL Server, a single MySQL Installer instance can install and manage multiple MySQL Server versions. For example, a single MySQL Installer instance can install versions 5.1, 5.5, and 5.6. It can also manage both commercial and community versions of the MySQL Server.

MySQL Installer handles the initial configuration and setup of the applications. For example:

  1. It will create MySQL Server connections in MySQL Workbench.

  2. It creates the configuration file (my.ini) that is used to configure the MySQL Server.

  3. It imports example databases.

  4. It creates MySQL Server user accounts with configurable permissions based on general roles, such as DB Administrator, DB Designer, and Backup Admin. It optionally creates a Windows user named MysqlSys with limited privileges, which would then run the MySQL Server.

    This feature is only available during the initial installation of the MySQL Server, and not during future updates. User accounts may also be added with MySQL Workbench.

  5. If the "Advanced Configuration" option is checked, then the Logging Options are also configured. This includes defining file paths for the error log, general log, slow query log (including the configuration of seconds it requires to execute a query), and the binary log.

MySQL Installer can optionally check for updated components and download them for you automatically.

2.3.3.1. MySQL Installer GUI

After installation of the GUI version, the installer will have add its own Start Menu item under MySQL.

Note

Files that are generated by MySQL Installer grant full permissions to the user that executes MySQL Installer, including my.ini. This does not apply to files and directories for specific products such as the MySQL Server data directory in ProgramData, that is owned by SYSTEM.

After the installer itself has been installed and started, the following screen is displayed:

Figure 2.1. MySQL Installer - Welcome Screen

MySQL Installer - Welcome Screen

There are three main options:

  1. Install MySQL Products - The Installation Wizard.

  2. About MySQL - Learn about MySQL products and features.

  3. Resources - Information to help install and configure MySQL.

To Install MySQL Products after executing MySQL Installer for the first time, you must accept the license agreement before proceeding with the installation process.

Figure 2.2. MySQL Installer - License Agreement

MySQL Installer - License Agreement

If you are connected to the Internet, then the Installer will search for the latest MySQL components and add them to the installation bundle. Click Connect to the Internet to complete this step, or otherwise check the Skip checkbox and then Continue.

Figure 2.3. MySQL Installer - Find latest products

MySQL Installer - Find latest products

If you chose "Connect to the Internet," the next page will show the progress of MySQL Installer's search for available updates. When the search is complete (or if you opted to skip the search), you will be taken to the Choose Setup Type page:

Figure 2.4. MySQL Installer - Choose Setup Type

MySQL Installer - Choose Setup Type

Each type contains a description, so read the Setup Type Description to determine the option most compatible with your preferences.

The Installation and Data paths are also defined here, and a caution flag will notify you if the data path you define already exists.

After you select a setup type, the MySQL Installer will check your system for the necessary external requirements and download then install missing components onto your system.

Figure 2.5. MySQL Installer - Check Requirements

MySQL Installer - Check Requirements

The next window lists the MySQL components that are scheduled to be installed:

Figure 2.6. MySQL Installer - Installation Progress

MySQL Installer - Installation Progress

As components are installed, you'll see their status change from "to be installed" to "install success."

Figure 2.7. MySQL Installer - Installation Progress status

MySQL Installer - Installation Progress status

After all components are installed, the next step involves configuring the products. The Configuration Overview window displays the progress and then loads a configuration window if it is required.

Figure 2.8. MySQL Installer - Configuration Overview

MySQL Installer - Configuration Overview

The ideal MySQL Server configuration depends on your intended use, as explained in the next window. Choose the description that most closely applies to your machine.

You may enable TCP/IP Networking here as otherwise only localhost connections are allowed.

Checking the "Advanced Configuration" option provides additional Logging Options to configure. This includes defining file paths for the error log, general log, slow query log (including the configuration of seconds it requires to execute a query), and the binary log.

Figure 2.9. MySQL Installer - MySQL Server Configuration: Define platform, networking, andlogging options

MySQL Installer- MySQL Server Configuration: Define platform, networking, and logging options

Next, choose your account information. Defining a root password is required, whereas it's optional to create additional users. There are several different predefined user roles that each have different permission levels. For example, a "DB Admin" will have more privileges than a "DB Designer.".

Figure 2.10. MySQL Installer - MySQL Server Configuration: User accounts

MySQL Installer - MySQL Server Configuration: User accounts

Note

If the MySQL Server is already installed, then the Current Root Password will also be needed.

Next, configure the Windows Service Details. This includes the name, whether MySQL Server should be loaded at startup, and how the Windows Service for MySQL Server will be run. Choosing MysqlSys User will create a MySQL Windows user with limited privileges that will run the MySQL Server.

Figure 2.11. MySQL Installer - MySQL Server Configuration: Windows service details

MySQL Installer - MySQL Server Configuration: Windows service details

Note

When configuring Run Windows Services as ... using a Custom User, the custom user must have privileges to log on to Windows as a service. And the Next button will be disabled until this user is given these user rights.

On Microsoft Windows 7, this is configured by loading the Start Menu, Control Panel, Administrative Tools, Local Security Policy, Local Policies, User Rights Assignment, then Log On As A Service. Choose Add User or Group here to add the custom user, and then OK, OK to save.

The final configuration step is available if the Advanced Configuration option was checked, and it includes configuration options related to log file names:

Figure 2.12. MySQL Installer - MySQL Server Configuration: Logging options

MySQL Installer - MySQL Server Configuration: Logging options

After the MySQL Installer configuration process is completed, you may save the installation log, and then load MySQL Workbench if the Start MySQL Workbench after Setup option is checked:

Figure 2.13. MySQL Installer - Installation Complete

MySQL Installer - Installation Complete

You can now open MySQL Installer from the Microsoft Windows Start menu under the MySQL group, which will load the MySQL Installer Maintenance Screen. This is used to add, update, and remove features.

Figure 2.14. MySQL Installer - Maintenance Screen

MySQL Installer - Maintenance Screen

Note

An Update Screen screen is shown if MySQL Installer is used on a machine with older products installed, as opposed to the Maintenance Screen shown above. However, the functionality remains the same.

See also the MySQL Workbench documentation (http://dev.mysql.com/doc/workbench/en/).

2.3.3.2. MySQL Installer Console

MySQLInstallerConsole provides functionality similar to the GUI version of MySQL Installer, but from the command-line. It is installed when MySQL Installer is initially executed, and then available within the MySQL Installer directory. Typically that is in C:\Program Files (x86)\MySQL\MySQL Installer\, and the console must be executed with administrative privileges.

To use, invoke the Command Prompt with administrative privileges by choosing Start, Accessories, then right-click on Command Prompt and choose Run as administrator. And from the command-line, optionally change the directory to where MySQLInstallerConsole is located:

C:\> cd "C:\Program Files (x86)\MySQL\MySQL Installer"

MySQLInstallerConsole supports the following options, which are specified on the command line:

  • --help, -h, or -?

    Displays a help message with usage examples, and then exits.

    C:\> MySQLInstallerConsole --help
  • --updates (or -u)

    Checks for new products before any further action is taken. Disabled by default.

  • --nowait

    Skips the final pause when the program finishes. Otherwise, a "Press Enter to continue." dialogue is generated. It is used in conjunction with other options.

  • --catalog=catalog_name (or -c)

    Sets the default catalog. Use --list to view a list of available catalogs.

  • --type=installation_type (or -t)

    Sets the installation type.

    The possible values for installation_type are: developer, server, client, full, and custom.

  • --action=action_name

    The action being performed.

    The possible values are: install, remove, upgrade, list, and status.

    • install: Installs a product or products, as defined by --products

    • upgrade: Upgrades a product or products, as defined by --products.

    • remove: Removes a product or products, as defined by --products.

    • list: Lists the product manifest, both installed and available products.

    • status: Shows the status after another action is performed.

  • --product=product_name[:feature1],[feature2], [...] (or -p)

    Set the feature list of a product. Use --list to view available products, or pass in --product=* (an asterisk) to install all available products.

  • --config=product_name:passwd=root_password[;parameter1=value],[;parameter2=value], ...

    The configuration parameters for the most recently listed products.

  • --user=product_name:name=username,host:hostname,role=rolename,password=password or --user=product_name:name=username,host:hostname,role=rolename,tokens=tokens

    Creates a new user.

    Requires: name, host, role, and the password or tokens. Tokens are separated by pipe ("|") characters.

2.3.4. Installing MySQL on Microsoft Windows Using an MSI Package

The MSI package is designed to install and configure MySQL in such a way that you can immediately get started using MySQL.

The MySQL Installation Wizard and MySQL Configuration Wizard are available in the Complete install package, which is recommended for most standard MySQL installations. Exceptions include users who need to install multiple instances of MySQL on a single server host and advanced users who want complete control of server configuration.

The workflow sequence for using the installer is shown in the figure below:

Figure 2.15. Installation Workflow for Windows using MSI Installer


Note

Microsoft Windows XP and later include a firewall which specifically blocks ports. If you plan on using MySQL through a network port then you should open and create an exception for this port before performing the installation. To check and if necessary add an exception to the firewall settings:

  1. First ensure that you are logged in as an Administrator or a user with Administrator privileges.

  2. Go to the Control Panel, and double click the Windows Firewall icon.

  3. Choose the Allow a program through Windows Firewall option and click the Add port button.

  4. Enter MySQL into the Name text box and 3306 (or the port of your choice) into the Port number text box.

  5. Also ensure that the TCP protocol radio button is selected.

  6. If you wish, you can also limit access to the MySQL server by choosing the Change scope button.

  7. Confirm your choices by clicking the OK button.

Additionally, when running the MySQL Installation Wizard on Windows Vista or newer, ensure that you are logged in as a user with administrative rights.

Note

When using Windows Vista or newer, you may want to disable User Account Control (UAC) before performing the installation. If you do not do so, then MySQL may be identified as a security risk, which will mean that you need to enable MySQL. You can disable the security checking by following these instructions:

  1. Open Control Panel.

  2. Under the User Accounts and Family Safety, select Add or remove user accounts.

  3. Click the Got to the main User Accounts page link.

  4. Click on Turn User Account Control on or off. You may be prompted to provide permission to change this setting. Click Continue.

  5. Deselect or uncheck the check box next to Use User Account Control (UAC) to help protect your computer. Click OK to save the setting.

You will need to restart to complete the process. Click Restart Now to reboot the machine and apply the changes. You can then follow the instructions below for installing Windows.

2.3.4.1. Using the MySQL Installation Wizard

MySQL Installation Wizard is an installer for the MySQL server that uses the latest installer technologies for Microsoft Windows. The MySQL Installation Wizard, in combination with the MySQL Configuration Wizard, enables a user to install and configure a MySQL server that is ready for use immediately after installation.

The MySQL Installation Wizard is the standard installer for all MySQL server distributions, version 4.1.5 and higher. Users of previous versions of MySQL need to shut down and remove their existing MySQL installations manually before installing MySQL with the MySQL Installation Wizard. See Section 2.3.4.1.6, "Upgrading MySQL with the Installation Wizard", for more information on upgrading from a previous version.

Microsoft has included an improved version of their Microsoft Windows Installer (MSI) in the recent versions of Windows. MSI has become the de-facto standard for application installations on Windows 2000, Windows XP, and Windows Server 2003. The MySQL Installation Wizard makes use of this technology to provide a smoother and more flexible installation process.

The Microsoft Windows Installer Engine was updated with the release of Windows XP; those using a previous version of Windows can reference this Microsoft Knowledge Base article for information on upgrading to the latest version of the Windows Installer Engine.

In addition, Microsoft has introduced the WiX (Windows Installer XML) toolkit recently. This is the first highly acknowledged Open Source project from Microsoft. We have switched to WiX because it is an Open Source project and it enables us to handle the complete Windows installation process in a flexible manner using scripts.

Improving the MySQL Installation Wizard depends on the support and feedback of users like you. If you find that the MySQL Installation Wizard is lacking some feature important to you, or if you discover a bug, please report it in our bugs database using the instructions given in Section 1.7, "How to Report Bugs or Problems".

2.3.4.1.1. Downloading and Starting the MySQL Installation Wizard

The MySQL installation packages can be downloaded from http://dev.mysql.com/downloads/. If the package you download is contained within a Zip archive, you need to extract the archive first.

Note

If you are installing on Windows Vista or newer, it is best to open a network port before beginning the installation. To do this, first ensure that you are logged in as an Administrator, go to the Control Panel, and double-click the Windows Firewall icon. Choose the Allow a program through Windows Firewall option and click the Add port button. Enter MySQL into the Name text box and 3306 (or the port of your choice) into the Port number text box. Also ensure that the TCP protocol radio button is selected. If you wish, you can also limit access to the MySQL server by choosing the Change scope button. Confirm your choices by clicking the OK button. If you do not open a port prior to installation, you cannot configure the MySQL server immediately after installation. Additionally, when running the MySQL Installation Wizard on Windows Vista or newer, ensure that you are logged in as a user with administrative rights.

The process for starting the wizard depends on the contents of the installation package you download. If there is a setup.exe file present, double-click it to start the installation process. If there is an .msi file present, double-click it to start the installation process.

2.3.4.1.2. Choosing an Install Type

There are three installation types available: Typical, Complete, and Custom.

The Typical installation type installs the MySQL server, the mysql command-line client, and the command-line utilities. The command-line clients and utilities include mysqldump, myisamchk, and several other tools to help you manage the MySQL server.

The Complete installation type installs all components included in the installation package. The full installation package includes components such as the embedded server library, the benchmark suite, support scripts, and documentation.

The Custom installation type gives you complete control over which packages you wish to install and the installation path that is used. See Section 2.3.4.1.3, "The Custom Install Dialog", for more information on performing a custom install.

If you choose the Typical or Complete installation types and click the Next button, you advance to the confirmation screen to verify your choices and begin the installation. If you choose the Custom installation type and click the Next button, you advance to the custom installation dialog, described in Section 2.3.4.1.3, "The Custom Install Dialog".

2.3.4.1.3. The Custom Install Dialog

If you wish to change the installation path or the specific components that are installed by the MySQL Installation Wizard, choose the Custom installation type.

A tree view on the left side of the custom install dialog lists all available components. Components that are not installed have a red X icon; components that are installed have a gray icon. To change whether a component is installed, click that component's icon and choose a new option from the drop-down list that appears.

You can change the default installation path by clicking the Change... button to the right of the displayed installation path.

After choosing your installation components and installation path, click the Next button to advance to the confirmation dialog.

2.3.4.1.4. The Confirmation Dialog

Once you choose an installation type and optionally choose your installation components, you advance to the confirmation dialog. Your installation type and installation path are displayed for you to review.

To install MySQL if you are satisfied with your settings, click the Install button. To change your settings, click the Back button. To exit the MySQL Installation Wizard without installing MySQL, click the Cancel button.

The final screen of the installer provides a summary of the installation and gives you the option to launch the MySQL Configuration Wizard, which you can use to create a configuration file, install the MySQL service, and configure security settings.

2.3.4.1.5. Changes Made by MySQL Installation Wizard

Once you click the Install button, the MySQL Installation Wizard begins the installation process and makes certain changes to your system which are described in the sections that follow.

Changes to the Registry

The MySQL Installation Wizard creates one Windows registry key in a typical install situation, located in HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB.

The MySQL Installation Wizard creates a key named after the major version of the server that is being installed, such as MySQL Server 5.5. It contains two string values, Location and Version. The Location string contains the path to the installation directory. In a default installation it contains C:\Program Files\MySQL\MySQL Server 5.5\. The Version string contains the release number. For example, for an installation of MySQL Server 5.5.31, the key contains a value of 5.5.31.

These registry keys are used to help external tools identify the installed location of the MySQL server, preventing a complete scan of the hard-disk to determine the installation path of the MySQL server. The registry keys are not required to run the server, and if you install MySQL using the noinstall Zip archive, the registry keys are not created.

Changes to the Start Menu

The MySQL Installation Wizard creates a new entry in the Windows Start menu under a common MySQL menu heading named after the major version of MySQL that you have installed. For example, if you install MySQL 5.5, the MySQL Installation Wizard creates a MySQL Server 5.5 section in the Start menu.

The following entries are created within the new Start menu section:

  • MySQL Command Line Client: This is a shortcut to the mysql command-line client and is configured to connect as the root user. The shortcut prompts for a root user password when you connect.

  • MySQL Server Instance Config Wizard: This is a shortcut to the MySQL Configuration Wizard. Use this shortcut to configure a newly installed server, or to reconfigure an existing server.

  • MySQL Documentation: This is a link to the MySQL server documentation that is stored locally in the MySQL server installation directory.

Changes to the File System

The MySQL Installation Wizard by default installs the MySQL 5.5 server to C:\Program Files\MySQL\MySQL Server 5.5, where Program Files is the default location for applications in your system, and 5.5 is the major version of your MySQL server. This is the recommended location for the MySQL server, replacing the former default location C:\mysql.

By default, all MySQL applications are stored in a common directory at C:\Program Files\MySQL, where Program Files is the default location for applications in your Windows installation. A typical MySQL installation on a developer machine might look like this:

C:\Program Files\MySQL\MySQL Server 5.5C:\Program Files\MySQL\MySQL Workbench 5.1 OSS

This approach makes it easier to manage and maintain all MySQL applications installed on a particular system.

The default location of the data directory is the AppData directory configured for the user that installed the MySQL application.

2.3.4.1.6. Upgrading MySQL with the Installation Wizard

The MySQL Installation Wizard can perform server upgrades automatically using the upgrade capabilities of MSI. That means you do not need to remove a previous installation manually before installing a new release. The installer automatically shuts down and removes the previous MySQL service before installing the new version.

Automatic upgrades are available only when upgrading between installations that have the same major and minor version numbers. For example, you can upgrade automatically from MySQL 5.5.5 to MySQL 5.5.6, but not from MySQL 5.1 to MySQL 5.5.

See Section 2.3.9, "Upgrading MySQL on Windows".

2.3.4.2. Automating MySQL Installation on Microsoft Windows using the MSI Package

The Microsoft Installer (MSI) supports a both a quiet and a passive mode that can be used to install MySQL automatically without requiring intervention. You can use this either in scripts to automatically install MySQL or through a terminal connection such as Telnet where you do not have access to the standard Windows user interface. The MSI packages can also be used in combination with Microsoft's Group Policy system (part of Windows Server 2003 and Windows Server 2008) to install MySQL across multiple machines.

To install MySQL from one of the MSI packages automatically from the command line (or within a script), you need to use the msiexec.exe tool. For example, to perform a quiet installation (which shows no dialog boxes or progress):

shell> msiexec /i /quiet mysql-5.5.31.msi

The /i indicates that you want to perform an installation. The /quiet option indicates that you want no interactive elements.

To provide a dialog box showing the progress during installation, and the dialog boxes providing information on the installation and registration of MySQL, use /passive mode instead of /quiet:

shell> msiexec /i /passive mysql-5.5.31.msi

Regardless of the mode of the installation, installing the package in this manner performs a 'Typical' installation, and installs the default components into the standard location.

You can also use this method to uninstall MySQL by using the /uninstall or /x options:

shell> msiexec /x /quiet mysql-5.5.31.msi

To install MySQL and configure a MySQL instance from the command line, see Section 2.3.6.13, "MySQL Server Instance Config Wizard: Creating an Instance from the Command Line".

For information on using MSI packages to install software automatically using Group Policy, see How to use Group Policy to remotely install software in Windows Server 2003.

2.3.4.3. Removing MySQL When Installed from the MSI Package

To uninstall a MySQL where you have used the MSI packages, you must use the Add/Remove Programs tool within Control Panel. To do this:

  1. Right-click the start menu and choose Control Panel.

  2. If the Control Panel is set to category mode (you will see Pick a category at the top of the Control Panel window), double-click Add or Remove Programs. If the Control is set to classic mode, double-click the Add or Remove Programs icon.

  3. Find MySQL in the list of installed software. MySQL Server is installed against major version numbers (MySQL 5.1, MySQL 5.5, etc.). Select the version that you want to remove and click Remove.

  4. You will be prompted to confirm the removal. Click Yes to remove MySQL.

When MySQL is removed using this method, only the installed components are removed. Any database information (including the tables and data), import or export files, log files, and binary logs produced during execution are kept in their configured location.

If you try to install MySQL again the information will be retained and you will be prompted to enter the password configured with the original installation.

If you want to delete MySQL completely:

  • Delete the associated data directory. On Windows XP and Windows Server 2003, the default data directory is the configured AppData directory, which is C:\Documents and Settings\All Users\Application Data\MySQL by default.

  • On Windows 7 and Windows Server 2008, the default data directory location is C:\ProgramData\Mysql.

    Note

    The C:\ProgramData directory is hidden by default. You must change your folder options to view the hidden file. Choose Organize, Folder and search options, Show hidden folders.

2.3.5. MySQL Notifier for Microsoft Windows

The MySQL Notifier for Microsoft Windows is a tool that allows you to monitor and adjust the status of your local MySQL Server instances through an indicator that resides in the system tray. The MySQL Notifier for Microsoft Windows also gives quick access to several MySQL GUI tools (such as MySQL Workbench) through its context menu.

The MySQL Notifier for Microsoft Windows is installed by MySQL Installer, and (by default) will start-up when Microsoft Windows is started.

Note

To install, download and execute the MySQL Installer, be sure the MySQL Notifier for Microsoft Windows product is selected, then proceed with the installation. See the MySQL Installer manual for additional details.

For release notes detailing the changes in each release of MySQL Notifier for Microsoft Windows, see MySQL Notifier Release Notes.

Visit the MySQL Notifier forum for additional MySQL Notifier for Microsoft Windows help and support.

Features include:

  • Start, Stop, and Restart instances of the MySQL Server.

  • Automatically detects (and adds) new MySQL Server services. These are listed under Manage Services, and may also be configured.

  • The Tray icon changes, depending on the status. It's green if all monitored MySQL Server instances are running, or red if at least one service is stopped.

  • Links to other applications like MySQL Workbench, Windows Installer, and the MySQL Utilities. For example, choosing Configure Instance will load the MySQL Workbench Server Administration window for that particular instance.

  • If MySQL Workbench is also installed, then the Configure Instance and SQL Editor options are available.

The MySQL Notifier for Microsoft Windows resides in the system tray and provides visual status information for your MySQL Server instances. A green icon is displayed at the top left corner of the tray icon if the current MySQL Server is running, or a red icon if the service is stopped.

The MySQL Notifier for Microsoft Windows automatically adds discovered MySQL Services on the local machine, and each service is saved and configurable. By default, the Automatically add new services that match this pattern option is enabled and set to .*mysqld.*. Related Notifications Options include being notified when new services are either discovered or experience status changes, and are also enabled by default. And uninstalling a service will also remove the service from the MySQL Notifier for Microsoft Windows.

Clicking the system tray icon will reveal several options, as seen in the screenshots below:

The Service Instance menu is the main MySQL Notifier for Microsoft Windows window, and allows you to Stop, Start, and Restart the MySQL Server.

Figure 2.16. MySQL Notifier for Microsoft Windows Service Instance menu

MySQL Notifier for Microsoft Windows Service Instance menu

The Actions menu actions include several links to external applications (if they are installed).

Note

The main menu will not show the Actions menu when there are no services being monitored by MySQL Notifier for Microsoft Windows.

Figure 2.17. MySQL Notifier for Microsoft Windows Actions menu

MySQL Notifier for Microsoft Windows Actions menu

The Actions, Options menu configures MySQL Notifier for Microsoft Windows and includes options to:

  • Use colorful status icons: Enables a colorful style of icons for the tray of the MySQL Notifier for Microsoft Windows.

  • Run at Windows Startup: Allows the application to be loaded when Microsoft Windows starts.

  • Automatically Check For Updates Every # Weeks: Checks for a new version of MySQL Notifier for Microsoft Windows, and runs this check every # weeks.

  • Automatically add new services that match this pattern: A custom regular expression that filters the monitored services, and also filters the list of the Microsoft Windows services for the Add New Service dialog.

  • Notify me when a service is automatically added: Will display a notification from the taskbar when a newly discovered service is added to the monitored services list.

  • Notify me when a service changes status: Will display a notification from the taskbar when a monitored service changes its status.

Figure 2.18. MySQL Notifier for Microsoft Windows Options menu

MySQL Notifier for Microsoft Windows Options menu

The Actions, Manage Services menu allows you to configure the monitored services.

Figure 2.19. MySQL Notifier for Microsoft Windows Service Instance menu

MySQL Notifier for Microsoft Windows Manage Services menu

Adding a service (after clicking Add in the Manage Services window) allows you to select a running Microsoft Windows service, and configure MySQL Notifier for Microsoft Windows to monitor it. Add a new service by clicking service name from the list, then OK to accept. Multiple services may be selected.

Figure 2.20. MySQL Notifier for Microsoft Windows Adding a new services

MySQL Notifier for Microsoft Windows Adding new services

2.3.6. MySQL Server Instance Configuration Wizard

The MySQL Server Instance Configuration Wizard helps automate the process of configuring your server. It creates a custom MySQL configuration file (my.ini or my.cnf) by asking you a series of questions and then applying your responses to a template to generate the configuration file that is tuned to your installation.

The MySQL Server Instance Configuration Wizard is included with the MySQL 5.5 server. The MySQL Server Instance Configuration Wizard is only available for Windows.

2.3.6.1. Starting the MySQL Server Instance Configuration Wizard

The MySQL Server Instance Configuration Wizard is normally started as part of the installation process. You should only need to run the MySQL Server Instance Configuration Wizard again when you need to change the configuration parameters of your server.

If you chose not to open a port prior to installing MySQL on Windows Vista or newer, you can choose to use the MySQL Server Configuration Wizard after installation. However, you must open a port in the Windows Firewall. To do this see the instructions given in Section 2.3.4.1.1, "Downloading and Starting the MySQL Installation Wizard". Rather than opening a port, you also have the option of adding MySQL as a program that bypasses the Windows Firewall. One or the other option is sufficient-you need not do both. Additionally, when running the MySQL Server Configuration Wizard on Windows Vista or newer, ensure that you are logged in as a user with administrative rights.

MySQL Server Instance Configuration Wizard

You can launch the MySQL Configuration Wizard by clicking the MySQL Server Instance Config Wizard entry in the MySQL section of the Windows Start menu.

Alternatively, you can navigate to the bin directory of your MySQL installation and launch the MySQLInstanceConfig.exe file directly.

The MySQL Server Instance Configuration Wizard places the my.ini file in the installation directory for the MySQL server. This helps associate configuration files with particular server instances.

To ensure that the MySQL server knows where to look for the my.ini file, an argument similar to this is passed to the MySQL server as part of the service installation:

--defaults-file="C:\Program Files\MySQL\MySQL Server 5.5\my.ini"

Here, C:\Program Files\MySQL\MySQL Server 5.5 is replaced with the installation path to the MySQL Server. The --defaults-file option instructs the MySQL server to read the specified file for configuration options when it starts.

Apart from making changes to the my.ini file by running the MySQL Server Instance Configuration Wizard again, you can modify it by opening it with a text editor and making any necessary changes. You can also modify the server configuration with the http://www.mysql.com/products/administrator/ utility. For more information about server configuration, see Section 5.1.3, "Server Command Options".

MySQL clients and utilities such as the mysql and mysqldump command-line clients are not able to locate the my.ini file located in the server installation directory. To configure the client and utility applications, create a new my.ini file in the Windows installation directory (for example, C:\WINDOWS).

Under Windows Server 2003, Windows Server 2000, Windows XP, and Windows Vista, MySQL Server Instance Configuration Wizard will configure MySQL to work as a Windows service. To start and stop MySQL you use the Services application that is supplied as part of the Windows Administrator Tools.

2.3.6.2. Choosing a Maintenance Option

If the MySQL Server Instance Configuration Wizard detects an existing configuration file, you have the option of either reconfiguring your existing server, or removing the server instance by deleting the configuration file and stopping and removing the MySQL service.

To reconfigure an existing server, choose the Re-configure Instance option and click the Next button. Any existing configuration file is not overwritten, but renamed (within the same directory) using a timestamp (Windows) or sequential number (Linux). To remove the existing server instance, choose the Remove Instance option and click the Next button.

If you choose the Remove Instance option, you advance to a confirmation window. Click the Execute button. The MySQL Server Configuration Wizard stops and removes the MySQL service, and then deletes the configuration file. The server installation and its data folder are not removed.

If you choose the Re-configure Instance option, you advance to the Configuration Type dialog where you can choose the type of installation that you wish to configure.

2.3.6.3. Choosing a Configuration Type

When you start the MySQL Server Instance Configuration Wizard for a new MySQL installation, or choose the Re-configure Instance option for an existing installation, you advance to the Configuration Type dialog.

MySQL Server Instance Configuration Wizard: Configuration Type

There are two configuration types available: Detailed Configuration and Standard Configuration. The Standard Configuration option is intended for new users who want to get started with MySQL quickly without having to make many decisions about server configuration. The Detailed Configuration option is intended for advanced users who want more fine-grained control over server configuration.

If you are new to MySQL and need a server configured as a single-user developer machine, the Standard Configuration should suit your needs. Choosing the Standard Configuration option causes the MySQL Configuration Wizard to set all configuration options automatically with the exception of Service Options and Security Options.

The Standard Configuration sets options that may be incompatible with systems where there are existing MySQL installations. If you have an existing MySQL installation on your system in addition to the installation you wish to configure, the Detailed Configuration option is recommended.

To complete the Standard Configuration, please refer to the sections on Service Options and Security Options in Section 2.3.6.10, "The Service Options Dialog", and Section 2.3.6.11, "The Security Options Dialog", respectively.

2.3.6.4. The Server Type Dialog

There are three different server types available to choose from. The server type that you choose affects the decisions that the MySQL Server Instance Configuration Wizard makes with regard to memory, disk, and processor usage.

MySQL Server Instance Configuration Wizard: Server Type
  • Developer Machine: Choose this option for a typical desktop workstation where MySQL is intended only for personal use. It is assumed that many other desktop applications are running. The MySQL server is configured to use minimal system resources.

  • Server Machine: Choose this option for a server machine where the MySQL server is running alongside other server applications such as FTP, email, and Web servers. The MySQL server is configured to use a moderate portion of the system resources.

  • Dedicated MySQL Server Machine: Choose this option for a server machine that is intended to run only the MySQL server. It is assumed that no other applications are running. The MySQL server is configured to use all available system resources.

Note

By selecting one of the preconfigured configurations, the values and settings of various options in your my.cnf or my.ini will be altered accordingly. The default values and options as described in the reference manual may therefore be different to the options and values that were created during the execution of the configuration wizard.

2.3.6.5. The Database Usage Dialog

The Database Usage dialog enables you to indicate the storage engines that you expect to use when creating MySQL tables. The option you choose determines whether the InnoDB storage engine is available and what percentage of the server resources are available to InnoDB.

MySQL Server Instance Configuration Wizard: Usage Dialog
  • Multifunctional Database: This option enables both the InnoDB and MyISAM storage engines and divides resources evenly between the two. This option is recommended for users who use both storage engines on a regular basis.

  • Transactional Database Only: This option enables both the InnoDB and MyISAM storage engines, but dedicates most server resources to the InnoDB storage engine. This option is recommended for users who use InnoDB almost exclusively and make only minimal use of MyISAM.

  • Non-Transactional Database Only: This option disables the InnoDB storage engine completely and dedicates all server resources to the MyISAM storage engine. This option is recommended for users who do not use InnoDB.

The Configuration Wizard uses a template to generate the server configuration file. The Database Usage dialog sets one of the following option strings:

Multifunctional Database: MIXEDTransactional Database Only: INNODBNon-Transactional Database Only: MYISAM

When these options are processed through the default template (my-template.ini) the result is:

Multifunctional Database:default-storage-engine=InnoDB_myisam_pct=50Transactional Database Only:default-storage-engine=InnoDB_myisam_pct=5Non-Transactional Database Only:default-storage-engine=MyISAM_myisam_pct=100skip-innodb

The _myisam_pct value is used to calculate the percentage of resources dedicated to MyISAM. The remaining resources are allocated to InnoDB.

2.3.6.6. The InnoDB Tablespace Dialog

Some users may want to locate the InnoDB tablespace files in a different location than the MySQL server data directory. Placing the tablespace files in a separate location can be desirable if your system has a higher capacity or higher performance storage device available, such as a RAID storage system.

MySQL Server Instance Configuration Wizard: InnoDB Data Tablespace

To change the default location for the InnoDB tablespace files, choose a new drive from the drop-down list of drive letters and choose a new path from the drop-down list of paths. To create a custom path, click the ... button.

If you are modifying the configuration of an existing server, you must click the Modify button before you change the path. In this situation you must move the existing tablespace files to the new location manually before starting the server.

2.3.6.7. The Concurrent Connections Dialog

To prevent the server from running out of resources, it is important to limit the number of concurrent connections to the MySQL server that can be established. The Concurrent Connections dialog enables you to choose the expected usage of your server, and sets the limit for concurrent connections accordingly. It is also possible to set the concurrent connection limit manually.

MySQL Server Instance Configuration Wizard: Connections
  • Decision Support (DSS)/OLAP: Choose this option if your server does not require a large number of concurrent connections. The maximum number of connections is set at 100, with an average of 20 concurrent connections assumed.

  • Online Transaction Processing (OLTP): Choose this option if your server requires a large number of concurrent connections. The maximum number of connections is set at 500.

  • Manual Setting: Choose this option to set the maximum number of concurrent connections to the server manually. Choose the number of concurrent connections from the drop-down box provided, or enter the maximum number of connections into the drop-down box if the number you desire is not listed.

2.3.6.8. The Networking and Strict Mode Options Dialog

Use the Networking Options dialog to enable or disable TCP/IP networking and to configure the port number that is used to connect to the MySQL server.

MySQL Server Instance Configuration Wizard: Network Configuration

TCP/IP networking is enabled by default. To disable TCP/IP networking, uncheck the box next to the Enable TCP/IP Networking option.

Port 3306 is used by default. To change the port used to access MySQL, choose a new port number from the drop-down box or type a new port number directly into the drop-down box. If the port number you choose is in use, you are prompted to confirm your choice of port number.

Set the Server SQL Mode to either enable or disable strict mode. Enabling strict mode (default) makes MySQL behave more like other database management systems. If you run applications that rely on MySQL's old "forgiving" behavior, make sure to either adapt those applications or to disable strict mode. For more information about strict mode, see Section 5.1.7, "Server SQL Modes".

2.3.6.9. The Character Set Dialog

The MySQL server supports multiple character sets and it is possible to set a default server character set that is applied to all tables, columns, and databases unless overridden. Use the Character Set dialog to change the default character set of the MySQL server.

MySQL Server Instance Configuration Wizard: Character Set
  • Standard Character Set: Choose this option if you want to use latin1 as the default server character set. latin1 is used for English and many Western European languages.

  • Best Support For Multilingualism: Choose this option if you want to use utf8 as the default server character set. This is a Unicode character set that can store characters from many different languages.

  • Manual Selected Default Character Set / Collation: Choose this option if you want to pick the server's default character set manually. Choose the desired character set from the provided drop-down list.

2.3.6.10. The Service Options Dialog

On Windows platforms, the MySQL server can be installed as a Windows service. When installed this way, the MySQL server can be started automatically during system startup, and even restarted automatically by Windows in the event of a service failure.

The MySQL Server Instance Configuration Wizard installs the MySQL server as a service by default, using the service name MySQL. If you do not wish to install the service, uncheck the box next to the Install As Windows Service option. You can change the service name by picking a new service name from the drop-down box provided or by entering a new service name into the drop-down box.

Note

Service names can include any legal character except forward (/) or backward (\) slashes, and must be less than 256 characters long.

Warning

If you are installing multiple versions of MySQL onto the same machine, you must choose a different service name for each version that you install. If you do not choose a different service for each installed version then the service manager information will be inconsistent and this will cause problems when you try to uninstall a previous version.

If you have already installed multiple versions using the same service name, you must manually edit the contents of the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services parameters within the Windows registry to update the association of the service name with the correct server version.

Typically, when installing multiple versions you create a service name based on the version information. For example, you might install MySQL 5.x as mysql5, or specific versions such as MySQL 5.5.0 as mysql50500.

To install the MySQL server as a service but not have it started automatically at startup, uncheck the box next to the Launch the MySQL Server Automatically option.

2.3.6.11. The Security Options Dialog

The content of the security options portion of the MySQL Server Instance Configuration Wizard will depend on whether this is a new installation, or modifying an existing installation.

  • Setting the root password for a new installation

    It is strongly recommended that you set a root password for your MySQL server, and the MySQL Server Instance Config Wizard requires by default that you do so. If you do not wish to set a root password, uncheck the box next to the Modify Security Settings option.

    MySQL Server Instance Config Wizard: Security
  • To set the root password, enter the desired password into both the New root password and Confirm boxes.

    Setting the root password for an existing installation

    If you are modifying the configuration of an existing configuration, or you are installing an upgrade and the MySQL Server Instance Configuration Wizard has detected an existing MySQL system, then you must enter the existing password for root before changing the configuration information.

    MySQL Server Instance Config Wizard: Security (Existing Installation)

    If you want to change the current root password, enter the desired new password into both the New root password and Confirm boxes.

To permit root logins from across the network, check the box next to the Enable root access from remote machines option. This decreases the security of your root account.

To create an anonymous user account, check the box next to the Create An Anonymous Account option. Creating an anonymous account can decrease server security and cause login and permission difficulties. For this reason, it is not recommended.

2.3.6.12. The Confirmation Dialog

The final dialog in the MySQL Server Instance Configuration Wizard is the Confirmation Dialog. To start the configuration process, click the Execute button. To return to a previous dialog, click the Back button. To exit the MySQL Server Instance Configuration Wizard without configuring the server, click the Cancel button.

MySQL Server Instance Configuration Wizard: Confirmation

After you click the Execute button, the MySQL Server Instance Configuration Wizard performs a series of tasks and displays the progress onscreen as the tasks are performed.

The MySQL Server Instance Configuration Wizard first determines configuration file options based on your choices using a template prepared by MySQL developers and engineers. This template is named my-template.ini and is located in your server installation directory.

The MySQL Configuration Wizard then writes these options to the corresponding configuration file.

If you chose to create a service for the MySQL server, the MySQL Server Instance Configuration Wizard creates and starts the service. If you are reconfiguring an existing service, the MySQL Server Instance Configuration Wizard restarts the service to apply your configuration changes.

If you chose to set a root password, the MySQL Configuration Wizard connects to the server, sets your new root password, and applies any other security settings you may have selected.

After the MySQL Server Instance Configuration Wizard has completed its tasks, it displays a summary. Click the Finish button to exit the MySQL Server Configuration Wizard.

2.3.6.13. MySQL Server Instance Config Wizard: Creating an Instance from theCommand Line

In addition to using the GUI interface to the MySQL Server Instance Config Wizard, you can also create instances automatically from the command line.

To use the MySQL Server Instance Config Wizard on the command line, you need to use the MySQLInstanceConfig.exe command that is installed with MySQL in the bin directory within the installation directory. MySQLInstanceConfig.exe takes a number of command-line arguments the set the properties that would normally be selected through the GUI interface, and then creates a new configuration file (my.ini) by combining these selections with a template configuration file to produce the working configuration file.

The main command line options are provided in the table below. Some of the options are required, while some options are optional.

Table 2.4. MySQL Server Instance Config Wizard Command Line Options

OptionDescription
Required Parameters
-nPRODUCTNAMEThe name of the instance when installed
-pPATHPath of the base directory for installation. This is equivalent to the directory when using the basedir configuration parameter
-vVERSIONThe version tag to use for this installation
Action to Perform
-iInstall an instance
-rRemove an instance
-sStop an existing instance
-qPerform the operation quietly
-lFILENAMESae the installation progress in a logfile
Config File to Use
-tFILENAMEPath to the template config file that will be used to generate theinstalled configuration file
-cFILENAMEPath to a config file to be generated

The -t and -c options work together to set the configuration parameters for a new instance. The -t option specifies the template configuration file to use as the basic configuration, which are then merged with the configuration parameters generated by the MySQL Server Instance Config Wizard into the configuration file specified by the -c option.

A sample template file, my-template.ini is provided in the toplevel MySQL installation directory. The file contains elements are replaced automatically by the MySQL Server Instance Config Wizard during configuration.

If you specify a configuration file that already exists, the existing configuration file will be saved in the file with the original, with the date and time added. For example, the mysql.ini will be copied to mysql 2009-10-27 1646.ini.bak.

The parameters that you can specify on the command line are listed in the table below.

Table 2.5. MySQL Server Instance Config Wizard Parameters

ParameterDescription
ServiceName=$Specify the name of the service to be created
AddBinToPath={yes | no}Specifies whether to add the binary directory of MySQL to the standard PATH environment variable
ServerType={DEVELOPMENT | SERVER | DEDICATED}Specify the server type. For more information, see Section 2.3.6.4, "The Server Type Dialog"
DatabaseType={MIXED | INNODB | MYISAM}Specify the default database type. For more information, see Section 2.3.6.5, "The Database Usage Dialog"
ConnectionUsage={DSS | OLTP}Specify the type of connection support, this automates the setting for the number of concurrent connections (see the ConnectionCount parameter). For more information, see Section 2.3.6.7, "The Concurrent Connections Dialog"
ConnectionCount=#Specify the number of concurrent connections to support. For more information, see Section 2.3.6.4, "The Server Type Dialog"
SkipNetworking={yes | no}Specify whether network support should be supported. Specifying yes disables network access altogether
Port=#Specify the network port number to use for network connections. For more information, see Section 2.3.6.8, "The Networking and Strict Mode Options Dialog"
StrictMode={yes | no}Specify whether to use the strict SQL mode. For more information, see Section 2.3.6.8, "The Networking and Strict Mode Options Dialog"
Charset=$Specify the default character set. For more information, see Section 2.3.6.9, "The Character Set Dialog"
RootPassword=$Specify the root password
RootCurrentPassword=$Specify the current root password then stopping or reconfiguring anexisting service

Note

When specifying options on the command line, you can enclose the entire command-line option and the value you are specifying using double quotation marks. This enables you to use spaces in the options. For example, "-cC:\mysql.ini".

The following command installs a MySQL Server 5.5 instance from the directory C:\Program Files\MySQL\MySQL Server 5.5 using the service name MySQL55 and setting the root password to 1234.

shell> MySQLInstanceConfig.exe -i -q "-lC:\mysql_install_log.txt" »   "-nMySQL Server 5.5" "-pC:\Program Files\MySQL\MySQL Server 5.5" -v5.5.31 »   "-tmy-template.ini" "-cC:\mytest.ini" ServerType=DEVELOPMENT DatabaseType=MIXED »   ConnectionUsage=DSS Port=3311 ServiceName=MySQL55 RootPassword=1234

In the above example, a log file will be generated in mysql_install_log.txt containing the information about the instance creation process. The log file generated by the above example is shown below:

Welcome to the MySQL Server Instance Configuration Wizard 1.0.16.0Date: 2009-10-27 17:07:21Installing service ...Product Name: MySQL Server 5.5Version:  5.5.31Installation Path: C:\Program Files\MySQL\MySQL Server 5.5\Creating configuration file C:\mytest.ini using template my-template.ini.Options:DEVELOPMENTMIXEDDSSSTRICTMODEVariables:port: 3311default-character-set: latin1basedir: "C:/Program Files/MySQL/MySQL Server 5.5/"datadir: "C:/Program Files/MySQL/MySQL Server 5.5/Data/"Creating Windows service entry.Service name: "MySQL55"Parameters:   "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --defaults-file="C:\mytest.ini" MySQL55.Windows service MySQL55 installed.

When using the command line, the return values in the following table indicate an error performing the specified option.

Table 2.6. Return Value from MySQL Server Instance Config Wizard

ValueDescription
2Configuration template file cannot be found
3The Windows service entry cannot be created
4Could not connect to the Service Control Manager
5The MySQL service cannot be started
6The MySQL service cannot be stopped
7The security settings cannot be applied
8The configuration file cannot be written
9The Windows service entry cannot be removed

You can perform an installation of MySQL automatically using the MSI package. For more information, see Section 2.3.4.2, "Automating MySQL Installation on Microsoft Windows using the MSI Package".

2.3.7. Installing MySQL on Microsoft Windows Using anoinstall Zip Archive

Users who are installing from the Noinstall package can use the instructions in this section to manually install MySQL. The process for installing MySQL from a Zip archive is as follows:

  1. Extract the archive to the desired install directory

  2. Create an option file

  3. Choose a MySQL server type

  4. Start the MySQL server

  5. Secure the default user accounts

This process is described in the sections that follow.

2.3.7.1. Extracting the Install Archive

To install MySQL manually, do the following:

  1. If you are upgrading from a previous version please refer to Section 2.3.9, "Upgrading MySQL on Windows", before beginning the upgrade process.

  2. Make sure that you are logged in as a user with administrator privileges.

  3. Choose an installation location. Traditionally, the MySQL server is installed in C:\mysql. The MySQL Installation Wizard installs MySQL under C:\Program Files\MySQL. If you do not install MySQL at C:\mysql, you must specify the path to the install directory during startup or in an option file. See Section 2.3.7.2, "Creating an Option File".

  4. Extract the install archive to the chosen installation location using your preferred Zip archive tool. Some tools may extract the archive to a folder within your chosen installation location. If this occurs, you can move the contents of the subfolder into the chosen installation location.

2.3.7.2. Creating an Option File

If you need to specify startup options when you run the server, you can indicate them on the command line or place them in an option file. For options that are used every time the server starts, you may find it most convenient to use an option file to specify your MySQL configuration. This is particularly true under the following circumstances:

  • The installation or data directory locations are different from the default locations (C:\Program Files\MySQL\MySQL Server 5.5 and C:\Program Files\MySQL\MySQL Server 5.5\data).

  • You need to tune the server settings, such as memory, cache, or InnoDB configuration information.

When the MySQL server starts on Windows, it looks for option files in several locations, such as the Windows directory, C:\, and the MySQL installation directory (for the full list of locations, see Section 4.2.3.3, "Using Option Files"). The Windows directory typically is named something like C:\WINDOWS. You can determine its exact location from the value of the WINDIR environment variable using the following command:

C:\> echo %WINDIR%

MySQL looks for options in each location first in the my.ini file, and then in the my.cnf file. However, to avoid confusion, it is best if you use only one file. If your PC uses a boot loader where C: is not the boot drive, your only option is to use the my.ini file. Whichever option file you use, it must be a plain text file.

Note

When using the MySQL Installer to install MySQL Server, it will create the my.ini at the default location. And as of MySQL Server 5.5.27, the user running MySQL Installer is granted full permissions to this new my.ini.

In other words, be sure that the MySQL Server user has permission to read the my.ini file.

You can also make use of the example option files included with your MySQL distribution; see Section 5.1.2, "Server Configuration Defaults".

An option file can be created and modified with any text editor, such as Notepad. For example, if MySQL is installed in E:\mysql and the data directory is in E:\mydata\data, you can create an option file containing a [mysqld] section to specify values for the basedir and datadir options:

[mysqld]# set basedir to your installation pathbasedir=E:/mysql# set datadir to the location of your data directorydatadir=E:/mydata/data

Note that Windows path names are specified in option files using (forward) slashes rather than backslashes. If you do use backslashes, double them:

[mysqld]# set basedir to your installation pathbasedir=E:\\mysql# set datadir to the location of your data directorydatadir=E:\\mydata\\data

The rules for use of backslash in option file values are given in Section 4.2.3.3, "Using Option Files".

The data directory is located within the AppData directory for the user running MySQL.

If you would like to use a data directory in a different location, you should copy the entire contents of the data directory to the new location. For example, if you want to use E:\mydata as the data directory instead, you must do two things:

  1. Move the entire data directory and all of its contents from the default location (for example C:\Program Files\MySQL\MySQL Server 5.5\data) to E:\mydata.

  2. Use a --datadir option to specify the new data directory location each time you start the server.

2.3.7.3. Selecting a MySQL Server Type

The following table shows the available servers for Windows in MySQL 5.5.

BinaryDescription
mysqldOptimized binary with named-pipe support
mysqld-debugLike mysqld, but compiled with full debugging andautomatic memory allocation checking

All of the preceding binaries are optimized for modern Intel processors, but should work on any Intel i386-class or higher processor.

Each of the servers in a distribution support the same set of storage engines. The SHOW ENGINES statement displays which engines a given server supports.

All Windows MySQL 5.5 servers have support for symbolic linking of database directories.

MySQL supports TCP/IP on all Windows platforms. MySQL servers on Windows support named pipes as indicated in the following list. However, the default is to use TCP/IP regardless of platform. (Named pipes are slower than TCP/IP in many Windows configurations.)

Named pipes are enabled only if you start the server with the --enable-named-pipe option. It is necessary to use this option explicitly because some users have experienced problems with shutting down the MySQL server when named pipes were used.

2.3.7.4. Starting the Server for the First Time

This section gives a general overview of starting the MySQL server. The following sections provide more specific information for starting the MySQL server from the command line or as a Windows service.

The information here applies primarily if you installed MySQL using the Noinstall version, or if you wish to configure and test MySQL manually rather than with the GUI tools.

The examples in these sections assume that MySQL is installed under the default location of C:\Program Files\MySQL\MySQL Server 5.5. Adjust the path names shown in the examples if you have MySQL installed in a different location.

Clients have two options. They can use TCP/IP, or they can use a named pipe if the server supports named-pipe connections.

MySQL for Windows also supports shared-memory connections if the server is started with the --shared-memory option. Clients can connect through shared memory by using the --protocol=MEMORY option.

For information about which server binary to run, see Section 2.3.7.3, "Selecting a MySQL Server Type".

Testing is best done from a command prompt in a console window (or "DOS window"). In this way you can have the server display status messages in the window where they are easy to see. If something is wrong with your configuration, these messages make it easier for you to identify and fix any problems.

To start the server, enter this command:

C:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --console

For a server that includes InnoDB support, you should see the messages similar to those following as it starts (the path names and sizes may differ):

InnoDB: The first specified datafile c:\ibdata\ibdata1 did not exist:InnoDB: a new database to be created!InnoDB: Setting file c:\ibdata\ibdata1 size to 209715200InnoDB: Database physically writes the file full: wait...InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be createdInnoDB: Setting log file c:\iblogs\ib_logfile0 size to 31457280InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be createdInnoDB: Setting log file c:\iblogs\ib_logfile1 size to 31457280InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be createdInnoDB: Setting log file c:\iblogs\ib_logfile2 size to 31457280InnoDB: Doublewrite buffer not found: creating newInnoDB: Doublewrite buffer createdInnoDB: creating foreign key constraint system tablesInnoDB: foreign key constraint system tables created011024 10:58:25  InnoDB: Started

When the server finishes its startup sequence, you should see something like this, which indicates that the server is ready to service client connections:

mysqld: ready for connectionsVersion: '5.5.31'  socket: ''  port: 3306

The server continues to write to the console any further diagnostic output it produces. You can open a new console window in which to run client programs.

If you omit the --console option, the server writes diagnostic output to the error log in the data directory (C:\Program Files\MySQL\MySQL Server 5.5\data by default). The error log is the file with the .err extension, or may be specified by passing in the --log-error option.

Note

The accounts that are listed in the MySQL grant tables initially have no passwords. After starting the server, you should set up passwords for them using the instructions in Section 2.11, "Postinstallation Setup and Testing".

2.3.7.5. Starting MySQL from the Windows Command Line

The MySQL server can be started manually from the command line. This can be done on any version of Windows.

To start the mysqld server from the command line, you should start a console window (or "DOS window") and enter this command:

C:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld"

The path to mysqld may vary depending on the install location of MySQL on your system.

You can stop the MySQL server by executing this command:

C:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqladmin" -u root shutdown
Note

If the MySQL root user account has a password, you need to invoke mysqladmin with the -p option and supply the password when prompted.

This command invokes the MySQL administrative utility mysqladmin to connect to the server and tell it to shut down. The command connects as the MySQL root user, which is the default administrative account in the MySQL grant system. Note that users in the MySQL grant system are wholly independent from any login users under Windows.

If mysqld doesn't start, check the error log to see whether the server wrote any messages there to indicate the cause of the problem. By default, the error log is located in the C:\Program Files\MySQL\MySQL Server 5.5\data directory. It is the file with a suffix of .err, or may be specified by passing in the --log-error option. Alternatively, you can try to start the server as mysqld --console; in this case, you may get some useful information on the screen that may help solve the problem.

The last option is to start mysqld with the --standalone and --debug options. In this case, mysqld writes a log file C:\mysqld.trace that should contain the reason why mysqld doesn't start. See MySQL Internals: Porting to Other Systems.

Use mysqld --verbose --help to display all the options that mysqld supports.

2.3.7.6. Customizing the PATH for MySQL Tools

To make it easier to invoke MySQL programs, you can add the path name of the MySQL bin directory to your Windows system PATH environment variable:

  • On the Windows desktop, right-click the My Computer icon, and select Properties.

  • Next select the Advanced tab from the System Properties menu that appears, and click the Environment Variables button.

  • Under System Variables, select Path, and then click the Edit button. The Edit System Variable dialogue should appear.

  • Place your cursor at the end of the text appearing in the space marked Variable Value. (Use the End key to ensure that your cursor is positioned at the very end of the text in this space.) Then enter the complete path name of your MySQL bin directory (for example, C:\Program Files\MySQL\MySQL Server 5.5\bin)

    Note

    There must be a semicolon separating this path from any values present in this field.

    Dismiss this dialogue, and each dialogue in turn, by clicking OK until all of the dialogues that were opened have been dismissed. You should now be able to invoke any MySQL executable program by typing its name at the DOS prompt from any directory on the system, without having to supply the path. This includes the servers, the mysql client, and all MySQL command-line utilities such as mysqladmin and mysqldump.

    You should not add the MySQL bin directory to your Windows PATH if you are running multiple MySQL servers on the same machine.

Warning

You must exercise great care when editing your system PATH by hand; accidental deletion or modification of any portion of the existing PATH value can leave you with a malfunctioning or even unusable system.

2.3.7.7. Starting MySQL as a Windows Service

On Windows, the recommended way to run MySQL is to install it as a Windows service, whereby MySQL starts and stops automatically when Windows starts and stops. A MySQL server installed as a service can also be controlled from the command line using NET commands, or with the graphical Services utility. Generally, to install MySQL as a Windows service you should be logged in using an account that has administrator rights.

The Services utility (the Windows Service Control Manager) can be found in the Windows Control Panel (under Administrative Tools on Windows 2000, XP, Vista, and Server 2003). To avoid conflicts, it is advisable to close the Services utility while performing server installation or removal operations from the command line.

Before installing MySQL as a Windows service, you should first stop the current server if it is running by using the following command:

C:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqladmin"  -u root shutdown
Note

If the MySQL root user account has a password, you need to invoke mysqladmin with the -p option and supply the password when prompted.

This command invokes the MySQL administrative utility mysqladmin to connect to the server and tell it to shut down. The command connects as the MySQL root user, which is the default administrative account in the MySQL grant system. Note that users in the MySQL grant system are wholly independent from any login users under Windows.

Install the server as a service using this command:

C:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --install

The service-installation command does not start the server. Instructions for that are given later in this section.

To make it easier to invoke MySQL programs, you can add the path name of the MySQL bin directory to your Windows system PATH environment variable:

  • On the Windows desktop, right-click the My Computer icon, and select Properties.

  • Next select the Advanced tab from the System Properties menu that appears, and click the Environment Variables button.

  • Under System Variables, select Path, and then click the Edit button. The Edit System Variable dialogue should appear.

  • Place your cursor at the end of the text appearing in the space marked Variable Value. (Use the End key to ensure that your cursor is positioned at the very end of the text in this space.) Then enter the complete path name of your MySQL bin directory (for example, C:\Program Files\MySQL\MySQL Server 5.5\bin), Note that there should be a semicolon separating this path from any values present in this field. Dismiss this dialogue, and each dialogue in turn, by clicking OK until all of the dialogues that were opened have been dismissed. You should now be able to invoke any MySQL executable program by typing its name at the DOS prompt from any directory on the system, without having to supply the path. This includes the servers, the mysql client, and all MySQL command-line utilities such as mysqladmin and mysqldump.

    You should not add the MySQL bin directory to your Windows PATH if you are running multiple MySQL servers on the same machine.

Warning

You must exercise great care when editing your system PATH by hand; accidental deletion or modification of any portion of the existing PATH value can leave you with a malfunctioning or even unusable system.

The following additional arguments can be used when installing the service:

  • You can specify a service name immediately following the --install option. The default service name is MySQL.

  • If a service name is given, it can be followed by a single option. By convention, this should be --defaults-file=file_name to specify the name of an option file from which the server should read options when it starts.

    The use of a single option other than --defaults-file is possible but discouraged. --defaults-file is more flexible because it enables you to specify multiple startup options for the server by placing them in the named option file.

  • You can also specify a --local-service option following the service name. This causes the server to run using the LocalService Windows account that has limited system privileges. This account is available only for Windows XP or newer. If both --defaults-file and --local-service are given following the service name, they can be in any order.

For a MySQL server that is installed as a Windows service, the following rules determine the service name and option files that the server uses:

  • If the service-installation command specifies no service name or the default service name (MySQL) following the --install option, the server uses the a service name of MySQL and reads options from the [mysqld] group in the standard option files.

  • If the service-installation command specifies a service name other than MySQL following the --install option, the server uses that service name. It reads options from the [mysqld] group and the group that has the same name as the service in the standard option files. This enables you to use the [mysqld] group for options that should be used by all MySQL services, and an option group with the service name for use by the server installed with that service name.

  • If the service-installation command specifies a --defaults-file option after the service name, the server reads options the same way as described in the previous item, except that it reads options only from the the named file and ignores the standard option files.

As a more complex example, consider the following command:

C:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld"  --install MySQL --defaults-file=C:\my-opts.cnf

Here, the default service name (MySQL) is given after the --install option. If no --defaults-file option had been given, this command would have the effect of causing the server to read the [mysqld] group from the standard option files. However, because the --defaults-file option is present, the server reads options from the [mysqld] option group, and only from the named file.

You can also specify options as Start parameters in the Windows Services utility before you start the MySQL service.

Once a MySQL server has been installed as a service, Windows starts the service automatically whenever Windows starts. The service also can be started immediately from the Services utility, or by using a NET START MySQL command. The NET command is not case sensitive.

When run as a service, mysqld has no access to a console window, so no messages can be seen there. If mysqld does not start, check the error log to see whether the server wrote any messages there to indicate the cause of the problem. The error log is located in the MySQL data directory (for example, C:\Program Files\MySQL\MySQL Server 5.5\data). It is the file with a suffix of .err.

When a MySQL server has been installed as a service, and the service is running, Windows stops the service automatically when Windows shuts down. The server also can be stopped manually by using the Services utility, the NET STOP MySQL command, or the mysqladmin shutdown command.

You also have the choice of installing the server as a manual service if you do not wish for the service to be started automatically during the boot process. To do this, use the --install-manual option rather than the --install option:

C:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --install-manual

To remove a server that is installed as a service, first stop it if it is running by executing NET STOP MySQL. Then use the --remove option to remove it:

C:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --remove

If mysqld is not running as a service, you can start it from the command line. For instructions, see Section 2.3.7.5, "Starting MySQL from the Windows Command Line".

Please see Section 2.3.8, "Troubleshooting a Microsoft Windows MySQL Server Installation", if you encounter difficulties during installation.

2.3.7.8. Testing The MySQL Installation

You can test whether the MySQL server is working by executing any of the following commands:

C:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqlshow"C:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqlshow" -u root mysqlC:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqladmin" version status procC:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysql" test

If mysqld is slow to respond to TCP/IP connections from client programs, there is probably a problem with your DNS. In this case, start mysqld with the --skip-name-resolve option and use only localhost and IP addresses in the Host column of the MySQL grant tables.

You can force a MySQL client to use a named-pipe connection rather than TCP/IP by specifying the --pipe or --protocol=PIPE option, or by specifying . (period) as the host name. Use the --socket option to specify the name of the pipe if you do not want to use the default pipe name.

Note that if you have set a password for the root account, deleted the anonymous account, or created a new user account, then you must use the appropriate -u and -p options with the commands shown above to connect with the MySQL Server. See Section 4.2.2, "Connecting to the MySQL Server".

For more information about mysqlshow, see Section 4.5.6, "mysqlshow - Display Database, Table, and Column Information".

2.3.8. Troubleshooting a Microsoft Windows MySQL Server Installation

When installing and running MySQL for the first time, you may encounter certain errors that prevent the MySQL server from starting. The purpose of this section is to help you diagnose and correct some of these errors.

Your first resource when troubleshooting server issues is the error log. The MySQL server uses the error log to record information relevant to the error that prevents the server from starting. The error log is located in the data directory specified in your my.ini file. The default data directory location is C:\Program Files\MySQL\MySQL Server 5.5\data, or C:\ProgramData\Mysql on Windows 7 and Windows Server 2008. The C:\ProgramData directory is hidden by default. You need to change your folder options to see the directory and contents. For more information on the error log and understanding the content, see Section 5.2.2, "The Error Log".

Another source of information regarding possible errors is the console messages displayed when the MySQL service is starting. Use the NET START MySQL command from the command line after installing mysqld as a service to see any error messages regarding the starting of the MySQL server as a service. See Section 2.3.7.7, "Starting MySQL as a Windows Service".

The following examples show other common error messages you may encounter when installing MySQL and starting the server for the first time:

  • If the MySQL server cannot find the mysql privileges database or other critical files, you may see these messages:

    System error 1067 has occurred.Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't exist

    These messages often occur when the MySQL base or data directories are installed in different locations than the default locations (C:\Program Files\MySQL\MySQL Server 5.5 and C:\Program Files\MySQL\MySQL Server 5.5\data, respectively).

    This situation may occur when MySQL is upgraded and installed to a new location, but the configuration file is not updated to reflect the new location. In addition, there may be old and new configuration files that conflict. Be sure to delete or rename any old configuration files when upgrading MySQL.

    If you have installed MySQL to a directory other than C:\Program Files\MySQL\MySQL Server 5.5, you need to ensure that the MySQL server is aware of this through the use of a configuration (my.ini) file. The my.ini file needs to be located in your Windows directory, typically C:\WINDOWS. You can determine its exact location from the value of the WINDIR environment variable by issuing the following command from the command prompt:

    C:\> echo %WINDIR%

    An option file can be created and modified with any text editor, such as Notepad. For example, if MySQL is installed in E:\mysql and the data directory is D:\MySQLdata, you can create the option file and set up a [mysqld] section to specify values for the basedir and datadir options:

    [mysqld]# set basedir to your installation pathbasedir=E:/mysql# set datadir to the location of your data directorydatadir=D:/MySQLdata

    Note that Windows path names are specified in option files using (forward) slashes rather than backslashes. If you do use backslashes, double them:

    [mysqld]# set basedir to your installation pathbasedir=C:\\Program Files\\MySQL\\MySQL Server 5.5# set datadir to the location of your data directorydatadir=D:\\MySQLdata

    The rules for use of backslash in option file values are given in Section 4.2.3.3, "Using Option Files".

    If you change the datadir value in your MySQL configuration file, you must move the contents of the existing MySQL data directory before restarting the MySQL server.

    See Section 2.3.7.2, "Creating an Option File".

  • If you reinstall or upgrade MySQL without first stopping and removing the existing MySQL service and install MySQL using the MySQL Configuration Wizard, you may see this error:

    Error: Cannot create Windows service for MySql. Error: 0

    This occurs when the Configuration Wizard tries to install the service and finds an existing service with the same name.

    One solution to this problem is to choose a service name other than mysql when using the configuration wizard. This enables the new service to be installed correctly, but leaves the outdated service in place. Although this is harmless, it is best to remove old services that are no longer in use.

    To permanently remove the old mysql service, execute the following command as a user with administrative privileges, on the command-line:

    C:\> sc delete mysql[SC] DeleteService SUCCESS

    If the sc utility is not available for your version of Windows, download the delsrv utility from http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/delsrv-o.asp and use the delsrv mysql syntax.

2.3.9. Upgrading MySQL on Windows

This section lists some of the steps you should take when upgrading MySQL on Windows.

  1. Review Section 2.12.1, "Upgrading MySQL", for additional information on upgrading MySQL that is not specific to Windows.

  2. You should always back up your current MySQL installation before performing an upgrade. See Section 7.2, "Database Backup Methods".

  3. Download the latest Windows distribution of MySQL from http://dev.mysql.com/downloads/.

  4. Before upgrading MySQL, you must stop the server. If the server is installed as a service, stop the service with the following command from the command prompt:

    C:\> NET STOP MySQL

    If you are not running the MySQL server as a service, use mysqladmin to stop it. For example, before upgrading from MySQL 5.1 to 5.5, use mysqladmin from MySQL 5.1 as follows:

    C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root shutdown
    Note

    If the MySQL root user account has a password, you need to invoke mysqladmin with the -p option and supply the password when prompted.

  5. Before upgrading a MySQL service from MySQL 5.1 to 5.5, you should stop the 5.1 server and remove the instance. Run the MySQL Instance Configuration Wizard, choose the Remove Instance option and in the next screen, confirm removal. After that it is safe to uninstall MySQL Server 5.1.

  6. Before upgrading to MySQL 5.5 from a version previous to 4.1.5, or from a version of MySQL installed from a Zip archive to a version of MySQL installed with the MySQL Installation Wizard, you must first manually remove the previous installation and MySQL service (if the server is installed as a service).

    To remove the MySQL service, use the following command:

    C:\> C:\mysql\bin\mysqld --remove

    If you do not remove the existing service, the MySQL Installation Wizard may fail to properly install the new MySQL service.

  7. If you are using the MySQL Installation Wizard, start the wizard as described in Section 2.3.4.1, "Using the MySQL Installation Wizard".

  8. If you are installing MySQL from a Zip archive, extract the archive. You may either overwrite your existing MySQL installation (usually located at C:\mysql), or install it into a different directory, such as C:\mysql5. Overwriting the existing installation is recommended.

  9. If you were running MySQL as a Windows service and you had to remove the service earlier in this procedure, reinstall the service. (See Section 2.3.7.7, "Starting MySQL as a Windows Service".)

  10. Restart the server. For example, use NET START MySQL if you run MySQL as a service, or invoke mysqld directly otherwise.

  11. As Administrator, run mysql_upgrade to check your tables, attempt to repair them if necessary, and update your grant tables if they have changed so that you can take advantage of any new capabilities. See Section 4.4.7, "mysql_upgrade - Check and Upgrade MySQL Tables".

  12. If you encounter errors, see Section 2.3.8, "Troubleshooting a Microsoft Windows MySQL Server Installation".

2.3.10. Windows Postinstallation Procedures

On Windows, you need not create the data directory and the grant tables. MySQL Windows distributions include the grant tables with a set of preinitialized accounts in the mysql database under the data directory. Regarding passwords, if you installed MySQL using the Windows Installation Wizard, you may have already assigned passwords to the accounts. (See Section 2.3.4.1, "Using the MySQL Installation Wizard".) Otherwise, use the password-assignment procedure given in Section 2.11.2, "Securing the Initial MySQL Accounts".

Before setting up passwords, you might want to try running some client programs to make sure that you can connect to the server and that it is operating properly. Make sure that the server is running (see Section 2.3.7.4, "Starting the Server for the First Time"), and then issue the following commands to verify that you can retrieve information from the server. You may need to specify directory different from C:\mysql\bin on the command line. If you used the Windows Installation Wizard, the default directory is C:\Program Files\MySQL\MySQL Server 5.5, and the mysql and mysqlshow client programs are in C:\Program Files\MySQL\MySQL Server 5.5\bin. See Section 2.3.4.1, "Using the MySQL Installation Wizard", for more information.

Use mysqlshow to see what databases exist:

C:\> C:\mysql\bin\mysqlshow+--------------------+| Databases  |+--------------------+| information_schema || mysql  || test   |+--------------------+

The list of installed databases may vary, but will always include the minimum of mysql and information_schema. In most cases, the test database will also be installed automatically.

The preceding command (and commands for other MySQL programs such as mysql) may not work if the correct MySQL account does not exist. For example, the program may fail with an error, or you may not be able to view all databases. If you installed using the MSI packages and used the MySQL Server Instance Config Wizard, then the root user will have been created automatically with the password you supplied. In this case, you should use the -u root and -p options. (You will also need to use the -u root and -p options if you have already secured the initial MySQL accounts.) With -p, you will be prompted for the root password. For example:

C:\> C:\mysql\bin\mysqlshow -u root -pEnter password: (enter root password here)+--------------------+| Databases  |+--------------------+| information_schema || mysql  || test   |+--------------------+

If you specify a database name, mysqlshow displays a list of the tables within the database:

C:\> C:\mysql\bin\mysqlshow mysqlDatabase: mysql+---------------------------+|  Tables   |+---------------------------+| columns_priv  || db || event || func  || help_category || help_keyword  || help_relation || help_topic || host  || plugin || proc  || procs_priv || servers   || tables_priv   || time_zone || time_zone_leap_second || time_zone_name || time_zone_transition  || time_zone_transition_type || user  |+---------------------------+

Use the mysql program to select information from a table in the mysql database:

C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM mysql.db"+------+--------+------+| host | db | user |+------+--------+------+| % | test   |  || % | test_% |  |+------+--------+------+

For more information about mysqlshow and mysql, see Section 4.5.6, "mysqlshow - Display Database, Table, and Column Information", and Section 4.5.1, "mysql - The MySQL Command-Line Tool".

If you are running a version of Windows that supports services, you can set up the MySQL server to run automatically when Windows starts. See Section 2.3.7.7, "Starting MySQL as a Windows Service".

2.4. Installing MySQL on Mac OS X

MySQL for Mac OS X is available in a number of different forms:

  • Native Package Installer format, which uses the native Mac OS X installer to walk you through the installation of MySQL. For more information, see Section 2.4.2, "Installing MySQL on Mac OS X Using Native Packages". You can use the package installer with Mac OS X 10.3 and later, and the package is available for both PowerPC and Intel architectures, and 32-bit and 64-bit architectures. There is no Universal Binary available using the package installation method. The user you use to perform the installation must have administrator privileges.

  • Tar package format, which uses a file packaged using the Unix tar and gzip commands. To use this method, you will need to open a Terminal window. You do not need administrator privileges using this method, as you can install the MySQL server anywhere using this method. For more information on using this method, you can use the generic instructions for using a tarball, Section 2.2, "Installing MySQL from Generic Binaries on Unix/Linux".You can use the package installer with Mac OS X 10.3 and later, and available for both PowerPC and Intel architectures, and both 32-bit and 64-bit architectures. A Universal Binary, incorporating both Power PC and Intel architectures and 32-bit and 64-bit binaries is available.

    In addition to the core installation, the Package Installer also includes Section 2.4.3, "Installing the MySQL Startup Item" and Section 2.4.4, "Installing and Using the MySQL Preference Pane", both of which simplify the management of your installation.

  • Mac OS X server includes a version of MySQL as standard. If you want to use a more recent version than that supplied with the Mac OS X server release, you can make use of the package or tar formats. For more information on using the MySQL bundled with Mac OS X, see Section 2.4.5, "Using the Bundled MySQL on Mac OS X Server".

For additional information on using MySQL on Mac OS X, see Section 2.4.1, "General Notes on Installing MySQL on Mac OS X".

2.4.1. General Notes on Installing MySQL on Mac OS X

You should keep the following issues and notes in mind:

  • The default location for the MySQL Unix socket is different on Mac OS X and Mac OS X Server depending on the installation type you chose. The following table shows the default locations by installation type.

    Table 2.7. MySQL Unix Socket Locations on Mac OS X by Installation Type

    Installation TypeSocket Location
    Package Installer from MySQL/tmp/mysql.sock
    Tarball from MySQL/tmp/mysql.sock
    MySQL Bundled with Mac OS X Server/var/mysql/mysql.sock

    To prevent issues, you should either change the configuration of the socket used within your application (for example, changing php.ini), or you should configure the socket location using a MySQL configuration file and the socket option. For more information, see Section 5.1.3, "Server Command Options".

  • You may need (or want) to create a specific mysql user to own the MySQL directory and data. On Mac OS X 10.4 and lower you can do this by using the Netinfo Manager application, located within the Utilities folder within the Applications folder. On Mac OS X 10.5 and later you can do this through the Directory Utility. From Mac OS X 10.5 and later (including Mac OS X Server 10.5) the mysql should already exist. For use in single user mode, an entry for _mysql (note the underscore prefix) should already exist within the system /etc/passwd file.

  • Due to a bug in the Mac OS X package installer, you may see this error message in the destination disk selection dialog:

    You cannot install this software on this disk. (null)

    If this error occurs, click the Go Back button once to return to the previous screen. Then click Continue to advance to the destination disk selection again, and you should be able to choose the destination disk correctly. We have reported this bug to Apple and it is investigating this problem.

  • Because the MySQL package installer installs the MySQL contents into a version and platform specific directory, you can use this to upgrade and migrate your database between versions. You will need to either copy the data directory from the old version to the new version, or alternatively specify an alternative datadir value to set location of the data directory.

  • You might want to add aliases to your shell's resource file to make it easier to access commonly used programs such as mysql and mysqladmin from the command line. The syntax for bash is:

    alias mysql=/usr/local/mysql/bin/mysqlalias mysqladmin=/usr/local/mysql/bin/mysqladmin

    For tcsh, use:

    alias mysql /usr/local/mysql/bin/mysqlalias mysqladmin /usr/local/mysql/bin/mysqladmin

    Even better, add /usr/local/mysql/bin to your PATH environment variable. You can do this by modifying the appropriate startup file for your shell. For more information, see Section 4.2.1, "Invoking MySQL Programs".

  • After you have copied over the MySQL database files from the previous installation and have successfully started the new server, you should consider removing the old installation files to save disk space. Additionally, you should also remove older versions of the Package Receipt directories located in /Library/Receipts/mysql-VERSION.pkg.

2.4.2. Installing MySQL on Mac OS X Using Native Packages

You can install MySQL on Mac OS X 10.3.x ("Panther") or newer using a Mac OS X binary package in PKG format instead of the binary tarball distribution. Please note that older versions of Mac OS X (for example, 10.1.x or 10.2.x) are not supported by this package.

The package is located inside a disk image (.dmg) file that you first need to mount by double-clicking its icon in the Finder. It should then mount the image and display its contents.

Note

Before proceeding with the installation, be sure to stop all running MySQL server instances by using either the MySQL Manager Application (on Mac OS X Server) or mysqladmin shutdown on the command line.

When installing from the package version, you should also install the MySQL Preference Pane, which will enable you to control the startup and execution of your MySQL server from System Preferences. For more information, see Section 2.4.4, "Installing and Using the MySQL Preference Pane".

When installing using the package installer, the files are installed into a directory within /usr/local matching the name of the installation version and platform. For example, the installer file mysql-5.1.39-osx10.5-x86_64.pkg installs MySQL into /usr/local/mysql-5.1.39-osx10.5-x86_64 . The following table shows the layout of the installation directory.

Table 2.8. MySQL Installation Layout on Mac OS X

DirectoryContents of Directory
binClient programs and the mysqld server
dataLog files, databases
docsManual in Info format
includeInclude (header) files
libLibraries
manUnix manual pages
mysql-testMySQL test suite
scriptsmysql_install_db
shareMiscellaneous support files, including error messages, sampleconfiguration files, SQL for database installation
sql-benchBenchmarks
support-filesScripts and sample configuration files
/tmp/mysql.sockLocation of the MySQL Unix socket

During the package installer process, a symbolic link from /usr/local/mysql to the version/platform specific directory created during installation will be created automatically.

  1. Download and open the MySQL package installer, which is provided on a disk image (.dmg) that includes the main MySQL installation package, the MySQLStartupItem.pkg installation package, and the MySQL.prefPane. Double-click the disk image to open it.

  2. Double-click the MySQL installer package. It will be named according to the version of MySQL you have downloaded. For example, if you have downloaded MySQL 5.1.39, double-click mysql-5.1.39-osx10.5-x86.pkg.

  3. You will be presented with the opening installer dialog. Click Continue to begin installation.

    MySQL Package Installer: Step 1
  4. A copy of the installation instructions and other important information relevant to this installation are displayed. Click Continue .

  5. If you have downloaded the community version of MySQL, you will be shown a copy of the relevant GNU General Public License. Click Continue .

  6. Select the drive you want to use to install the MySQL Startup Item. The drive must have a valid, bootable, Mac OS X operating system installed. Click Continue.

    MySQL Package Installer: Step 4
  7. You will be asked to confirm the details of the installation, including the space required for the installation. To change the drive on which the startup item is installed, click either Go Back or Change Install Location.... To install the startup item, click Install.

  8. Once the installation has been completed successfully, you will be shown an Install Succeeded message.

For convenience, you may also want to install the startup item and preference pane. See Section 2.4.3, "Installing the MySQL Startup Item", and Section 2.4.4, "Installing and Using the MySQL Preference Pane".

2.4.3. Installing the MySQL Startup Item

The MySQL Installation Package includes a startup item that can be used to automatically start and stop MySQL.

To install the MySQL Startup Item:

  1. Download and open the MySQL package installer, which is provided on a disk image (.dmg) that includes the main MySQL installation package, the MySQLStartupItem.pkg installation package, and the MySQL.prefPane. Double-click the disk image to open it.

  2. Double-click the MySQLStartItem.pkg file to start the installation process.

  3. You will be presented with the Install MySQL Startup Item dialog.

    MySQL Startup Item Installer: Step 1

    Click Continue to continue the installation process.

  4. A copy of the installation instructions and other important information relevant to this installation are displayed. Click Continue .

  5. Select the drive you want to use to install the MySQL Startup Item. The drive must have a valid, bootable, Mac OS X operating system installed. Click Continue.

    MySQL Startup Item Installer: Step 3
  6. You will be asked to confirm the details of the installation. To change the drive on which the startup item is installed, click either Go Back or Change Install Location.... To install the startup item, click Install.

  7. Once the installation has been completed successfully, you will be shown an Install Succeeded message.

    MySQL Startup Item Installer: Step 5

The Startup Item for MySQL is installed into /Library/StartupItems/MySQLCOM. The Startup Item installation adds a variable MYSQLCOM=-YES- to the system configuration file /etc/hostconfig. If you want to disable the automatic startup of MySQL, change this variable to MYSQLCOM=-NO-.

After the installation, you can start and stop MySQL by running the following commands in a terminal window. You must have administrator privileges to perform these tasks, and you may be prompted for your password.

If you have installed the Startup Item, use this command to start the server:

shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start

If you have installed the Startup Item, use this command to stop the server:

shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop

2.4.4. Installing and Using the MySQL Preference Pane

The MySQL Package installer disk image also includes a custom MySQL Preference Pane that enables you to start, stop, and control automated startup during boot of your MySQL installation.

To install the MySQL Preference Pane:

  1. Download and open the MySQL package installer package, which is provided on a disk image (.dmg) that includes the main MySQL installation package, the MySQLStartupItem.pkg installation package, and the MySQL.prefPane. Double-click the disk image to open it.

  2. Double-click the MySQL.prefPane. The MySQL System Preferences will open.

  3. If this is the first time you have installed the preference pane, you will be asked to confirm installation and whether you want to install the preference pane for all users, or only the current user. To install the preference pane for all users you will need administrator privileges. If necessary, you will be prompted for the username and password for a user with administrator privileges.

  4. If you already have the MySQL Preference Pane installed, you will be asked to confirm whether you want to overwrite the existing MySQL Preference Pane.

Note

The MySQL Preference Pane only starts and stops MySQL installation installed from the MySQL package installation that have been installed in the default location.

Once the MySQL Preference Pane has been installed, you can control your MySQL server instance using the preference pane. To use the preference pane, open the System Preferences... from the Apple menu. Select the MySQL preference pane by clicking the MySQL logo within the Other section of the preference panes list.

MySQL Preference Pane

The MySQL Preference Pane shows the current status of the MySQL server, showing stopped (in red) if the server is not running and running (in green) if the server has already been started. The preference pane also shows the current setting for whether the MySQL server has been set to start automatically.

  • To start MySQL using the preference pane:

    Click Start MySQL Server. You may be prompted for the username and password of a user with administrator privileges to start the MySQL server.

  • To stop MySQL using the preference pane:

    Click Stop MySQL Server. You may be prompted for the username and password of a user with administrator privileges to stop the MySQL server.

  • To automatically start the MySQL server when the system boots:

    Check the check box next to Automatically Start MySQL Server on Startup.

  • To disable automatic MySQL server startup when the system boots:

    Uncheck the check box next to Automatically Start MySQL Server on Startup.

You can close the System Preferences... window once you have completed your settings.

2.4.5. Using the Bundled MySQL on Mac OS X Server

If you are running Mac OS X Server, a version of MySQL should already be installed. The following table shows the versions of MySQL that ship with Mac OS X Server versions.

Table 2.9. MySQL Versions Preinstalled with Mac OS X Server

Mac OS X Server VersionMySQL Version
10.2-10.2.23.23.51
10.2.3-10.2.63.23.53
10.34.0.14
10.3.24.0.16
10.4.04.1.10a
10.5.05.0.45
10.6.05.0.82

The following table shows the installation layout of MySQL on Mac OS X Server.

Table 2.10. MySQL Directory Layout for Preinstalled MySQL Installations on Mac OS XServer

DirectoryContents of Directory
/usr/binClient programs
/var/mysqlLog files, databases
/usr/libexecThe mysqld server
/usr/share/manUnix manual pages
/usr/share/mysql/mysql-testMySQL test suite
/usr/share/mysqlMiscellaneous support files, including error messages, character set files, sample configuration files, SQL for databaseinstallation
/var/mysql/mysql.sockLocation of the MySQL Unix socket

Additional Resources

2.5. Installing MySQL on Linux

Linux supports a number of different solutions for installing MySQL. The recommended method is to use one of the distributions from Oracle. If you choose this method, there are three options available:

As an alternative, you can use the native package manager within your Linux distribution to automatically download and install MySQL for you. Native package installations can take of the download and dependencies required to run MySQL, but the MySQL version will often be some way behind the currently available release. You will also normally be unable to install developmental releases, as these are not usually made available in the native repository. For more information on using the native package installers, see Section 2.5.2, "Installing MySQL on Linux using Native Package Manager".

Note

For many Linux installations, you will want to set up MySQL to be started automatically when your machine starts. Many of the native package installations perform this operation for you, but for source, binary and RPM solutions you may need to set this up separately. The required script, mysql.server, can be found in the support-files directory under the MySQL installation directory or in a MySQL source tree. You can install it as /etc/init.d/mysql for automatic MySQL startup and shutdown. See Section 2.11.1.2, "Starting and Stopping MySQL Automatically".

2.5.1. Installing MySQL from RPM Packages on Linux

The recommended way to install MySQL on RPM-based Linux distributions is by using the RPM packages. The RPMs that we provide to the community should work on all versions of Linux that support RPM packages and use glibc 2.3. To obtain RPM packages, see Section 2.1.3, "How to Get MySQL".

For non-RPM Linux distributions, you can install MySQL using a .tar.gz package. See Section 2.2, "Installing MySQL from Generic Binaries on Unix/Linux".

Installations created from our Linux RPM distributions result in files under the following system directories.

Table 2.11. MySQL Installation Layout for Linux RPM

DirectoryContents of Directory
/usr/binClient programs and scripts
/usr/sbinThe mysqld server
/var/lib/mysqlLog files, databases
/usr/share/infoManual in Info format
/usr/share/manUnix manual pages
/usr/include/mysqlInclude (header) files
/usr/lib/mysqlLibraries
/usr/share/mysqlMiscellaneous support files, including error messages, character set files, sample configuration files, SQL for databaseinstallation
/usr/share/sql-benchBenchmarks

Note

RPM distributions of MySQL are also provided by other vendors. Be aware that they may differ from those built by us in features, capabilities, and conventions (including communication setup), and that the instructions in this manual do not necessarily apply to installing them. The vendor's instructions should be consulted instead. Because of these differences, RPM packages built by us check whether such RPMs built by other vendors are installed. If so, the RPM does not install and produces a message explaining this.

In most cases, you need to install only the MySQL-server and MySQL-client packages to get a functional MySQL installation. The other packages are not required for a standard installation.

RPMs for MySQL Cluster. Standard MySQL server RPMs built by MySQL do not provide support for the NDBCLUSTER storage engine.

Important

When upgrading a MySQL Cluster RPM installation, you must upgrade all installed RPMs, including the Server and Client RPMs.

For more information about installing MySQL Cluster from RPMs, see Section 17.2, "MySQL Cluster Installation".

For upgrades, if your installation was originally produced by installing multiple RPM packages, it is best to upgrade all the packages, not just some. For example, if you previously installed the server and client RPMs, do not upgrade just the server RPM.

If you get a dependency failure when trying to install MySQL packages (for example, error: removing these packages would break dependencies: libmysqlclient.so.10 is needed by ...), you should also install the MySQL-shared-compat package, which includes the shared libraries for older releases for backward compatibility.

The RPM packages shown in the following list are available. The names shown here use a suffix of .glibc23.i386.rpm, but particular packages can have different suffixes, described later.

  • MySQL-server-VERSION.glibc23.i386.rpm

    The MySQL server. You need this unless you only want to connect to a MySQL server running on another machine.

  • MySQL-client-VERSION.glibc23.i386.rpm

    The standard MySQL client programs. You probably always want to install this package.

  • MySQL-devel-VERSION.glibc23.i386.rpm

    The libraries and include files that are needed if you want to compile other MySQL clients, such as the Perl modules.

  • MySQL-shared-VERSION.glibc23.i386.rpm

    This package contains the shared libraries (libmysqlclient.so*) that certain languages and applications need to dynamically load and use MySQL. It contains single-threaded and thread-safe libraries. Prior to MySQL 5.5.6, if you install this package, do not install the MySQL-shared-compat package.

  • MySQL-shared-compat-VERSION.glibc23.i386.rpm

    This package includes the shared libraries for older releases. It contains single-threaded and thread-safe libraries. Install this package if you have applications installed that are dynamically linked against older versions of MySQL but you want to upgrade to the current version without breaking the library dependencies. Before MySQL 5.5.6, MySQL-shared-compat also includes the libraries for the current release, so if you install it, you should not also install MySQL-shared. As of 5.5.6, MySQL-shared-compat does not include the current library version, so there is no conflict.

    As of MySQL 5.5.23, the MySQL-shared-compat RPM package enables users of Red Hat-provided mysql-*-5.1 RPM packages to migrate to Oracle-provided MySQL-*-5.5 packages. MySQL-shared-compat replaces the Red Hat mysql-libs package by replacing libmysqlclient.so files of the latter package, thus satisfying dependencies of other packages on mysql-libs. This change affects only users of Red Hat (or Red Hat-compatible) RPM packages. Nothing is different for users of Oracle RPM packages.

  • MySQL-embedded-VERSION.glibc23.i386.rpm

    The embedded MySQL server library.

  • MySQL-test-VERSION.glibc23.i386.rpm

    This package includes the MySQL test suite.

  • MySQL-VERSION.src.rpm

    This contains the source code for all of the previous packages. It can also be used to rebuild the RPMs on other architectures (for example, Alpha or SPARC).

The suffix of RPM package names (following the VERSION value) has the following syntax:

.PLATFORM.CPU.rpm

The PLATFORM and CPU values indicate the type of system for which the package is built. PLATFORM indicates the platform and CPU indicates the processor type or family.

All packages are dynamically linked against glibc 2.3. The PLATFORM value indicates whether the package is platform independent or intended for a specific platform, as shown in the following table.

Table 2.12. MySQL Linux Installation Packages

PLATFORM ValueIntended Use
glibc23Platform independent, should run on any Linux distribution that supportsglibc 2.3
rhel4, rhel5Red Hat Enterprise Linux 4 or 5
el6Enterprise Linux 6
sles10, sles11SuSE Linux Enterprise Server 10 or 11

In MySQL 5.5, only glibc23 packages are available currently.

The CPU value indicates the processor type or family for which the package is built.

Table 2.13. MySQL Installation Packages for Linux CPU Identifier

CPU ValueIntended Processor Type or Family
i386, i586,i686Pentium processor or better, 32 bit
x86_6464-bit x86 processor
ia64Itanium (IA-64) processor

To see all files in an RPM package (for example, a MySQL-server RPM), run a command like this:

shell> rpm -qpl MySQL-server-VERSION.glibc23.i386.rpm

To perform a standard minimal installation, install the server and client RPMs:

shell> rpm -i MySQL-server-VERSION.glibc23.i386.rpmshell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm

To install only the client programs, install just the client RPM:

shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm

RPM provides a feature to verify the integrity and authenticity of packages before installing them. If you would like to learn more about this feature, see Section 2.1.4, "Verifying Package Integrity Using MD5 Checksums or GnuPG".

The server RPM places data under the /var/lib/mysql directory. The RPM also creates a login account for a user named mysql (if one does not exist) to use for running the MySQL server, and creates the appropriate entries in /etc/init.d/ to start the server automatically at boot time. (This means that if you have performed a previous installation and have made changes to its startup script, you may want to make a copy of the script so that you do not lose it when you install a newer RPM.) See Section 2.11.1.2, "Starting and Stopping MySQL Automatically", for more information on how MySQL can be started automatically on system startup.

In MySQL 5.5.5 and later, during a new installation, the server boot scripts are installed, but the MySQL server is not started at the end of the installation, since the status of the server during an unattended installation is not known.

In MySQL 5.5.5 and later, during an upgrade installation using the RPM packages, if the MySQL server is running when the upgrade occurs, the MySQL server is stopped, the upgrade occurs, and the MySQL server is restarted. If the MySQL server is not already running when the RPM upgrade occurs, the MySQL server is not started at the end of the installation.

If something goes wrong, you can find more information in the binary installation section. See Section 2.2, "Installing MySQL from Generic Binaries on Unix/Linux".

Note

The accounts that are listed in the MySQL grant tables initially have no passwords. After starting the server, you should set up passwords for them using the instructions in Section 2.11, "Postinstallation Setup and Testing".

During RPM installation, a user named mysql and a group named mysql are created on the system. This is done using the useradd, groupadd, and usermod commands. Those commands require appropriate administrative privileges, which is required for locally managed users and groups (as listed in the /etc/passwd and /etc/group files) by the RPM installation process being run by root.

If you log in as the mysql user, you may find that MySQL displays "Invalid (old?) table or database name" errors that mention .mysqlgui, lost+found, .mysqlgui, .bash_history, .fonts.cache-1, .lesshst, .mysql_history, .profile, .viminfo, and similar files created by MySQL or operating system utilities. You can safely ignore these error messages or remove the files or directories that cause them if you do not need them.

For nonlocal user management (LDAP, NIS, and so forth), the administrative tools may require additional authentication (such as a password), and will fail if the installing user does not provide this authentication. Even if they fail, the RPM installation will not abort but succeed, and this is intentional. If they failed, some of the intended transfer of ownership may be missing, and it is recommended that the system administrator then manually ensures some appropriate user and group exists and manually transfers ownership following the actions in the RPM spec file.

2.5.2. Installing MySQL on Linux using Native Package Manager

Many Linux distributions include a version of the MySQL server, client tools, and development components into the standard package management system built into distributions such as Fedora, Debian, Ubuntu, and Gentoo. This section provides basic instructions for installing MySQL using these systems.

Important

Native package installations can take care of the download and dependencies required to run MySQL, but the MySQL version will often be some way behind the currently available release. You will also normally be unable to install developmental releases, as these are not usually made available in the native repository.

Distribution specific instructions are shown below:

  • Red Hat Linux, Fedora, CentOS

    For Red Hat and similar distributions, the MySQL distribution is divided into a number of separate packages, mysql for the client tools, mysql-server for the server and associated tools, and mysql-libs for the libraries. The libraries are required if you want to provide connectivity from different languages and environments such as Perl, Python and others.

    To install, use the yum command to specify the packages that you want to install. For example:

    root-shell> yum install mysql mysql-server mysql-libs mysql-serverLoaded plugins: presto, refresh-packagekitSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package mysql.x86_64 0:5.1.48-2.fc13 set to be updated---> Package mysql-libs.x86_64 0:5.1.48-2.fc13 set to be updated---> Package mysql-server.x86_64 0:5.1.48-2.fc13 set to be updated--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.48-2.fc13.x86_64--> Running transaction check---> Package perl-DBD-MySQL.x86_64 0:4.017-1.fc13 set to be updated--> Finished Dependency ResolutionDependencies Resolved================================================================================ Package   Arch  Version   Repository  Size================================================================================Installing: mysql x86_64 5.1.48-2.fc13 updates 889 k mysql-libs x86_64 5.1.48-2.fc13 updates 1.2 M mysql-server  x86_64 5.1.48-2.fc13 updates 8.1 MInstalling for dependencies: perl-DBD-MySQL x86_64 4.017-1.fc13  updates 136 kTransaction Summary================================================================================Install   4 Package(s)Upgrade   0 Package(s)Total download size: 10 MInstalled size: 30 MIs this ok [y/N]: yDownloading Packages:Setting up and reading Presto delta metadataProcessing delta metadataPackage(s) data still to download: 10 M(1/4): mysql-5.1.48-2.fc13.x86_64.rpm | 889 kB 00:04 (2/4): mysql-libs-5.1.48-2.fc13.x86_64.rpm   | 1.2 MB 00:06 (3/4): mysql-server-5.1.48-2.fc13.x86_64.rpm | 8.1 MB 00:40 (4/4): perl-DBD-MySQL-4.017-1.fc13.x86_64.rpm | 136 kB 00:00 --------------------------------------------------------------------------------Total   201 kB/s |  10 MB 00:52 Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction  Installing : mysql-libs-5.1.48-2.fc13.x86_64  1/4   Installing : mysql-5.1.48-2.fc13.x86_64   2/4   Installing : perl-DBD-MySQL-4.017-1.fc13.x86_64   3/4   Installing : mysql-server-5.1.48-2.fc13.x86_64 4/4 Installed:  mysql.x86_64 0:5.1.48-2.fc13 mysql-libs.x86_64 0:5.1.48-2.fc13  mysql-server.x86_64 0:5.1.48-2.fc13 Dependency Installed:  perl-DBD-MySQL.x86_64 0:4.017-1.fc13  Complete!

    MySQL and the MySQL server should now be installed. A sample configuration file is installed into /etc/my.cnf. An init script, to start and stop the server, will have been installed into /etc/init.d/mysqld. To start the MySQL server use service:

    root-shell> service mysqld start

    To enable the server to be started and stopped automatically during boot, use chkconfig:

    root-shell> chkconfig --levels 235 mysqld on

    Which enables the MySQL server to be started (and stopped) automatically at the specified the run levels.

    The database tables will have been automatically created for you, if they do not already exist. You should, however, run mysql_secure_installation to set the root passwords on your server.

  • Debian, Ubuntu, Kubuntu

    On Debian and related distributions, there are two packages, mysql-client and mysql-server, for the client and server components respectively. You should specify an explicit version, for example mysql-client-5.1, to ensure that you install the version of MySQL that you want.

    To download and install, including any dependencies, use the apt-get command, specifying the packages that you want to install.

    Note

    Before installing, make sure that you update your apt-get index files to ensure you are downloading the latest available version.

    A sample installation of the MySQL packages might look like this (some sections trimmed for clarity):

    root-shell> apt-get install mysql-client-5.1 mysql-server-5.1Reading package lists... DoneBuilding dependency tree   Reading state information... DoneThe following packages were automatically installed and are no longer required:  linux-headers-2.6.28-11 linux-headers-2.6.28-11-genericUse 'apt-get autoremove' to remove them.The following extra packages will be installed:  bsd-mailx libdbd-mysql-perl libdbi-perl libhtml-template-perl  libmysqlclient15off libmysqlclient16 libnet-daemon-perl libplrpc-perl mailx  mysql-common postfixSuggested packages:  dbishell libipc-sharedcache-perl tinyca procmail postfix-mysql postfix-pgsql  postfix-ldap postfix-pcre sasl2-bin resolvconf postfix-cdbThe following NEW packages will be installed  bsd-mailx libdbd-mysql-perl libdbi-perl libhtml-template-perl  libmysqlclient15off libmysqlclient16 libnet-daemon-perl libplrpc-perl mailx  mysql-client-5.1 mysql-common mysql-server-5.1 postfix0 upgraded, 13 newly installed, 0 to remove and 182 not upgraded.Need to get 1907kB/25.3MB of archives.After this operation, 59.5MB of additional disk space will be used.Do you want to continue [Y/n]? YGet: 1 http://gb.archive.ubuntu.com jaunty-updates/main mysql-common 5.1.30really5.0.75-0ubuntu10.5 [63.6kB]Get: 2 http://gb.archive.ubuntu.com jaunty-updates/main libmysqlclient15off 5.1.30really5.0.75-0ubuntu10.5 [1843kB]Fetched 1907kB in 9s (205kB/s) Preconfiguring packages ...Selecting previously deselected package mysql-common.(Reading database ... 121260 files and directories currently installed.)...Processing 1 added doc-base file(s)...Registering documents with scrollkeeper...Setting up libnet-daemon-perl (0.43-1) ...Setting up libplrpc-perl (0.2020-1) ...Setting up libdbi-perl (1.607-1) ...Setting up libmysqlclient15off (5.1.30really5.0.75-0ubuntu10.5) ...Setting up libdbd-mysql-perl (4.008-1) ...Setting up libmysqlclient16 (5.1.31-1ubuntu2) ...Setting up mysql-client-5.1 (5.1.31-1ubuntu2) ...Setting up mysql-server-5.1 (5.1.31-1ubuntu2) ... * Stopping MySQL database server mysqld   ...done.100825 11:46:15  InnoDB: Started; log sequence number 0 46409100825 11:46:15  InnoDB: Starting shutdown...100825 11:46:17  InnoDB: Shutdown completed; log sequence number 0 46409100825 11:46:17 [Warning] Forcing shutdown of 1 plugins * Starting MySQL database server mysqld   ...done. * Checking for corrupt, not cleanly closed and upgrade needing tables....Processing triggers for libc6 ...ldconfig deferred processing now taking place
    Note

    The apt-get command will install a number of packages, including the MySQL server, in order to provide the typical tools and application environment. This can mean that you install a large number of packages in addition to the main MySQL package.

    During installation, the initial database will be created, and you will be prompted for the MySQL root password (and confirmation). A configuration file will have been created in /etc/mysql/my.cnf. An init script will have been created in /etc/init.d/mysql.

    The server will already be started. You can manually start and stop the server using:

    root-shell> service mysql [start|stop]

    The service will automatically be added to the 2, 3 and 4 run levels, with stop scripts in the single, shutdown and restart levels.

  • Gentoo Linux

    As a source-based distribution, installing MySQL on Gentoo involves downloading the source, patching the Gentoo specifics, and then compiling the MySQL server and installing it. This process is handled automatically by the emerge command. Depending on the version of MySQL that you want to install, you may need to unmask the specific version that you want for your chosen platform.

    The MySQL server and client tools are provided within a single package, dev-db/mysql. You can obtain a list of the versions available to install by looking at the portage directory for the package:

    root-shell> ls /usr/portage/dev-db/mysql/mysql-5.1*mysql-5.1.39-r1.ebuildmysql-5.1.44-r1.ebuildmysql-5.1.44-r2.ebuildmysql-5.1.44-r3.ebuildmysql-5.1.44.ebuildmysql-5.1.45-r1.ebuildmysql-5.1.45.ebuildmysql-5.1.46.ebuild

    To install a specific MySQL version, you must specify the entire atom. For example:

    root-shell> emerge =dev-db/mysql-5.1.46

    A simpler alternative is to use the virtual/mysql-5.1 package, which will install the latest version:

    root-shell> emerge =virtual/mysql-5.1

    If the package is masked (because it is not tested or certified for the current platform), use the ACCEPT_KEYWORDS environment variable. For example:

    root-shell> ACCEPT_KEYWORDS="~x86" emerge =virtual/mysql-5.1

    After installation, you should create a new database using mysql_install_db, and set the password for the root user on MySQL. You can use the configuration interface to set the password and create the initial database:

    root-shell> emerge --config =dev-db/mysql-5.1.46

    A sample configuration file will have been created for you in /etc/mysql/my.cnf, and an init script will have been created in /etc/init.d/mysql.

    To enable MySQL to start automatically at the normal (default) run levels, you can use:

    root-shell> rc-update add mysql default

2.6. Installing MySQL Using Unbreakable Linux Network (ULN)

Linux supports a number of different solutions for installing MySQL, covered in Section 2.5, "Installing MySQL on Linux". One of the methods, covered in this section, is installing from Oracles's Unbreakable Linux Network (ULN). You can find information about Oracle Linux and ULN under http://linux.oracle.com/.

To use ULN, you need to obtain a ULN login and register the machine used for installation with ULN. This is described in detail in the ULN FAQ. This page also describes how to install and update packages.

Note

At the time of writing this (September 2012), ULN provides MySQL 5.5 for Oracle Linux 6.

Once MySQL has been installed using ULN, you can find information on starting and stopping the server, and more, in this section, particularly under Section 2.5.1, "Installing MySQL from RPM Packages on Linux".

If you're updating an existing MySQL installation to an installation using ULN, the recommended procedure is to export your data using mysqldump, remove the existing installation, install MySQL from ULN, and load the exported data into your freshly installed MySQL.

If the existing MySQL installation you're upgrading from is from a previous release series (prior to MySQL 5.5), make sure to read the section on upgrading MySQL, Section 2.12.1, "Upgrading MySQL".

2.7. Installing MySQL on Solaris and OpenSolaris

MySQL on Solaris and OpenSolaris is available in a number of different formats.

To obtain a binary MySQL distribution for Solaris in tarball or PKG format, http://dev.mysql.com/downloads/mysql/5.5.html.

Additional notes to be aware of when installing and using MySQL on Solaris:

  • If you want to use MySQL with the mysql user and group, use the groupadd and useradd commands:

    groupadd mysqluseradd -g mysql mysql
  • If you install MySQL using a binary tarball distribution on Solaris, you may run into trouble even before you get the MySQL distribution unpacked, as the Solaris tar cannot handle long file names. This means that you may see errors when you try to unpack MySQL.

    If this occurs, you must use GNU tar (gtar) to unpack the distribution. In Solaris 10 and OpenSolaris gtar is normally located in /usr/sfw/bin/gtar, but may not be included in the default path definition.

  • When using Solaris 10 for x86_64, you should mount any file systems on which you intend to store InnoDB files with the forcedirectio option. (By default mounting is done without this option.) Failing to do so will cause a significant drop in performance when using the InnoDB storage engine on this platform.

  • If you would like MySQL to start automatically, you can copy support-files/mysql.server to /etc/init.d and create a symbolic link to it named /etc/rc3.d/S99mysql.server.

  • If too many processes try to connect very rapidly to mysqld, you should see this error in the MySQL log:

    Error in accept: Protocol error

    You might try starting the server with the --back_log=50 option as a workaround for this.

  • To configure the generation of core files on Solaris you should use the coreadm command. Because of the security implications of generating a core on a setuid() application, by default, Solaris does not support core files on setuid() programs. However, you can modify this behavior using coreadm. If you enable setuid() core files for the current user, they will be generated using the mode 600 and owned by the superuser.

2.7.1. Installing MySQL on Solaris using a Solaris PKG

You can install MySQL on Solaris and OpenSolaris using a binary package using the native Solaris PKG format instead of the binary tarball distribution.

To use this package, download the corresponding mysql-VERSION-solaris10-PLATFORM.pkg.gz file, then decompress it. For example:

shell> gunzip mysql-5.5.31-solaris10-x86_64.pkg.gz

To install a new package, use pkgadd and follow the onscreen prompts. You must have root privileges to perform this operation:

shell> pkgadd -d mysql-5.5.31-solaris10-x86_64.pkgThe following packages are available:  1  mysql MySQL Community Server (GPL)   (i86pc) 5.5.31Select package(s) you wish to process (or 'all' to processall packages). (default: all) [?,??,q]: 

The PKG installer installs all of the files and tools needed, and then initializes your database if one does not exist. To complete the installation, you should set the root password for MySQL as provided in the instructions at the end of the installation. Alternatively, you can run the mysql_secure_installation script that comes with the installation.

The default installation directory is /opt/mysql. You can only change the root path of the installation when using pkgadd, which can be used to install MySQL in a different Solaris zone. If you need to install in a specific directory, use the binary tar file.

The pkg installer copies a suitable startup script for MySQL into /etc/init.d/mysql. To enable MySQL to startup and shutdown automatically, you should create a link between this file and the init script directories. For example, to ensure safe startup and shutdown of MySQL you could use the following commands to add the right links:

shell> ln /etc/init.d/mysql /etc/rc3.d/S91mysqlshell> ln /etc/init.d/mysql /etc/rc0.d/K02mysql

To remove MySQL, the installed package name is mysql. You can use this in combination with the pkgrm command to remove the installation.

To upgrade when using the Solaris package file format, you must remove the existing installation before installing the updated package. Removal of the package does not delete the existing database information, only the server, binaries and support files. The typical upgrade sequence is therefore:

shell> mysqladmin shutdownshell> pkgrm mysqlshell> pkgadd -d mysql-5.5.31-solaris10-x86_64.pkg shell> mysqld_safe &shell> mysql_upgrade

You should check the notes in Section 2.12, "Upgrading or Downgrading MySQL" before performing any upgrade.

2.7.2. Installing MySQL on OpenSolaris using IPS

OpenSolaris includes standard packages for MySQL in the core repository. The MySQL packages are based on a specific release of MySQL and updated periodically. For the latest release you must use either the native Solaris PKG, tar, or source installations. The native OpenSolaris packages include SMF files so that you can easily control your MySQL installation, including automatic startup and recovery, using the native service management tools.

To install MySQL on OpenSolaris, use the pkg command. You will need to be logged in as root, or use the pfexec tool, as shown in the example below:

shell> pfexec pkg install SUNWmysql55

The package set installs three individual packages, SUNWmysql55lib, which contains the MySQL client libraries; SUNWmysql55r which contains the root components, including SMF and configuration files; and SUNWmysql55u which contains the scripts, binary tools and other files. You can install these packages individually if you only need the corresponding components.

The MySQL files are installed into /usr/mysql which symbolic links for the sub directories (bin, lib, etc.) to a version specific directory. For MySQL 5.5, the full installation is located in /usr/mysql/5.5. The default data directory is /var/mysql/5.5/data. The configuration file is installed in /etc/mysql/5.5/my.cnf. This layout permits multiple versions of MySQL to be installed, without overwriting the data and binaries from other versions.

Once installed, you must run mysql_install_db to initialize the database, and use the mysql_secure_installation to secure your installation.

Using SMF to manage your MySQL installation

Once installed, you can start and stop your MySQL server using the installed SMF configuration. The service name is mysql, or if you have multiple versions installed, you should use the full version name, for example mysql:version_55. To start and enable MySQL to be started at boot time:

shell> svcadm enable mysql

To disable MySQL from starting during boot time, and shut the MySQL server down if it is running, use:

shell> svcadm disable mysql

To restart MySQL, for example after a configuration file changes, use the restart option:

shell> svcadm restart mysql

You can also use SMF to configure the data directory and enable full 64-bit mode. For example, to set the data directory used by MySQL:

shell> svccfg svc:> select mysql:version_55 svc:/application/database/mysql:version_55> setprop mysql/data=/data0/mysql  

By default, the 32-bit binaries are used. To enable the 64-bit server on 64-bit platforms, set the enable_64bit parameter. For example:

svc:/application/database/mysql:version_55> setprop mysql/enable_64bit=1 

You need to refresh the SMF after settings these options:

shell> svcadm refresh mysql
Copyright © 1997, 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices
(Sebelumnya) 1. Informasi Umum2.8. Installing MySQL on HP-UX (Berikutnya)