switch4g: completely re-writen
[tomato.git] / release / src / router / mysql / INSTALL-SOURCE
bloba7e413d643b330ce807182d33980de0e0610eea0
2 Chapter 2. Installing and Upgrading MySQL
4    This chapter describes how to obtain and install MySQL. A summary
5    of the procedure follows and later sections provide the details.
6    If you plan to upgrade an existing version of MySQL to a newer
7    version rather than install MySQL for the first time, see Section
8    2.13.1, "Upgrading MySQL," for information about upgrade
9    procedures and about issues that you should consider before
10    upgrading.
12    If you are interested in migrating to MySQL from another database
13    system, you may wish to read Section B.8, "MySQL 5.1 FAQ:
14    Migration," which contains answers to some common questions
15    concerning migration issues.
17    If you are migrating from MySQL Enterprise Edition to MySQL
18    Community Server, see Section 2.13.2.2, "Downgrading from MySQL
19    Enterprise Edition to MySQL Community Server."
21    Installation of MySQL generally follows the steps outlined here:
23     1. Determine whether MySQL runs and is supported on your
24        platform.
25        Please note that not all platforms are equally suitable for
26        running MySQL, and that not all platforms on which MySQL is
27        known to run are officially supported by Oracle Corporation:
29     2. Choose which distribution to install.
30        Several versions of MySQL are available, and most are
31        available in several distribution formats. You can choose from
32        pre-packaged distributions containing binary (precompiled)
33        programs or source code. When in doubt, use a binary
34        distribution. We also provide public access to our current
35        source tree for those who want to see our most recent
36        developments and help us test new code. To determine which
37        version and type of distribution you should use, see Section
38        2.1.2, "Choosing Which MySQL Distribution to Install."
40     3. Download the distribution that you want to install.
41        For instructions, see Section 2.1.3, "How to Get MySQL." To
42        verify the integrity of the distribution, use the instructions
43        in Section 2.1.4, "Verifying Package Integrity Using MD5
44        Checksums or GnuPG."
46     4. Install the distribution.
47        To install MySQL from a binary distribution, use the
48        instructions in Section 2.2, "Installing MySQL on Unix/Linux
49        Using Generic Binaries."
50        To install MySQL from a source distribution or from the
51        current development source tree, use the instructions in
52        Section 2.11, "Installing MySQL from Source."
54     5. Perform any necessary postinstallation setup.
55        After installing MySQL, see Section 2.12, "Postinstallation
56        Setup and Testing" for information about making sure the MySQL
57        server is working properly. Also refer to the information
58        provided in Section 2.12.2, "Securing the Initial MySQL
59        Accounts." This section describes how to secure the initial
60        MySQL user accounts, which have no passwords until you assign
61        passwords. The section applies whether you install MySQL using
62        a binary or source distribution.
64     6. If you want to run the MySQL benchmark scripts, Perl support
65        for MySQL must be available. See Section 2.15, "Perl
66        Installation Notes."
68    Instructions for installing MySQL on different platforms and
69    environments is available on a platform by platform basis:
71      * Unix, Linux, FreeBSD
72        For instructions on installing MySQL on most Linux and Unix
73        platforms using a generic binary (for example, a .tar.gz
74        package), see Section 2.2, "Installing MySQL on Unix/Linux
75        Using Generic Binaries."
76        For information on building MySQL entirely from the source
77        code distributions or the source code repositories, see
78        Section 2.11, "Installing MySQL from Source"
79        For specific platform help on installation, configuration, and
80        building from source see the corresponding platform section:
82           + Linux, including notes on distribution specific methods,
83             see Section 2.5, "Installing MySQL on Linux."
85           + Solaris and OpenSolaris, including PKG and IPS formats,
86             see Section 2.6, "Installing MySQL on Solaris and
87             OpenSolaris."
89           + IBM AIX, see Section 2.6, "Installing MySQL on Solaris
90             and OpenSolaris."
92           + Hewlett-Packard HP-UX, including the DEPOT package
93             format, see Section 2.8, "Installing MySQL on HP-UX."
95           + FreeBSD, see Section 2.9, "Installing MySQL on FreeBSD."
97      * Microsoft Windows
98        For instructions on installing MySQL on Microsoft Windows,
99        using either a Zipped binary or an MSI package, see Section
100        2.3, "Installing MySQL on Microsoft Windows."
101        For information on using the MySQL Server Instance Config
102        Wizard, see Section 2.3.5, "Using the MySQL Server Instance
103        Config Wizard."
104        For details and instructions on building MySQL from source
105        code using Microsoft Visual Studio, see Section 2.11.7,
106        "Installing MySQL from Source on Windows."
108      * Mac OS X
109        For installation on Mac OS X, including using both the binary
110        package and native PKG formats, see Section 2.4, "Installing
111        MySQL on Mac OS X."
112        For information on making use of the MySQL Startup Item to
113        automatically start and stop MySQL, see Section 2.4.3,
114        "Installing the MySQL Startup Item."
115        For information on the MySQL Preference Pane, see Section
116        2.4.4, "Installing and Using the MySQL Preference Pane."
118      * IBM i5/OS
119        For instructions on installing, starting, and stopping MySQL
120        on i5/OS, see Section 2.10, "Installing MySQL on i5/OS."
122 2.1. General Installation Guidance
124    The immediately following sections contain the information
125    necessary to choose, download, and verify your distribution. The
126    instructions in later sections of the chapter describe how to
127    install the distribution that you choose. For binary
128    distributions, see the instructions at Section 2.2, "Installing
129    MySQL on Unix/Linux Using Generic Binaries" or the corresponding
130    section for your platform if available. To build MySQL from
131    source, use the instructions in Section 2.11, "Installing MySQL
132    from Source."
134 2.1.1. Operating Systems Supported by MySQL Community Server
136    This section lists the operating systems on which MySQL Community
137    Server is known to run.
138    Important
140    Oracle Corporation does not necessarily provide official support
141    for all the platforms listed in this section. For information
142    about those platforms that are officially supported, see
143    http://www.mysql.com/support/supportedplatforms/database.html on
144    the MySQL Web site.
146    We use GNU Autoconf, so it is possible to port MySQL to all modern
147    systems that have a C++ compiler and a working implementation of
148    POSIX threads. (Thread support is needed for the server. To
149    compile only the client code, the only requirement is a C++
150    compiler.)
152    MySQL has been reported to compile successfully on the following
153    systems:
155      * AIX 4.x, 5.x. See Section 2.7, "Installing MySQL on IBM AIX."
156        AIX 5.3 should be upgraded to technology level 7 (5300-07).
158      * FreeBSD 5.x and up. See Section 2.9, "Installing MySQL on
159        FreeBSD."
161      * HP-UX 11.x. See Section 2.8, "Installing MySQL on HP-UX."
163      * Linux. Builds on all recent Linux distributions based on the
164        2.6 kernel. See Section 2.5, "Installing MySQL on Linux."
166      * Mac OS X. See Section 2.4, "Installing MySQL on Mac OS X."
168      * Solaris 2.8 on SPARC and x86. See Section 2.6, "Installing
169        MySQL on Solaris and OpenSolaris."
171      * Microsoft Windows. See Section 2.3, "Installing MySQL on
172        Microsoft Windows."
174    MySQL has also been known to run on other systems in the past. See
175    Section 2.1, "General Installation Guidance." Some porting effort
176    might be required for current versions of MySQL on these systems.
178    Not all platforms are equally well-suited for running MySQL. How
179    well a certain platform is suited for a high-load mission-critical
180    MySQL server is determined by the following factors:
182      * General stability of the thread library. A platform may have
183        an excellent reputation otherwise, but MySQL is only as stable
184        as the thread library it calls, even if everything else is
185        perfect.
187      * The capability of the kernel and the thread library to take
188        advantage of symmetric multi-processor (SMP) systems. In other
189        words, when a process creates a thread, it should be possible
190        for that thread to run on a CPU different from the original
191        process.
193      * The capability of the kernel and the thread library to run
194        many threads that acquire and release a mutex over a short
195        critical region frequently without excessive context switches.
196        If the implementation of pthread_mutex_lock() is too anxious
197        to yield CPU time, this hurts MySQL tremendously. If this
198        issue is not taken care of, adding extra CPUs actually makes
199        MySQL slower.
201      * General file system stability and performance.
203      * Table size. If your tables are large, performance is affected
204        by the ability of the file system to deal with large files and
205        dealing with them efficiently.
207      * Our level of expertise here at Oracle Corporation with the
208        platform. If we know a platform well, we enable
209        platform-specific optimizations and fixes at compile time. We
210        can also provide advice on configuring your system optimally
211        for MySQL.
213      * The amount of testing we have done internally for similar
214        configurations.
216      * The number of users that have run MySQL successfully on the
217        platform in similar configurations. If this number is high,
218        the likelihood of encountering platform-specific surprises is
219        much smaller.
221 2.1.2. Choosing Which MySQL Distribution to Install
223    When preparing to install MySQL, you should decide which version
224    to use. MySQL development occurs in several release series, and
225    you can pick the one that best fits your needs. After deciding
226    which version to install, you can choose a distribution format.
227    Releases are available in binary or source format.
229 2.1.2.1. Choosing Which Version of MySQL to Install
231    The first decision to make is whether you want to use a production
232    (stable) release or a development release. In the MySQL
233    development process, multiple release series co-exist, each at a
234    different stage of maturity.
236 Production Releases
239      * MySQL 5.6: Latest General Availability (Production) release
241      * MySQL 5.5: Previous General Availability (Production) release
243      * MySQL 5.1: Older General Availability (Production) release
245      * MySQL 5.0: Older Production release nearing the end of the
246        product lifecycle
248    MySQL 4.1, 4.0, and 3.23 are old releases that are no longer
249    supported.
251    See http://www.mysql.com/about/legal/lifecycle/ for information
252    about support policies and schedules.
254    Normally, if you are beginning to use MySQL for the first time or
255    trying to port it to some system for which there is no binary
256    distribution, use the most recent General Availability series
257    listed in the preceding descriptions. All MySQL releases, even
258    those from development series, are checked with the MySQL
259    benchmarks and an extensive test suite before being issued.
261    If you are running an older system and want to upgrade, but do not
262    want to take the chance of having a nonseamless upgrade, you
263    should upgrade to the latest version in the same release series
264    you are using (where only the last part of the version number is
265    newer than yours). We have tried to fix only fatal bugs and make
266    only small, relatively "safe" changes to that version.
268    If you want to use new features not present in the production
269    release series, you can use a version from a development series.
270    Be aware that development releases are not as stable as production
271    releases.
273    We do not use a complete code freeze because this prevents us from
274    making bugfixes and other fixes that must be done. We may add
275    small things that should not affect anything that currently works
276    in a production release. Naturally, relevant bugfixes from an
277    earlier series propagate to later series.
279    If you want to use the very latest sources containing all current
280    patches and bugfixes, you can use one of our source code
281    repositories (see Section 2.11.3, "Installing MySQL Using a
282    Development Source Tree"). These are not "releases" as such, but
283    are available as previews of the code on which future releases are
284    to be based.
286    The naming scheme in MySQL 5.1 uses release names that consist of
287    three numbers and a suffix; for example, mysql-5.1.29-rc. The
288    numbers within the release name are interpreted as follows:
290      * The first number (5) is the major version and describes the
291        file format. All MySQL 5 releases have the same file format.
293      * The second number (1) is the release level. Taken together,
294        the major version and release level constitute the release
295        series number.
297      * The third number (29) is the version number within the release
298        series. This is incremented for each new release. Usually you
299        want the latest version for the series you have chosen.
301    For each minor update, the last number in the version string is
302    incremented. When there are major new features or minor
303    incompatibilities with previous versions, the second number in the
304    version string is incremented. When the file format changes, the
305    first number is increased.
307    Release names also include a suffix to indicates the stability
308    level of the release. Releases within a series progress through a
309    set of suffixes to indicate how the stability level improves. The
310    possible suffixes are:
312      * alpha indicates that the release is for preview purposes only.
313        Known bugs should be documented in the Release Notes
314        (http://dev.mysql.com/doc/relnotes/mysql/5.1/en/). Most alpha
315        releases implement new commands and extensions. Active
316        development that may involve major code changes can occur in
317        an alpha release. However, we do conduct testing before
318        issuing a release.
320      * beta indicates that the release is appropriate for use with
321        new development. Within beta releases, the features and
322        compatibility should remain consistent. However, beta releases
323        may contain numerous and major unaddressed bugs.
324        All APIs, externally visible structures, and columns for SQL
325        statements will not change during future beta, release
326        candidate, or production releases.
328      * rc indicates a Release Candidate. Release candidates are
329        believed to be stable, having passed all of MySQL's internal
330        testing, and with all known fatal runtime bugs fixed. However,
331        the release has not been in widespread use long enough to know
332        for sure that all bugs have been identified. Only minor fixes
333        are added. (A release candidate is what formerly was known as
334        a gamma release.)
336      * If there is no suffix, it indicates that the release is a
337        General Availability (GA) or Production release. GA releases
338        are stable, having successfully passed through all earlier
339        release stages and are believed to be reliable, free of
340        serious bugs, and suitable for use in production systems. Only
341        critical bugfixes are applied to the release.
343    All releases of MySQL are run through our standard tests and
344    benchmarks to ensure that they are relatively safe to use. Because
345    the standard tests are extended over time to check for all
346    previously found bugs, the test suite keeps getting better.
348    All releases have been tested at least with these tools:
350      * An internal test suite.  The mysql-test directory contains an
351        extensive set of test cases. We run these tests for every
352        server binary. See Section 22.1.2, "The MySQL Test Suite," for
353        more information about this test suite.
355      * The MySQL benchmark suite.  This suite runs a range of common
356        queries. It is also a test to determine whether the latest
357        batch of optimizations actually made the code faster. See
358        Section 8.1.3, "The MySQL Benchmark Suite."
360    We also perform additional integration and nonfunctional testing
361    of the latest MySQL version in our internal production
362    environment. Integration testing is done with different
363    connectors, storage engines, replication modes, backup,
364    partitioning, stored programs, and so forth in various
365    combinations. Additional nonfunctional testing is done in areas of
366    performance, concurrency, stress, high volume, upgrade and
367    downgrade.
369 2.1.2.2. Choosing a Distribution Format
371    After choosing which version of MySQL to install, you should
372    decide whether to use a binary distribution or a source
373    distribution. In most cases, you should probably use a binary
374    distribution, if one exists for your platform. Binary
375    distributions are available in native format for many platforms,
376    such as RPM packages for Linux, DMG packages for Mac OS X, and PKG
377    packages for Solaris. Distributions are also available in more
378    generic formats such as Zip archives or compressed tar files.
380    Reasons to choose a binary distribution include the following:
382      * Binary distributions generally are easier to install than
383        source distributions.
385      * To satisfy different user requirements, we provide several
386        servers in binary distributions. mysqld is an optimized server
387        that is a smaller, faster binary. mysqld-debug is compiled
388        with debugging support.
389        Each of these servers is compiled from the same source
390        distribution, though with different configuration options. All
391        native MySQL clients can connect to servers from either MySQL
392        version.
394    Under some circumstances, you may be better off installing MySQL
395    from a source distribution:
397      * You want to install MySQL at some explicit location. The
398        standard binary distributions are ready to run at any
399        installation location, but you might require even more
400        flexibility to place MySQL components where you want.
402      * You want to configure mysqld to ensure that features are
403        available that might not be included in the standard binary
404        distributions. Here is a list of the most common extra options
405        that you may want to use to ensure feature availability:
407           + --with-libwrap
409           + --with-named-z-libs (this is done for some of the
410             binaries)
412           + --with-debug[=full]
413        For additional information, see Section 2.11.4, "MySQL
414        Source-Configuration Options."
416      * You want to configure mysqld without some features that are
417        included in the standard binary distributions. For example,
418        distributions normally are compiled with support for all
419        character sets. If you want a smaller MySQL server, you can
420        recompile it with support for only the character sets you
421        need.
423      * You want to use the latest sources from one of the Bazaar
424        repositories to have access to all current bugfixes. For
425        example, if you have found a bug and reported it to the MySQL
426        development team, the bugfix is committed to the source
427        repository and you can access it there. The bugfix does not
428        appear in a release until a release actually is issued.
430      * You want to read (or modify) the C and C++ code that makes up
431        MySQL. For this purpose, you should get a source distribution,
432        because the source code is always the ultimate manual.
434      * Source distributions contain more tests and examples than
435        binary distributions.
437 2.1.2.3. How and When Updates Are Released
439    MySQL is evolving quite rapidly and we want to share new
440    developments with other MySQL users. We try to produce a new
441    release whenever we have new and useful features that others also
442    seem to have a need for.
444    We also try to help users who request features that are easy to
445    implement. We take note of what our licensed users want, and we
446    especially take note of what our support customers want and try to
447    help them in this regard.
449    No one is required to download a new release. The Release Notes
450    (http://dev.mysql.com/doc/relnotes/mysql/5.1/en/) help you
451    determine whether the new release has something you really want.
453    We use the following policy when updating MySQL:
455      * Enterprise Server releases are meant to appear every 18
456        months, supplemented by quarterly service packs and monthly
457        rapid updates. Community Server releases are meant to appear 2
458        to 3 times per year.
460      * Releases are issued within each series. For each release, the
461        last number in the version is one more than the previous
462        release within the same series.
464      * Binary distributions for some platforms are made by us for
465        major releases. Other people may make binary distributions for
466        other systems, but probably less frequently.
468      * We make fixes available as soon as we have identified and
469        corrected small or noncritical but annoying bugs. The fixes
470        are available in source form immediately from our public
471        Bazaar repositories, and are included in the next release.
473      * If by any chance a security vulnerability or critical bug is
474        found in a release, our policy is to fix it in a new release
475        as soon as possible. (We would like other companies to do
476        this, too!)
478 2.1.3. How to Get MySQL
480    Check our downloads page at http://dev.mysql.com/downloads/ for
481    information about the current version of MySQL and for downloading
482    instructions. For a complete up-to-date list of MySQL download
483    mirror sites, see http://dev.mysql.com/downloads/mirrors.html. You
484    can also find information there about becoming a MySQL mirror site
485    and how to report a bad or out-of-date mirror.
487    To obtain the latest development source, see Section 2.11.3,
488    "Installing MySQL Using a Development Source Tree."
490 2.1.4. Verifying Package Integrity Using MD5 Checksums or GnuPG
492    After you have downloaded the MySQL package that suits your needs
493    and before you attempt to install it, you should make sure that it
494    is intact and has not been tampered with. There are three means of
495    integrity checking:
497      * MD5 checksums
499      * Cryptographic signatures using GnuPG, the GNU Privacy Guard
501      * For RPM packages, the built-in RPM integrity verification
502        mechanism
504    The following sections describe how to use these methods.
506    If you notice that the MD5 checksum or GPG signatures do not
507    match, first try to download the respective package one more time,
508    perhaps from another mirror site.
510 2.1.4.1. Verifying the MD5 Checksum
512    After you have downloaded a MySQL package, you should make sure
513    that its MD5 checksum matches the one provided on the MySQL
514    download pages. Each package has an individual checksum that you
515    can verify against the package that you downloaded. The correct
516    MD5 checksum is listed on the downloads page for each MySQL
517    product, and you will compare it against the MD5 checksum of the
518    file (product) that you download.
520    Each operating system and setup offers its own version of tools
521    for checking the MD5 checksum. Typically the command is named
522    md5sum, or it may be named md5, and some operating systems do not
523    ship it at all. On Linux, it is part of the GNU Text Utilities
524    package, which is available for a wide range of platforms. You can
525    also download the source code from
526    http://www.gnu.org/software/textutils/. If you have OpenSSL
527    installed, you can use the command openssl md5 package_name
528    instead. A Windows implementation of the md5 command line utility
529    is available from http://www.fourmilab.ch/md5/. winMd5Sum is a
530    graphical MD5 checking tool that can be obtained from
531    http://www.nullriver.com/index/products/winmd5sum. Our Microsoft
532    Windows examples will assume the name md5.exe.
534    Linux and Microsoft Windows examples:
535 shell> md5sum mysql-standard-5.1.74-linux-i686.tar.gz
536 aaab65abbec64d5e907dcd41b8699945  mysql-standard-5.1.74-linux-i686.ta
537 r.gz
538 shell> md5.exe mysql-installer-community-5.1.74.msi
539 aaab65abbec64d5e907dcd41b8699945  mysql-installer-community-5.1.74.ms
542    You should verify that the resulting checksum (the string of
543    hexadecimal digits) matches the one displayed on the download page
544    immediately below the respective package.
545    Note
547    Make sure to verify the checksum of the archive file (for example,
548    the .zip, .tar.gz, or .msi file) and not of the files that are
549    contained inside of the archive. In other words, verify the file
550    before extracting its contents.
552 2.1.4.2. Signature Checking Using GnuPG
554    Another method of verifying the integrity and authenticity of a
555    package is to use cryptographic signatures. This is more reliable
556    than using MD5 checksums, but requires more work.
558    We sign MySQL downloadable packages with GnuPG (GNU Privacy
559    Guard). GnuPG is an Open Source alternative to the well-known
560    Pretty Good Privacy (PGP) by Phil Zimmermann. See
561    http://www.gnupg.org/ for more information about GnuPG and how to
562    obtain and install it on your system. Most Linux distributions
563    ship with GnuPG installed by default. For more information about
564    GnuPG, see http://www.openpgp.org/.
566    To verify the signature for a specific package, you first need to
567    obtain a copy of our public GPG build key, which you can download
568    from http://pgp.mit.edu/. The key that you want to obtain is named
569    mysql-build@oss.oracle.com. Alternatively, you can cut and paste
570    the key directly from the following text:
571 -----BEGIN PGP PUBLIC KEY BLOCK-----
572 Version: PGP Universal 2.9.1 (Build 347)
574 mQGiBD4+owwRBAC14GIfUfCyEDSIePvEW3SAFUdJBtoQHH/nJKZyQT7h9bPlUWC3
575 RODjQReyCITRrdwyrKUGku2FmeVGwn2u2WmDMNABLnpprWPkBdCk96+OmSLN9brZ
576 fw2vOUgCmYv2hW0hyDHuvYlQA/BThQoADgj8AW6/0Lo7V1W9/8VuHP0gQwCgvzV3
577 BqOxRznNCRCRxAuAuVztHRcEAJooQK1+iSiunZMYD1WufeXfshc57S/+yeJkegNW
578 hxwR9pRWVArNYJdDRT+rf2RUe3vpquKNQU/hnEIUHJRQqYHo8gTxvxXNQc7fJYLV
579 K2HtkrPbP72vwsEKMYhhr0eKCbtLGfls9krjJ6sBgACyP/Vb7hiPwxh6rDZ7ITnE
580 kYpXBACmWpP8NJTkamEnPCia2ZoOHODANwpUkP43I7jsDmgtobZX9qnrAXw+uNDI
581 QJEXM6FSbi0LLtZciNlYsafwAPEOMDKpMqAK6IyisNtPvaLd8lH0bPAnWqcyefep
582 rv0sxxqUEMcM3o7wwgfN83POkDasDbs3pjwPhxvhz6//62zQJ7Q2TXlTUUwgUmVs
583 ZWFzZSBFbmdpbmVlcmluZyA8bXlzcWwtYnVpbGRAb3NzLm9yYWNsZS5jb20+iGYE
584 ExECACYCGyMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAUCTnc+KgUJE/sCFQAKCRCM
585 cY07UHLh9SbMAJ4l1+qBz2BZNSGCZwwA6YbhGPC7FwCgp8z5TzIw4YQuL5NGJ/sy
586 0oSazqmJASIEEAECAAwFAk53QS4FAwASdQAACgkQlxC4m8pXrXwJ8Qf/be/UO9mq
587 foc2sMyhwMpN4/fdBWwfLkA12FXQDOQMvwH9HsmEjnfUgYKXschZRi+DuHXe1P7l
588 8G2aQLubhBsQf9ejKvRFTzuWMQkdIq+6Koulxv6ofkCcv3d1xtO2W7nb5yxcpVBP
589 rRfGFGebJvZa58DymCNgyGtAU6AOz4veavNmI2+GIDQsY66+tYDvZ+CxwzdYu+HD
590 V9HmrJfc6deM0mnBn7SRjqzxJPgoTQhihTav6q/R5/2p5NvQ/H84OgS6GjosfGc2
591 duUDzCP/kheMRKfzuyKCOHQPtJuIj8++gfpHtEU7IDUX1So3c9n0PdpeBvclsDbp
592 RnCNxQWU4mBot7kCDQQ+PqMdEAgA7+GJfxbMdY4wslPnjH9rF4N2qfWsEN/lxaZo
593 JYc3a6M02WCnHl6ahT2/tBK2w1QI4YFteR47gCvtgb6O1JHffOo2HfLmRDRiRjd1
594 DTCHqeyX7CHhcghj/dNRlW2Z0l5QFEcmV9U0Vhp3aFfWC4Ujfs3LU+hkAWzE7zaD
595 5cH9J7yv/6xuZVw411x0h4UqsTcWMu0iM1BzELqX1DY7LwoPEb/O9Rkbf4fmLe11
596 EzIaCa4PqARXQZc4dhSinMt6K3X4BrRsKTfozBu74F47D8Ilbf5vSYHbuE5p/1oI
597 Dznkg/p8kW+3FxuWrycciqFTcNz215yyX39LXFnlLzKUb/F5GwADBQf+Lwqqa8CG
598 rRfsOAJxim63CHfty5mUc5rUSnTslGYEIOCR1BeQauyPZbPDsDD9MZ1ZaSafanFv
599 wFG6Llx9xkU7tzq+vKLoWkm4u5xf3vn55VjnSd1aQ9eQnUcXiL4cnBGoTbOWI39E
600 cyzgslzBdC++MPjcQTcA7p6JUVsP6oAB3FQWg54tuUo0Ec8bsM8b3Ev42LmuQT5N
601 dKHGwHsXTPtl0klk4bQk4OajHsiy1BMahpT27jWjJlMiJc+IWJ0mghkKHt926s/y
602 mfdf5HkdQ1cyvsz5tryVI3Fx78XeSYfQvuuwqp2H139pXGEkg0n6KdUOetdZWhe7
603 0YGNPw1yjWJT1IhUBBgRAgAMBQJOdz3tBQkT+wG4ABIHZUdQRwABAQkQjHGNO1By
604 4fUUmwCbBYr2+bBEn/L2BOcnw9Z/QFWuhRMAoKVgCFm5fadQ3Afi+UQlAcOphrnJ
605 =Eto8
606 -----END PGP PUBLIC KEY BLOCK-----
608    To import the build key into your personal public GPG keyring, use
609    gpg --import. For example, if you have saved the key in a file
610    named mysql_pubkey.asc, the import command looks like this:
611 shell> gpg --import mysql_pubkey.asc
612 gpg: key 5072E1F5: public key "MySQL Release Engineering
613 <mysql-build@oss.oracle.com>" imported
614 gpg: Total number processed: 1
615 gpg:               imported: 1
616 gpg: no ultimately trusted keys found
618    You can also download the key from the public keyserver using the
619    public key id, 5072E1F5:
620 shell> gpg --recv-keys 5072E1F5
621 gpg: requesting key 5072E1F5 from hkp server keys.gnupg.net
622 gpg: key 5072E1F5: "MySQL Release Engineering <mysql-build@oss.oracle
623 .com>"
624 1 new user ID
625 gpg: key 5072E1F5: "MySQL Release Engineering <mysql-build@oss.oracle
626 .com>"
627 53 new signatures
628 gpg: no ultimately trusted keys found
629 gpg: Total number processed: 1
630 gpg:           new user IDs: 1
631 gpg:         new signatures: 53
633    If you want to import the key into your RPM configuration to
634    validate RPM install packages, you should be able to import the
635    key directly:
636 shell> rpm --import mysql_pubkey.asc
638    If you experience problems or require RPM specific information,
639    see Section 2.1.4.4, "Signature Checking Using RPM."
641    After you have downloaded and imported the public build key,
642    download your desired MySQL package and the corresponding
643    signature, which also is available from the download page. The
644    signature file has the same name as the distribution file with an
645    .asc extension, as shown by the examples in the following table.
647    Table 2.1. MySQL Package and Signature Files for Source files
648        File Type                      File Name
649    Distribution file mysql-standard-5.1.74-linux-i686.tar.gz
650    Signature file    mysql-standard-5.1.74-linux-i686.tar.gz.asc
652    Make sure that both files are stored in the same directory and
653    then run the following command to verify the signature for the
654    distribution file:
655 shell> gpg --verify package_name.asc
657    If the downloaded package is valid, you will see a "Good
658    signature" similar to:
659 shell> gpg --verify mysql-standard-5.1.74-linux-i686.tar.gz.asc
660 gpg: Signature made Tue 01 Feb 2011 02:38:30 AM CST using DSA key ID
661 5072E1F5
662 gpg: Good signature from "MySQL Release Engineering <mysql-build@oss.
663 oracle.com>"
665    The Good signature message indicates that the file signature is
666    valid, when compared to the signature listed on our site. But you
667    might also see warnings, like so:
668 shell> gpg --verify mysql-standard-5.1.74-linux-i686.tar.gz.asc
669 gpg: Signature made Wed 23 Jan 2013 02:25:45 AM PST using DSA key ID
670 5072E1F5
671 gpg: checking the trustdb
672 gpg: no ultimately trusted keys found
673 gpg: Good signature from "MySQL Release Engineering <mysql-build@oss.
674 oracle.com>"
675 gpg: WARNING: This key is not certified with a trusted signature!
676 gpg:          There is no indication that the signature belongs to th
677 e owner.
678 Primary key fingerprint: A4A9 4068 76FC BD3C 4567  70C8 8C71 8D3B 507
679 2 E1F5
681    That is normal, as they depend on your setup and configuration.
682    Here are explanations for these warnings:
684      * gpg: no ultimately trusted keys found: This means that the
685        specific key is not "ultimately trusted" by you or your web of
686        trust, which is okay for the purposes of verifying file
687        signatures.
689      * WARNING: This key is not certified with a trusted signature!
690        There is no indication that the signature belongs to the
691        owner.: This refers to your level of trust in your belief that
692        you possess our real public key. This is a personal decision.
693        Ideally, a MySQL developer would hand you the key in person,
694        but more commonly, you downloaded it. Was the download
695        tampered with? Probably not, but this decision is up to you.
696        Setting up a web of trust is one method for trusting them.
698    See the GPG documentation for more information on how to work with
699    public keys.
701 2.1.4.3. Signature Checking Using Gpg4win for Windows
703    The Section 2.1.4.2, "Signature Checking Using GnuPG" section
704    describes how to verify MySQL downloads using GPG. That guide also
705    applies to Microsoft Windows, but another option is to use a GUI
706    tool like Gpg4win (http://www.gpg4win.org/). You may use a
707    different tool but our examples are based on Gpg4win, and utilize
708    its bundled Kleopatra GUI.
710    Download and install Gpg4win, and then load Kleopatra. The dialog
711    should look similar to:
713    Figure 2.1. Initial screen after loading Kleopatra
714    Initial screen after loading Kleopatra
716    Next, add the MySQL Release Engineering certificate. Do this by
717    clicking File, Lookup Certificates on Server. Type "Mysql Release
718    Engineering" into the search box and press Search.
720    Figure 2.2. Finding the MySQL Release Engineering certificate
721    Finding the MySQL Release Engineering certificate
723    Select the "MySQL Release Engineering" certificate. The
724    Fingerprint and Key-ID must be "5072E1F5", or choose Details... to
725    confirm the certificate is valid. Now, import it by clicking
726    Import. An import dialog will be displayed, choose Okay, and this
727    certificate will now be listed under the Imported Certificates
728    tab.
730    Next, configure the trust level for our certificate. Select our
731    certificate, then from the main menu select Certificates, Change
732    Owner Trust.... We suggest choosing I believe checks are very
733    accurate for our certificate, as otherwise you might not be able
734    to verify our signature. Select I believe checks are very accurate
735    and then press OK.
737    Figure 2.3. Changing the Trust level
738    Changing the Trust level
740    Next, verify the downloaded MySQL package file. This requires
741    files for both the packaged file, and the signature. The signature
742    file must have the same name as the packaged file but with an
743    appended .asc extension, as shown by the example in the following
744    table. The signature is linked to on the downloads page for each
745    MySQL product. You must create the .asc file with this signature.
747    Table 2.2. MySQL Package and Signature Files for MySQL Installer
748    for Microsoft Windows
749        File Type                    File Name
750    Distribution file mysql-installer-community-5.1.74.msi
751    Signature file    mysql-installer-community-5.1.74.msi.asc
753    Make sure that both files are stored in the same directory and
754    then run the following command to verify the signature for the
755    distribution file. Either drag and drop the signature (.asc) file
756    into Kleopatra, or load the dialog from File, Decrypt/Verify
757    Files..., and then choose either the .msi or .asc file.
759    Figure 2.4. The Decrypt/Verify Files dialog
760    The Decrypt/Verify Files dialog
762    Click Decrypt/Verify to check the file. The two most common
763    results will look like the following, and although the yellow
764    warning looks problematic, the following means that the file check
765    passed with success. You may now run this installer.
767    Figure 2.5. The Decrypt/Verify Results: Good
768    The Decrypt/Verify Results: Good
770    Seeing a red "The signature is bad" error means the file is
771    invalid. Do not execute the MSI file if you see this error.
773    Figure 2.6. The Decrypt/Verify Results: Bad
774    The Decrypt/Verify Results: Bad
776    The Section 2.1.4.2, "Signature Checking Using GnuPG" section
777    explains why you probably don't see a green Good signature result.
779 2.1.4.4. Signature Checking Using RPM
781    For RPM packages, there is no separate signature. RPM packages
782    have a built-in GPG signature and MD5 checksum. You can verify a
783    package by running the following command:
784 shell> rpm --checksig package_name.rpm
786    Example:
787 shell> rpm --checksig MySQL-server-5.1.74-0.glibc23.i386.rpm
788 MySQL-server-5.1.74-0.glibc23.i386.rpm: md5 gpg OK
790    Note
792    If you are using RPM 4.1 and it complains about (GPG) NOT OK
793    (MISSING KEYS: GPG#5072e1f5), even though you have imported the
794    MySQL public build key into your own GPG keyring, you need to
795    import the key into the RPM keyring first. RPM 4.1 no longer uses
796    your personal GPG keyring (or GPG itself). Rather, RPM maintains a
797    separate keyring because it is a system-wide application and a
798    user's GPG public keyring is a user-specific file. To import the
799    MySQL public key into the RPM keyring, first obtain the key, then
800    use rpm --import to import the key. For example:
801 shell> gpg --export -a 5072e1f5 > 5072e1f5.asc
802 shell> rpm --import 5072e1f5.asc
804    Alternatively, rpm also supports loading the key directly from a
805    URL, and you can use this manual page:
806 shell> rpm --import http://dev.mysql.com/doc/refman/5.1/en/checking-g
807 pg-signature.html
809    If you need to obtain the MySQL public key, see Section 2.1.4.2,
810    "Signature Checking Using GnuPG."
812 2.1.5. Installation Layouts
814    The installation layout differs for different installation types
815    (for example, native packages, binary tarballs, and source
816    tarballs), which can lead to confusion when managing different
817    systems or using different installation sources. The individual
818    layouts are given in the corresponding installation type or
819    platform chapter, as described following. Note that the layout of
820    installations from vendors other than Oracle may differ from these
821    layouts.
823      * Section 2.3.1, "MySQL Installation Layout on Microsoft
824        Windows"
826      * Section 2.11.1, "MySQL Layout for Source Installation"
828      * Section 2.2, "MySQL Installation Layout for Generic Unix/Linux
829        Binary Package"
831      * Section 2.5.1, "MySQL Installation Layout for Linux RPM
832        Packages"
834      * Section 2.4.2, "MySQL Installation Layout on Mac OS X"
836 2.1.6. Compiler-Specific Build Characteristics
838    In some cases, the compiler used to build MySQL affects the
839    features available for use. The notes in this section apply for
840    binary distributions provided by Oracle Corporation or that you
841    compile yourself from source.
843    icc (Intel C++ Compiler) Builds
845    A server built with icc has these characteristics:
847      * SSL support is not included.
849      * InnoDB Plugin is not included.
851 2.2. Installing MySQL on Unix/Linux Using Generic Binaries
853    Oracle provides a set of binary distributions of MySQL. These
854    include binary distributions in the form of compressed tar files
855    (files with a .tar.gz extension) for a number of platforms, as
856    well as binaries in platform-specific package formats for selected
857    platforms.
859    This section covers the installation of MySQL from a compressed
860    tar file binary distribution. For other platform-specific package
861    formats, see the other platform-specific sections. For example,
862    for Windows distributions, see Section 2.3, "Installing MySQL on
863    Microsoft Windows."
865    To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
867    MySQL compressed tar file binary distributions have names of the
868    form mysql-VERSION-OS.tar.gz, where VERSION is a number (for
869    example, 5.1.74), and OS indicates the type of operating system
870    for which the distribution is intended (for example, pc-linux-i686
871    or winx64).
873    To install MySQL from a compressed tar file binary distribution,
874    your system must have GNU gunzip to uncompress the distribution
875    and a reasonable tar to unpack it. If your tar program supports
876    the z option, it can both uncompress and unpack the file.
878    GNU tar is known to work. The standard tar provided with some
879    operating systems is not able to unpack the long file names in the
880    MySQL distribution. You should download and install GNU tar, or if
881    available, use a preinstalled version of GNU tar. Usually this is
882    available as gnutar, gtar, or as tar within a GNU or Free Software
883    directory, such as /usr/sfw/bin or /usr/local/bin. GNU tar is
884    available from http://www.gnu.org/software/tar/.
885    Warning
887    If you have previously installed MySQL using your operating system
888    native package management system, such as yum or apt-get, you may
889    experience problems installing using a native binary. Make sure
890    your previous MySQL previous installation has been removed
891    entirely (using your package management system), and that any
892    additional files, such as old versions of your data files, have
893    also been removed. You should also check the existence of
894    configuration files such as /etc/my.cnf or the /etc/mysql
895    directory have been deleted.
897    If you run into problems and need to file a bug report, please use
898    the instructions in Section 1.7, "How to Report Bugs or Problems."
900    On Unix, to install a compressed tar file binary distribution,
901    unpack it at the installation location you choose (typically
902    /usr/local/mysql). This creates the directories shown in the
903    following table.
905    Table 2.3. MySQL Installation Layout for Generic Unix/Linux Binary
906    Package
907    Directory Contents of Directory
908    bin Client programs and the mysqld server
909    data Log files, databases
910    docs Manual in Info format
911    man Unix manual pages
912    include Include (header) files
913    lib Libraries
914    scripts mysql_install_db
915    share Miscellaneous support files, including error messages,
916    sample configuration files, SQL for database installation
917    sql-bench Benchmarks
919    Debug versions of the mysqld binary are available as mysqld-debug.
920    To compile your own debug version of MySQL from a source
921    distribution, use the appropriate configuration options to enable
922    debugging support. For more information on compiling from source,
923    see Section 2.11, "Installing MySQL from Source."
925    To install and use a MySQL binary distribution, the basic command
926    sequence looks like this:
927 shell> groupadd mysql
928 shell> useradd -r -g mysql mysql
929 shell> cd /usr/local
930 shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
931 shell> ln -s full-path-to-mysql-VERSION-OS mysql
932 shell> cd mysql
933 shell> chown -R mysql .
934 shell> chgrp -R mysql .
935 shell> scripts/mysql_install_db --user=mysql
936 shell> chown -R root .
937 shell> chown -R mysql data
938 # Next command is optional
939 shell> cp support-files/my-medium.cnf /etc/my.cnf
940 shell> bin/mysqld_safe --user=mysql &
941 # Next command is optional
942 shell> cp support-files/mysql.server /etc/init.d/mysql.server
944    A more detailed version of the preceding description for
945    installing a binary distribution follows.
946    Note
948    This procedure assumes that you have root (administrator) access
949    to your system. Alternatively, you can prefix each command using
950    the sudo (Linux) or pfexec (OpenSolaris) command.
952    The procedure does not set up any passwords for MySQL accounts.
953    After following the procedure, proceed to Section 2.12.2,
954    "Securing the Initial MySQL Accounts."
956 Create a mysql User and Group
958    If your system does not already have a user and group for mysqld
959    to run as, you may need to create one. The following commands add
960    the mysql group and the mysql user. You might want to call the
961    user and group something else instead of mysql. If so, substitute
962    the appropriate name in the following instructions. The syntax for
963    useradd and groupadd may differ slightly on different versions of
964    Unix, or they may have different names such as adduser and
965    addgroup.
966 shell> groupadd mysql
967 shell> useradd -r -g mysql mysql
969    Note
971    Because the user is required only for ownership purposes, not
972    login purposes, the useradd command uses the -r option to create a
973    user that does not have login permissions to your server host.
974    Omit this option to permit logins for the user (or if your useradd
975    does not support the option).
977 Obtain and Unpack the Distribution
979    Pick the directory under which you want to unpack the distribution
980    and change location into it. The example here unpacks the
981    distribution under /usr/local. The instructions, therefore, assume
982    that you have permission to create files and directories in
983    /usr/local. If that directory is protected, you must perform the
984    installation as root.
985 shell> cd /usr/local
987    Obtain a distribution file using the instructions in Section
988    2.1.3, "How to Get MySQL." For a given release, binary
989    distributions for all platforms are built from the same MySQL
990    source distribution.
992    Unpack the distribution, which creates the installation directory.
993    Then create a symbolic link to that directory. tar can uncompress
994    and unpack the distribution if it has z option support:
995 shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
996 shell> ln -s full-path-to-mysql-VERSION-OS mysql
998    The tar command creates a directory named mysql-VERSION-OS. The ln
999    command makes a symbolic link to that directory. This enables you
1000    to refer more easily to the installation directory as
1001    /usr/local/mysql.
1003    If your tar does not have z option support, use gunzip to unpack
1004    the distribution and tar to unpack it. Replace the preceding tar
1005    command with the following alternative command to uncompress and
1006    extract the distribution:
1007 shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
1009 Perform Postinstallation Setup
1011    The remainder of the installation process involves setting up the
1012    configuration file, creating the core databases, and starting the
1013    MySQL server. For next steps, see Section 2.12, "Postinstallation
1014    Setup and Testing."
1015    Note
1017    The accounts that are listed in the MySQL grant tables initially
1018    have no passwords. After starting the server, you should set up
1019    passwords for them using the instructions in Section 2.12.2,
1020    "Securing the Initial MySQL Accounts."
1022 2.3. Installing MySQL on Microsoft Windows
1024    MySQL for Microsoft Windows is available in a number of different
1025    forms. A Microsoft Windows operating system such as Windows 2000,
1026    Windows XP, Windows Vista, Windows 7, Windows Server 2003, or
1027    Windows Server 2008. Both 32-bit and 64-bit versions are
1028    supported. For supported platform information, see
1029    http://www.mysql.com/support/supportedplatforms/database.html.
1031    In addition to running MySQL as a standard application, you can
1032    also run the MySQL server as a Windows service. By using a service
1033    you can monitor and control the operation of the server through
1034    the standard Windows service management tools. For more
1035    information, see Section 2.3.6.7, "Starting MySQL Server as a
1036    Microsoft Windows Service."
1038    Generally, you should install MySQL on Windows using an account
1039    that has administrator rights. Otherwise, you may encounter
1040    problems with certain operations such as editing the PATH
1041    environment variable or accessing the Service Control Manager.
1042    Once installed, MySQL does not need to be executed using a user
1043    with Administrator privileges.
1045    For a list of limitations within the Windows version of MySQL, see
1046    Section E.7.6, "Windows Platform Limitations."
1048    In addition to the MySQL Server package, you may need or want
1049    additional components to use MySQL with your application or
1050    development environment. These include, but are not limited to:
1052      * If you plan to connect to the MySQL server using ODBC, you
1053        need a Connector/ODBC driver. For more information, including
1054        installation and configuration instructions, see Section 21.1,
1055        "MySQL Connector/ODBC."
1057      * If you plan to use MySQL server with .NET applications, you
1058        need the Connector/Net driver. For more information, including
1059        installation and configuration instructions, see Section 21.2,
1060        "MySQL Connector/Net."
1062    MySQL distributions for Windows can be downloaded from
1063    http://dev.mysql.com/downloads/. See Section 2.1.3, "How to Get
1064    MySQL."
1066    MySQL for Windows is available in several distribution formats,
1067    detailed below. Generally speaking, you should use a binary
1068    distribution that includes an installer. It is simpler to use than
1069    the others, and you need no additional tools to get MySQL up and
1070    running. The installer for the Windows version of MySQL, combined
1071    with a GUI Config Wizard, automatically installs MySQL, creates an
1072    option file, starts the server, and secures the default user
1073    accounts.
1075      * Binary installer distribution. The installable distribution
1076        comes packaged as a Microsoft Windows Installer (MSI) package
1077        that you can install manually or automatically on your
1078        systems. Two formats are available, an essentials package that
1079        contains all the files you need to install and configure
1080        MySQL, but no additional components, and a complete package
1081        that includes MySQL, configuration tools, benchmarks and other
1082        components. For more information on the specific differences,
1083        see Section 2.3.2, "Choosing the Installation Package for
1084        Microsoft Windows"
1085        For instructions on installing MySQL using one of the MSI
1086        installation packages, see Section 2.3.3, "Installing MySQL on
1087        Microsoft Windows Using an MSI Package."
1089      * Standard binary distribution format packaged as a Zip file
1090        containing all of the necessary files that you unpack into
1091        your chosen location. This package contains all of the files
1092        in the full Windows MSI Installer package, but does not
1093        include an installation program.
1094        For instructions on installing MySQL using the Zip file, see
1095        Section 2.3.6, "Installing MySQL on Microsoft Windows Using a
1096        noinstall Zip Archive."
1098      * The source distribution contains all the code and support
1099        files for building the executables using the Visual Studio
1100        compiler system.
1101        For instructions on building MySQL from source on Windows, see
1102        Section 2.11.7, "Installing MySQL from Source on Windows."
1104    MySQL on Windows considerations:
1106      * Large Table Support
1107        If you need tables with a size larger than 4GB, install MySQL
1108        on an NTFS or newer file system. Do not forget to use MAX_ROWS
1109        and AVG_ROW_LENGTH when you create tables. See Section
1110        13.1.17, "CREATE TABLE Syntax."
1112      * MySQL and Virus Checking Software
1113        Using virus scanning software such as Norton/Symantec
1114        Anti-Virus on directories containing MySQL data and temporary
1115        tables can cause issues, both in terms of the performance of
1116        MySQL and the virus-scanning software mis-identifying the
1117        contents of the files as containing spam. This is because of
1118        the fingerprinting mechanism used by the virus scanning
1119        software, and the way in which MySQL rapidly updates different
1120        files, which may be identified as a potential security risk.
1121        After installing MySQL Server, it is recommended that you
1122        disable virus scanning on the main directory (datadir) being
1123        used to store your MySQL table data. There is usually a system
1124        built into the virus scanning software to permit certain
1125        directories to be specifically ignored during virus scanning.
1126        In addition, by default, MySQL creates temporary files in the
1127        standard Windows temporary directory. To prevent the temporary
1128        files also being scanned, you should configure a separate
1129        temporary directory for MySQL temporary files and add this to
1130        the virus scanning exclusion list. To do this, add a
1131        configuration option for the tmpdir parameter to your my.ini
1132        configuration file. For more information, see Section 2.3.6.2,
1133        "Creating an Option File."
1135 2.3.1. MySQL Installation Layout on Microsoft Windows
1137    For MySQL 5.1 on Windows, the default installation directory is
1138    C:\Program Files\MySQL\MySQL Server 5.1. Some Windows users prefer
1139    to install in C:\mysql, the directory that formerly was used as
1140    the default. However, the layout of the subdirectories remains the
1141    same.
1143    For MySQL 5.1.23 and earlier, all of the files are located within
1144    the parent directory, using the structure shown in the following
1145    table.
1147    Table 2.4. Installation Layout for Windows Using MySQL 5.1.23 and
1148    Earlier
1149    Directory Contents of Directory
1150    bin Client programs and the mysqld server
1151    data Log files, databases
1152    examples Example programs and scripts
1153    include Include (header) files
1154    lib Libraries
1155    scripts Utility scripts
1156    share Miscellaneous support files, including error messages,
1157    character set files, sample configuration files, SQL for database
1158    installation
1160    For MySQL 5.1.24 and later, the default location of data directory
1161    was changed. The remainder of the directory structure remains the
1162    same.
1164    Table 2.5. Installation Layout for Microsoft Windows using MySQL
1165    5.1.24 and later
1166    Directory Contents of Directory Notes
1167    bin Client programs and the mysqld server
1168    %ALLUSERSPROFILE%\MySQL\MySQL Server 5.1\ Log files, databases
1169    (Windows XP, Windows Server 2003) The Windows system variable
1170    %ALLUSERSPROFILE% defaults to C:\Documents and Settings\All
1171    Users\Application Data
1172    %PROGRAMDATA%\MySQL\MySQL Server 5.1\ Log files, databases (Vista,
1173    Windows 7, Windows Server 2008, and newer) The Windows system
1174    variable %PROGRAMDATA% defaults to C:\ProgramData
1175    examples Example programs and scripts
1176    include Include (header) files
1177    lib Libraries
1178    scripts Utility scripts
1179    share Miscellaneous support files, including error messages,
1180    character set files, sample configuration files, SQL for database
1181    installation
1183 2.3.2. Choosing the Installation Package for Microsoft Windows
1185    For MySQL 5.1, there are three installation package formats to
1186    choose from when installing MySQL on Windows:
1187    Note
1189    Using MySQL Installer is the recommended installation method for
1190    Microsoft Windows users. The MySQL Server 5.1 release does not
1191    include its own MySQL Installer release, but a MySQL Installer
1192    version 5.5 and above can optionally install MySQL Server 5.1.
1193    Follow the standard Installing MySQL on Microsoft Windows Using
1194    MySQL Installer
1195    (http://dev.mysql.com/doc/refman/5.5/en/mysql-installer.html)
1196    documentation but choose Custom Install after executing it. A
1197    MySQL Server 5.1 option will be available, and choosing it will
1198    cause MySQL Installer to download it for you.
1200    Table 2.6. Microsoft Windows MySQL Installation package comparison
1201      Packaging
1202    Feature Essentials Complete Zip (No-install)
1203    Installer Yes Yes No
1204    Directory-only
1205    MySQL Server Instance Config Wizard Yes Yes No
1206    Test Suite No Yes Yes
1207    MySQL Server Yes Yes Yes
1208    MySQL Client Programs Yes Yes Yes
1209    C Headers/Libraries Yes Yes Yes
1210    Embedded Server No Optional Yes
1211    Scripts and Examples No Optional Yes
1213    In the above table:
1215      * Yes indicates that the component is installed by default.
1217      * No indicates that the component is not installed or included.
1219      * Optional indicates that the component is included with the
1220        package, but not installed unless explicitly requested using
1221        the Custom installation mode.
1223    The workflow for installing using the MSI installer is shown
1224    below:
1226    Figure 2.7. Installation Workflow for Windows Using MSI
1227    Installation Workflow for Windows using MSI
1229    The workflow for installing using the MSI installer is shown
1230    below:
1232    Figure 2.8. Installation Workflow for Windows Using Zip
1233    Installation Workflow for Windows using Zip
1234    Note
1236    For the Essentials and Complete packages in the MSI installer, you
1237    can select individual components to be installed by using the
1238    Custom mode, including disable the components confiurated for
1239    installation by default.
1241    Full details on the components are suggested uses are provided
1242    below for reference:
1244      * Windows Essentials: This package has a file name similar to
1245        mysql-essential-5.1.74-win32.msi and is supplied as a
1246        Microsoft Installer (MSI) package. The package includes the
1247        minimum set of files needed to install MySQL on Windows,
1248        including the MySQL Server Instance Config Wizard. This
1249        package does not include optional components such as the
1250        embedded server, developer headers and libraries or benchmark
1251        suite.
1252        To install using this package, see Section 2.3.3, "Installing
1253        MySQL on Microsoft Windows Using an MSI Package."
1255      * Windows MSI Installer (Complete): This package has a file name
1256        similar to mysql-5.1.74-win32.msi and contains all files
1257        needed for a complete Windows installation, including the
1258        MySQL Server Instance Config Wizard. This package includes
1259        optional components such as the embedded server and benchmark
1260        suite.
1261        To install using this package, see Section 2.3.3, "Installing
1262        MySQL on Microsoft Windows Using an MSI Package."
1264      * Without installer: This package has a file name similar to
1265        mysql-noinstall-5.1.74-win32.zip and contains all the files
1266        found in the Complete install package, with the exception of
1267        the MySQL Server Instance Config Wizard. This package does not
1268        include an automated installer, and must be manually installed
1269        and configured.
1271    The Essentials package is recommended for most users. Both the
1272    Essentials and Complete distributions are available as an .msi
1273    file for use with the Windows Installer. The Noinstall
1274    distribution is packaged as a Zip archive. To use a Zip archive,
1275    you must have a tool that can unpack .zip files.
1277    When using the MSI installers you can automate the installation
1278    process. For more information, see Section 2.3.3.2, "Automating
1279    MySQL Installation on Microsoft Windows Using the MSI Package." To
1280    automate the creation of a MySQL instance, see Section 2.3.5.13,
1281    "MySQL Server Instance Config Wizard: Creating an Instance from
1282    the Command Line."
1284    Your choice of install package affects the installation process
1285    you must follow. If you choose to install either an Essentials or
1286    Complete install package, see Section 2.3.3, "Installing MySQL on
1287    Microsoft Windows Using an MSI Package." If you choose to install
1288    a Noinstall archive, see Section 2.3.6, "Installing MySQL on
1289    Microsoft Windows Using a noinstall Zip Archive."
1291 2.3.3. Installing MySQL on Microsoft Windows Using an MSI Package
1293    The MSI package is designed to install and configure MySQL in such
1294    a way that you can immediately get started using MySQL.
1296    The MySQL Installation Wizard and MySQL Configuration Wizard are
1297    available in the Essentials and Complete install packages. They
1298    are recommended for most standard MySQL installations. Exceptions
1299    include users who need to install multiple instances of MySQL on a
1300    single server host and advanced users who want complete control of
1301    server configuration.
1303      * For information on installing using the GUI MSI installer
1304        process, see Section 2.3.3.1, "Using the MySQL Installation
1305        Wizard for Microsoft Windows."
1307      * For information on installing using the command line using the
1308        MSI package, see Section 2.3.3.2, "Automating MySQL
1309        Installation on Microsoft Windows Using the MSI Package."
1311      * If you have previously installed MySQL using the MSI package
1312        and want to remove MySQL, see Section 2.3.3.3, "Removing MySQL
1313        When Installed from the MSI Package."
1315    The workflow sequence for using the installer is shown in the
1316    figure below:
1318    Figure 2.9. Installation Workflow for Windows Using MSI Installer
1319    Installation Workflow for Windows using MSI Installer
1320    Note
1322    Microsoft Windows XP and later include a firewall which
1323    specifically blocks ports. If you plan on using MySQL through a
1324    network port then you should open and create an exception for this
1325    port before performing the installation. To check and if necessary
1326    add an exception to the firewall settings:
1328     1. First ensure that you are logged in as an Administrator or a
1329        user with Administrator privileges.
1331     2. Go to the Control Panel, and double click the Windows Firewall
1332        icon.
1334     3. Choose the Allow a program through Windows Firewall option and
1335        click the Add port button.
1337     4. Enter MySQL into the Name text box and 3306 (or the port of
1338        your choice) into the Port number text box.
1340     5. Also ensure that the TCP protocol radio button is selected.
1342     6. If you wish, you can also limit access to the MySQL server by
1343        choosing the Change scope button.
1345     7. Confirm your choices by clicking the OK button.
1347    Additionally, when running the MySQL Installation Wizard on
1348    Windows Vista or newer, ensure that you are logged in as a user
1349    with administrative rights.
1350    Note
1352    When using Windows Vista or newer, you may want to disable User
1353    Account Control (UAC) before performing the installation. If you
1354    do not do so, then MySQL may be identified as a security risk,
1355    which will mean that you need to enable MySQL. You can disable the
1356    security checking by following these instructions:
1358     1. Open Control Panel.
1360     2. Under the User Accounts and Family Safety, select Add or
1361        remove user accounts.
1363     3. Click the Got to the main User Accounts page link.
1365     4. Click on Turn User Account Control on or off. You may be
1366        prompted to provide permission to change this setting. Click
1367        Continue.
1369     5. Deselect or uncheck the check box next to Use User Account
1370        Control (UAC) to help protect your computer. Click OK to save
1371        the setting.
1373    You will need to restart to complete the process. Click Restart
1374    Now to reboot the machine and apply the changes. You can then
1375    follow the instructions below for installing Windows.
1377 2.3.3.1. Using the MySQL Installation Wizard for Microsoft Windows
1379    MySQL Installation Wizard is an installer for the MySQL server
1380    that uses the latest installer technologies for Microsoft Windows.
1381    The MySQL Installation Wizard, in combination with the MySQL
1382    Config Wizard, enables a user to install and configure a MySQL
1383    server that is ready for use immediately after installation.
1385    The MySQL Installation Wizard uses the standard Microsoft
1386    Installer Engine (MSI) system is the standard installer for all
1387    MySQL server distributions. See Section 2.3.3.1.6, "MySQL
1388    Installation Wizard: Upgrading MySQL," for more information on
1389    upgrading from a previous version.
1391    If you are upgrading an installation from MySQL 5.1.31 or earlier
1392    to MySQL 5.1.32 or later, read the notes provided in Section
1393    2.3.3.1.6, "MySQL Installation Wizard: Upgrading MySQL."
1395    The Microsoft Windows Installer Engine was updated with the
1396    release of Windows XP; those using a previous version of Windows
1397    can reference this Microsoft Knowledge Base article
1398    (http://support.microsoft.com/default.aspx?scid=kb;EN-US;292539)
1399    for information on upgrading to the latest version of the Windows
1400    Installer Engine.
1402    In addition, Microsoft has introduced the WiX (Windows Installer
1403    XML) toolkit. This is the first highly acknowledged Open Source
1404    project from Microsoft. We have switched to WiX because it is an
1405    Open Source project and it enables us to handle the complete
1406    Windows installation process in a flexible manner using scripts.
1408    Improving the MySQL Installation Wizard depends on the support and
1409    feedback of users like you. If you find that the MySQL
1410    Installation Wizard is lacking some feature important to you, or
1411    if you discover a bug, please report it in our bugs database using
1412    the instructions given in Section 1.7, "How to Report Bugs or
1413    Problems."
1415 2.3.3.1.1. MySQL Installation Wizard: Downloading and Starting
1417    The MySQL installation packages can be downloaded from
1418    http://dev.mysql.com/downloads/. If the package you download is
1419    contained within a Zip archive, you need to extract the archive
1420    first.
1422    The process for starting the wizard depends on the contents of the
1423    installation package you download. If there is a setup.exe file
1424    present, double-click it to start the installation process. If
1425    there is an .msi file present, double-click it to start the
1426    installation process.
1428 2.3.3.1.2. MySQL Installation Wizard: Choosing an Install Type
1430    There are three installation types available: Typical, Complete,
1431    and Custom.
1433    The Typical installation type installs the MySQL server, the mysql
1434    command-line client, and the command-line utilities. The
1435    command-line clients and utilities include mysqldump, myisamchk,
1436    and several other tools to help you manage the MySQL server.
1438    The Complete installation type installs all components included in
1439    the installation package. The full installation package includes
1440    components such as the embedded server library, the benchmark
1441    suite, support scripts, and documentation.
1443    The Custom installation type gives you complete control over which
1444    packages you wish to install and the installation path that is
1445    used. See Section 2.3.3.1.3, "MySQL Installation Wizard: The
1446    Custom Install Dialog," for more information on performing a
1447    custom install.
1449    If you choose the Typical or Complete installation types and click
1450    the Next button, you advance to the confirmation screen to verify
1451    your choices and begin the installation. If you choose the Custom
1452    installation type and click the Next button, you advance to the
1453    custom installation dialog, described in Section 2.3.3.1.3, "MySQL
1454    Installation Wizard: The Custom Install Dialog."
1456 2.3.3.1.3. MySQL Installation Wizard: The Custom Install Dialog
1458    If you wish to change the installation path or the specific
1459    components that are installed by the MySQL Installation Wizard,
1460    choose the Custom installation type.
1462    A tree view on the left side of the custom install dialog lists
1463    all available components. Components that are not installed have a
1464    red X icon; components that are installed have a gray icon. To
1465    change whether a component is installed, click that component's
1466    icon and choose a new option from the drop-down list that appears.
1468    You can change the default installation path by clicking the
1469    Change... button to the right of the displayed installation path.
1471    After choosing your installation components and installation path,
1472    click the Next button to advance to the confirmation dialog.
1474 2.3.3.1.4. MySQL Installation Wizard: The Confirmation Dialog
1476    Once you choose an installation type and optionally choose your
1477    installation components, you advance to the confirmation dialog.
1478    Your installation type and installation path are displayed for you
1479    to review.
1481    To install MySQL if you are satisfied with your settings, click
1482    the Install button. To change your settings, click the Back
1483    button. To exit the MySQL Installation Wizard without installing
1484    MySQL, click the Cancel button.
1486    In MySQL 5.1.47 and earlier, after installation is complete, you
1487    have the option of registering with the MySQL web site.
1488    Registration gives you access to post in the MySQL forums at
1489    forums.mysql.com (http://forums.mysql.com), along with the ability
1490    to report bugs at bugs.mysql.com (http://bugs.mysql.com) and to
1491    subscribe to our newsletter.
1493    The final screen of the installer provides a summary of the
1494    installation and gives you the option to launch the MySQL Config
1495    Wizard, which you can use to create a configuration file, install
1496    the MySQL service, and configure security settings.
1498 2.3.3.1.5. MySQL Installation Wizard: Changes Made
1500    Once you click the Install button, the MySQL Installation Wizard
1501    begins the installation process and makes certain changes to your
1502    system which are described in the sections that follow.
1504    Changes to the Registry
1506    The MySQL Installation Wizard creates one Windows registry key in
1507    a typical install situation, located in
1508    HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB. For 64-bit Windows, the
1509    registry location is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MYSQL
1510    AB. A server version specific entry will be created for each major
1511    version of MySQL that you install.
1513    The MySQL Installation Wizard creates a key named after the major
1514    version of the server that is being installed, such as MySQL
1515    Server 5.1. It contains two string values, Location and Version.
1516    The Location string contains the path to the installation
1517    directory. In a default installation it contains C:\Program
1518    Files\MySQL\MySQL Server 5.1\. The Version string contains the
1519    release number. For example, for an installation of MySQL Server
1520    5.1.74, the key contains a value of 5.1.74.
1522    These registry keys are used to help external tools identify the
1523    installed location of the MySQL server, preventing a complete scan
1524    of the hard-disk to determine the installation path of the MySQL
1525    server. The registry keys are not required to run the server, and
1526    if you install MySQL using the noinstall Zip archive, the registry
1527    keys are not created.
1529    Changes to the Start Menu
1531    The MySQL Installation Wizard creates a new entry in the Windows
1532    Start menu under a common MySQL menu heading named after the major
1533    version of MySQL that you have installed. For example, if you
1534    install MySQL 5.1, the MySQL Installation Wizard creates a MySQL
1535    Server 5.1 section in the Start menu.
1537    The following entries are created within the new Start menu
1538    section:
1540      * MySQL Command-Line Client: This is a shortcut to the mysql
1541        command-line client and is configured to connect as the root
1542        user. The shortcut prompts for a root user password when you
1543        connect.
1545      * MySQL Server Instance Config Wizard: This is a shortcut to the
1546        MySQL Config Wizard. Use this shortcut to configure a newly
1547        installed server, or to reconfigure an existing server.
1549      * MySQL Documentation: This is a link to the MySQL server
1550        documentation that is stored locally in the MySQL server
1551        installation directory. This option is not available when the
1552        MySQL server is installed using the Essentials installation
1553        package.
1555    Changes to the File System
1557    The MySQL Installation Wizard by default installs the MySQL 5.1
1558    server to C:\Program Files\MySQL\MySQL Server 5.1, where Program
1559    Files is the default location for applications in your system, and
1560    5.1 is the major version of your MySQL server. This is the
1561    recommended location for the MySQL server, replacing the former
1562    default location C:\mysql.
1564    By default, all MySQL applications are stored in a common
1565    directory at C:\Program Files\MySQL, where Program Files is the
1566    default location for applications in your Windows installation. A
1567    typical MySQL installation on a developer machine might look like
1568    this:
1569 C:\Program Files\MySQL\MySQL Server 5.1
1570 C:\Program Files\MySQL\MySQL Workbench 5.1 OSS
1572    This approach makes it easier to manage and maintain all MySQL
1573    applications installed on a particular system.
1575    In MySQL 5.1.23 and earlier, the default location for the data
1576    files used by MySQL is located within the corresponding MySQL
1577    Server installation directory. For MySQL 5.1.24 and later, the
1578    default location of the data directory is the AppData directory
1579    configured for the user that installed the MySQL application.
1581 2.3.3.1.6. MySQL Installation Wizard: Upgrading MySQL
1583    The MySQL Installation Wizard can perform server upgrades
1584    automatically using the upgrade capabilities of MSI. That means
1585    you do not need to remove a previous installation manually before
1586    installing a new release. The installer automatically shuts down
1587    and removes the previous MySQL service before installing the new
1588    version.
1590    Automatic upgrades are available only when upgrading between
1591    installations that have the same major and minor version numbers.
1592    For example, you can upgrade automatically from MySQL 5.1.5 to
1593    MySQL 5.1.6, but not from MySQL 5.0 to MySQL 5.1.
1595    In MySQL 5.1.32 and later, the EXE version of the MSI installer
1596    packages were removed. When upgrading an existing MySQL
1597    installation from the old EXE based installer to the MSI based
1598    installer, please keep the following notes in mind:
1600      * The MSI installer will not identify an existing installation
1601        that was installed using the old EXE installer. This means
1602        that the installer will not stop the existing server, or
1603        detect that the existing password is required before
1604        installing the new version. To work around this:
1606          1. Stop the current server manually using net stop or
1607             mysqladmin shutdown.
1609          2. Remove the existing installation manually by using the
1610             Add/Remove Programs control panel. This will keep the
1611             existing configuration and data files, as these are not
1612             removed automatically.
1614          3. Install the new version of MySQL using the MSI installer.
1615             When running the installation, skip updating the security
1616             by deselecting the check box on the security screen.
1618          4. Complete the installation, and then start the server
1619             again. You should be able to login with your existing
1620             user and password credentials.
1622      * You can only upgrade the version and release using the MSI
1623        installer. For example, you can upgrade an open source
1624        installation with an open source installer. You cannot upgrade
1625        an open source installation using the enterprise installer.
1627    See Section 2.3.8, "Upgrading MySQL Server on Microsoft Windows."
1629 2.3.3.2. Automating MySQL Installation on Microsoft Windows Using the
1630 MSI Package
1632    The Microsoft Installer (MSI) supports a both a quiet and a
1633    passive mode that can be used to install MySQL automatically
1634    without requiring intervention. You can use this either in scripts
1635    to automatically install MySQL or through a terminal connection
1636    such as Telnet where you do not have access to the standard
1637    Windows user interface. The MSI packages can also be used in
1638    combination with Microsoft's Group Policy system (part of Windows
1639    Server 2003 and Windows Server 2008) to install MySQL across
1640    multiple machines.
1642    To install MySQL from one of the MSI packages automatically from
1643    the command line (or within a script), you need to use the
1644    msiexec.exe tool. For example, to perform a quiet installation
1645    (which shows no dialog boxes or progress):
1646 shell> msiexec /i mysql-5.1.74.msi /quiet
1648    The /i indicates that you want to perform an installation. The
1649    /quiet option indicates that you want no interactive elements.
1651    To provide a dialog box showing the progress during installation,
1652    and the dialog boxes providing information on the installation and
1653    registration of MySQL, use /passive mode instead of /quiet:
1654 shell> msiexec /i mysql-5.1.74.msi /passive
1656    Regardless of the mode of the installation, installing the package
1657    in this manner performs a 'Typical' installation, and installs the
1658    default components into the standard location.
1660    You can also use this method to uninstall MySQL by using the
1661    /uninstall or /x options:
1662 shell> msiexec /x mysql-5.1.74.msi /uninstall
1664    To install MySQL and configure a MySQL instance from the command
1665    line, see Section 2.3.5.13, "MySQL Server Instance Config Wizard:
1666    Creating an Instance from the Command Line."
1668    For information on using MSI packages to install software
1669    automatically using Group Policy, see How to use Group Policy to
1670    remotely install software in Windows Server 2003
1671    (http://support.microsoft.com/kb/816102).
1673 2.3.3.3. Removing MySQL When Installed from the MSI Package
1675    To uninstall a MySQL where you have used the MSI packages, you
1676    must use the Add/Remove Programs tool within Control Panel. To do
1677    this:
1679     1. Right-click the start menu and choose Control Panel.
1681     2. If the Control Panel is set to category mode (you will see
1682        Pick a category at the top of the Control Panel window),
1683        double-click Add or Remove Programs. If the Control is set to
1684        classic mode, double-click the Add or Remove Programs icon.
1686     3. Find MySQL in the list of installed software. MySQL Server is
1687        installed against major version numbers (MySQL 5.0, MySQL 5.1,
1688        etc.). Select the version that you want to remove and click
1689        Remove.
1691     4. You will be prompted to confirm the removal. Click Yes to
1692        remove MySQL.
1694    When MySQL is removed using this method, only the installed
1695    components are removed. Any database information (including the
1696    tables and data), import or export files, log files, and binary
1697    logs produced during execution are kept in their configured
1698    location.
1700    If you try to install MySQL again the information will be retained
1701    and you will be prompted to enter the password configured with the
1702    original installation.
1704    If you want to delete MySQL completely:
1706      * Delete the associated data directory. On Windows XP and
1707        Windows Server 2003, before MySQL 5.1.24, the default data
1708        directory would be located within the MySQL installation
1709        directory. On MySQL 5.1.24 and later, the default data
1710        directory is the configured AppData directory, which is
1711        C:\Documents and Settings\All Users\Application Data\MySQL by
1712        default.
1714      * On Windows 7 and Windows Server 2008, the default data
1715        directory location is C:\ProgramData\Mysql.
1716        Note
1717        The C:\ProgramData directory is hidden by default. You must
1718        change your folder options to view the hidden file. Choose
1719        Organize, Folder and search options, Show hidden folders.
1721 2.3.4. MySQL Notifier for Microsoft Windows
1723    The MySQL Notifier for Microsoft Windows is a tool that enables
1724    you to monitor and adjust the status of your local and remote
1725    MySQL Server instances through an indicator that resides in the
1726    system tray. The MySQL Notifier for Microsoft Windows also gives
1727    quick access to several MySQL GUI tools (such as MySQL Workbench)
1728    through its context menu.
1730    The MySQL Notifier for Microsoft Windows is installed by MySQL
1731    Installer, and (by default) will start-up when Microsoft Windows
1732    is started.
1733    Note
1735    To install, download and execute the MySQL Installer
1736    (http://dev.mysql.com/downloads/installer/), be sure the MySQL
1737    Notifier for Microsoft Windows product is selected, then proceed
1738    with the installation. See the MySQL Installer manual
1739    (http://dev.mysql.com/doc/refman/5.5/en/mysql-installer.html) for
1740    additional details.
1742    For release notes detailing the changes in each release of MySQL
1743    Notifier for Microsoft Windows, see the MySQL Notifier Release
1744    Notes (http://dev.mysql.com/doc/relnotes/mysql-notifier/en/).
1746    Visit the MySQL Notifier forum
1747    (http://forums.mysql.com/list.php?173) for additional MySQL
1748    Notifier for Microsoft Windows help and support.
1750    Features include:
1752      * Start, Stop, and Restart instances of the MySQL Server.
1754      * Automatically detects (and adds) new MySQL Server services.
1755        These are listed under Manage Monitored Items, and may also be
1756        configured.
1758      * The Tray icon changes, depending on the status. It's green if
1759        all monitored MySQL Server instances are running, or red if at
1760        least one service is stopped. The Update MySQL Notifier tray
1761        icon based on service status option, which dictates this
1762        behavior, is enabled by default for each service.
1764      * Links to other applications like MySQL Workbench, MySQL
1765        Installer, and the MySQL Utilities. For example, choosing
1766        Configure Instance will load the MySQL Workbench Server
1767        Administration window for that particular instance.
1769      * If MySQL Workbench is also installed, then the Configure
1770        Instance and SQL Editor options are available for local (but
1771        not remote) MySQL instances.
1773      * Monitoring of both local and remote MySQL instances.
1775    Note
1777    Remote monitoring is available since MySQL Notifier for Microsoft
1778    Windows 1.1.0.
1780    The MySQL Notifier for Microsoft Windows resides in the system
1781    tray and provides visual status information for your MySQL Server
1782    instances. A green icon is displayed at the top left corner of the
1783    tray icon if the current MySQL Server is running, or a red icon if
1784    the service is stopped.
1786    The MySQL Notifier for Microsoft Windows automatically adds
1787    discovered MySQL Services on the local machine, and each service
1788    is saved and configurable. By default, the Automatically add new
1789    services whose name contains option is enabled and set to mysql.
1790    Related Notifications Options include being notified when new
1791    services are either discovered or experience status changes, and
1792    are also enabled by default. And uninstalling a service will also
1793    remove the service from the MySQL Notifier for Microsoft Windows.
1794    Note
1796    The Automatically add new services whose name contains option
1797    default changed from ".*mysqld.*" to "mysql" in Notifier 1.1.0.
1799    Clicking the system tray icon will reveal several options, as seen
1800    in the screenshots below:
1802    The Service Instance menu is the main MySQL Notifier for Microsoft
1803    Windows window, and enables you to Stop, Start, and Restart the
1804    MySQL Server.
1806    Figure 2.10. MySQL Notifier for Microsoft Windows Service Instance
1807    menu
1808    MySQL Notifier for Microsoft Windows Service Instance menu
1810    The Actions menu includes several links to external applications
1811    (if they are installed), and a a Refresh Status option to manually
1812    refresh the status of all monitored services (in both local and
1813    remote computers) and MySQL instances.
1814    Note
1816    The main menu will not show the Actions menu when there are no
1817    services being monitored by MySQL Notifier for Microsoft Windows.
1818    Note
1820    The Refresh Status feature is available since MySQL Notifier for
1821    Microsoft Windows 1.1.0.
1823    Figure 2.11. MySQL Notifier for Microsoft Windows Actions menu
1824    MySQL Notifier for Microsoft Windows Actions menu
1826    The Actions, Options menu configures MySQL Notifier for Microsoft
1827    Windows and includes options to:
1829      * Use colorful status icons: Enables a colorful style of icons
1830        for the tray of the MySQL Notifier for Microsoft Windows.
1832      * Run at Windows Startup: Allows the application to be loaded
1833        when Microsoft Windows starts.
1835      * Automatically Check For Updates Every # Weeks: Checks for a
1836        new version of MySQL Notifier for Microsoft Windows, and runs
1837        this check every # weeks.
1839      * Automatically add new services whose name contains: The text
1840        used to filter services and add them automatically to the
1841        monitored list of the local computer running MySQL Notifier,
1842        and on remote computers already monitoring Windows services.
1843        monitored services, and also filters the list of the Microsoft
1844        Windows services for the Add New Service dialog.
1845        Prior to version 1.1.0, this option was named "Automatically
1846        add new services that match this pattern."
1848      * Notify me when a service is automatically added: Will display
1849        a balloon notification from the taskbar when a newly
1850        discovered service is added to the monitored services list.
1852      * Notify me when a service changes status: Will display a
1853        balloon notification from the taskbar when a monitored service
1854        changes its status.
1856    Figure 2.12. MySQL Notifier for Microsoft Windows Options menu
1857    MySQL Notifier for Microsoft Windows Options menu
1859    The Actions, Manage Monitored Items menu enables you to configure
1860    the monitored services and MySQL instances. First, with the
1861    Services tab open:
1863    Figure 2.13. MySQL Notifier for Microsoft Windows Manage Services
1864    menu
1865    MySQL Notifier for Microsoft Windows Manage Services menu
1867    The Instances tab is similar:
1869    Figure 2.14. MySQL Notifier for Microsoft Windows Manage Instances
1870    menu
1871    MySQL Notifier for Microsoft Windows Manage Instances menu
1873    Adding a service or instance (after clicking Add in the Manage
1874    Monitored Items window) enables you to select a running Microsoft
1875    Windows service or instance connection, and configure MySQL
1876    Notifier for Microsoft Windows to monitor it. Add a new service or
1877    instance by clicking service name from the list, then OK to
1878    accept. Multiple services and instances may be selected.
1880    Figure 2.15. MySQL Notifier for Microsoft Windows Adding new
1881    services
1882    MySQL Notifier for Microsoft Windows Adding new services
1884    And instances:
1886    Figure 2.16. MySQL Notifier for Microsoft Windows Adding new
1887    instances
1888    MySQL Notifier for Microsoft Windows Adding new instances
1889    Note
1891    The Instances tab available since MySQL Notifier for Microsoft
1892    Windows 1.1.0.
1894 2.3.4.1. Remote monitoring set up and installation instructions
1896    The MySQL Notifier for Microsoft Windows uses Windows Management
1897    Instrumentation (WMI) to manage and monitor services in remote
1898    computers running Windows XP or later. This guide explains how it
1899    works, and how to set up your system to monitor remote MySQL
1900    instances.
1901    Note
1903    Remote monitoring is available since MySQL Notifier for Microsoft
1904    Windows 1.1.0.
1906    In order to configure WMI, it is important to understand that the
1907    underlying Distributed Component Object Model (DCOM) architecture
1908    is doing the WMI work. Specifically, MySQL Notifier for Microsoft
1909    Windows is using asynchronous notification queries on remote
1910    Microsoft Windows hosts as .NET events. These events send an
1911    asynchronous callback to the computer running the MySQL Notifier
1912    for Microsoft Windows so it knows when a service status has
1913    changed on the remote computer. Asynchronous notifications offer
1914    the best performance compared to semi-synchronous notifications or
1915    synchronous notifications that use timers.
1917    Asynchronous notifications requires the remote computer to send a
1918    callback to the client computer (thus opening a reverse
1919    connection), so the Windows Firewall and DCOM settings must be
1920    properly configured for the communication to function properly.
1922    Figure 2.17. MySQL Notifier for Microsoft Windows Distributed
1923    Component Object Model (DCOM)
1924    MySQL Notifier for Microsoft Windows Distributed Component Object
1925    Model (DCOM)
1927    Most of the common errors thrown by asynchronous WMI notifications
1928    are related to Windows Firewall blocking the communication, or to
1929    DCOM / WMI settings not being set up properly. For a list of
1930    common errors with solutions, see Section 2.3.4.1, "."
1932    The following steps are required to make WMI function. These steps
1933    are divided between two machines. A single host computer that runs
1934    MySQL Notifier for Microsoft Windows (Computer A), and multiple
1935    remote machines that are being monitored (Computer B).
1937 Computer running MySQL Notifier for Microsoft Windows (Computer A)
1940     1. Allow for remote administration by either editing the Group
1941        Policy Editor, or using NETSH:
1942        Using the Group Policy Editor:
1943          a. Click Start, click Run, type GPEDIT.MSC, and then click
1944             OK.
1945          b. Under the Local Computer Policy heading, double-click
1946             Computer Configuration.
1947          c. Double-click Administrative Templates, then Network,
1948             Network Connections, and then Windows Firewall.
1949          d. If the computer is in the domain, then double-click
1950             Domain Profile; otherwise, double-click Standard Profile.
1951          e. Click Windows Firewall: Allow inbound remote
1952             administration exception.
1953          f. On the Action menu either select Edit, or double-click
1954             the selection from the previous step.
1955          g. Check the Enabled radio button, and then click OK.
1956        Using the NETSH command:
1957          a. Open a command prompt window with Administrative rights
1958             (you can right-click the Command Prompt icon and click
1959             Run as Administrator).
1960          b. Execute the following command:
1961 NETSH firewall set service RemoteAdmin enable
1963     2. Open the DCOM port TCP 135:
1964          a. Open a command prompt window with Administrative rights
1965             (you can right-click the Command Prompt icon and click
1966             Run as Administrator) .
1967          b. Execute the following command:
1968 NETSH firewall add portopening protocol=tcp port=135 name=DCOM_TCP135
1970     3. Add the client application which contains the sink for the
1971        callback (MySqlNotifier.exe) to the Windows Firewall
1972        Exceptions List (use either the Windows Firewall configuration
1973        or NETSH):
1974        Using the Windows Firewall configuration:
1975          a. In the Control Panel, double-click Windows Firewall.
1976          b. In the Windows Firewall window's left panel, click Allow
1977             a program or feature through Windows Firewall.
1978          c. In the Allowed Programs window, click Change Settings.
1979          d. If MySqlNotifier.exe is in the Allowed programs and
1980             features list, make sure it is checked for the type of
1981             networks the computer connects to (Private, Public or
1982             both).
1983          e. If MySqlNotifier.exe is not in the list, click Allow
1984             another program....
1985          f. In the Add a Program window, select the MySqlNotifier.exe
1986             if it exists in the Programs list, otherwise click
1987             Browse... and go to the directory where MySqlNotifier.exe
1988             was installed to select it, then click Add.
1989          g. Make sure MySqlNotifier.exe is checked for the type of
1990             networks the computer connects to (Private, Public or
1991             both).
1992        Using the NETSH command:
1993          a. Open a command prompt window with Administrative rights
1994             (you can right-click the Command Prompt icon and click
1995             Run as Administrator).
1996          b. Execute the following command, where you change
1997             "[YOUR_INSTALL_DIRECTORY]":
1998 NETSH firewall add allowedprogram program=[YOUR_INSTALL_DIRECTORY]\My
1999 SqlNotifier.exe name=MySqlNotifier
2001     4. If Computer B is either a member of WORKGROUP or is in a
2002        different domain that is untrusted by Computer A, then the
2003        callback connection (Connection 2) is created as an Anonymous
2004        connection. To grant Anonymous connections DCOM Remote Access
2005        permissions:
2006          a. Click Start, click Run, type DCOMCNFG, and then click OK.
2007          b. In the Component Services dialog box, expand Component
2008             Services, expand Computers, and then right-click My
2009             Computer and click Properties.
2010          c. In the My Computer Properties dialog box, click the COM
2011             Security tab.
2012          d. Under Access Permissions, click Edit Limits.
2013          e. In the Access Permission dialog box, select ANONYMOUS
2014             LOGON name in the Group or user names box. In the Allow
2015             column under Permissions for User, select Remote Access,
2016             and then click OK.
2018 Monitored Remote Computer (Computer B)
2020    If the user account that is logged into the computer running the
2021    MySQL Notifier for Microsoft Windows (Computer A) is a local
2022    administrator on the remote computer (Computer B), such that the
2023    same account is an administrator on Computer B, you can skip to
2024    the "Allow for remote administration" step.
2026    Setting DCOM security to allow a non-administrator user to access
2027    a computer remotely:
2029     1. Grant "DCOM remote launch" and activation permissions for a
2030        user or group:
2031          a. Click Start, click Run, type DCOMCNFG, and then click OK.
2032          b. In the Component Services dialog box, expand Component
2033             Services, expand Computers, and then right-click My
2034             Computer and click Properties.
2035          c. In the My Computer Properties dialog box, click the COM
2036             Security tab.
2037          d. Under Access Permissions, click Edit Limits.
2038          e. In the Launch Permission dialog box, follow these steps
2039             if your name or your group does not appear in the Groups
2040             or user names list:
2041               i. In the Launch Permission dialog box, click Add.
2042              ii. In the Select Users, Computers, or Groups dialog
2043                  box, add your name and the group in the "Enter the
2044                  object names to select" box, and then click OK.
2045          f. In the Launch Permission dialog box, select your user and
2046             group in the Group or user names box. In the Allow column
2047             under Permissions for User, select Remote Launch, select
2048             Remote Activation, and then click OK.
2049        Grant DCOM remote access permissions:
2050          a. Click Start, click Run, type DCOMCNFG, and then click OK.
2051          b. In the Component Services dialog box, expand Component
2052             Services, expand Computers, and then right-click My
2053             Computer and click Properties.
2054          c. In the My Computer Properties dialog box, click the COM
2055             Security tab.
2056          d. Under Access Permissions, click Edit Limits.
2057          e. In the Access Permission dialog box, select ANONYMOUS
2058             LOGON name in the Group or user names box. In the Allow
2059             column under Permissions for User, select Remote Access,
2060             and then click OK.
2062     2. Allowing non-administrator users access to a specific WMI
2063        namespace:
2064          a. In the Control Panel, double-click Administrative Tools.
2065          b. In the Administrative Tools window, double-click Computer
2066             Management.
2067          c. In the Computer Management window, expand the Services
2068             and Applications tree and double-click the WMI Control.
2069          d. Right-click the WMI Control icon and select Properties.
2070          e. In the WMI Control Properties window, click the Security
2071             tab.
2072          f. In the Security tab, select the namespace and click
2073             Security.
2074          g. Locate the appropriate account and check Remote Enable in
2075             the Permissions list.
2077     3. Allow for remote administration by either editing the Group
2078        Policy Editor or using NETSH:
2079        Using the Group Policy Editor:
2080          a. Click Start, click Run, type GPEDIT.MSC, and then click
2081             OK.
2082          b. Under the Local Computer Policy heading, double-click
2083             Computer Configuration.
2084          c. Double-click Administrative Templates, then Network,
2085             Network Connections, and then Windows Firewall.
2086          d. If the computer is in the domain, then double-click
2087             Domain Profile; otherwise, double-click Standard Profile.
2088          e. Click Windows Firewall: Allow inbound remote
2089             administration exception.
2090          f. On the Action menu either select Edit, or double-click
2091             the selection from the previous step.
2092          g. Check the Enabled radio button, and then click OK.
2093        Using the NETSH command:
2094          a. Open a command prompt window with Administrative rights
2095             (you can right-click the Command Prompt icon and click
2096             Run as Administrator).
2097          b. Execute the following command:
2098 NETSH firewall set service RemoteAdmin enable
2100     4. Now, be sure the user you are logging in with uses the Name
2101        value and not the Full Name value:
2102          a. In the Control Panel, double-click Administrative Tools.
2103          b. In the Administrative Tools window, double-click Computer
2104             Management.
2105          c. In the Computer Management window, expand the System
2106             Tools then Local Users and Groups.
2107          d. Click the Users node, and on the right side panel locate
2108             your user and make sure it uses the Name value to
2109             connect, and not the Full Name value.
2111     5. If the remote computer is running on Windows XP Professional,
2112        make sure that remote logins are not being forcefully changed
2113        to the guest account user (also known as ForceGuest), which is
2114        enabled by default on computers that are not attached to a
2115        domain.
2116          a. Click Start, click Run, type SECPOL.MSC, and then click
2117             OK.
2118          b. Under the Local Policies node, double-click Security
2119             Options.
2120          c. Select Network Access: Sharing and security model for
2121             local accounts and save.
2123 Common Errors
2126      * 0x80070005
2128           + DCOM Security was not configured properly (see Computer
2129             B, the Setting DCOM security... step).
2131           + The remote computer (Computer B) is a member of WORKGROUP
2132             or is in a domain that is untrusted by the client
2133             computer (Computer A) (see Computer A, the Grant
2134             Anonymous connections DCOM Remote Access permissions
2135             step).
2137      * 0x8007000E
2139           + The remote computer (Computer B) is a member of WORKGROUP
2140             or is in a domain that is untrusted by the client
2141             computer (Computer A) (see Computer A, the Grant
2142             Anonymous connections DCOM Remote Access permissions
2143             step).
2145      * 0x80041003
2147           + Access to the remote WMI namespace was not configured
2148             properly (see Computer B, the Allowing non-administrator
2149             users access to a specific WMI namespace step).
2151      * 0x800706BA
2153           + The DCOM port is not open on the client computers
2154             (Computer A) firewall. See the Open the DCOM port TCP 135
2155             step for Computer A.
2157           + The remote computer (Computer B) is inaccessible because
2158             its network location is set to Public. Make sure you can
2159             access it through the Windows Explorer.
2161 2.3.5. Using the MySQL Server Instance Config Wizard
2163    The MySQL Server Instance Config Wizard helps automate the process
2164    of configuring your server. It creates a custom MySQL
2165    configuration file (my.ini or my.cnf) by asking you a series of
2166    questions and then applying your responses to a template to
2167    generate the configuration file that is tuned to your
2168    installation.
2170    The complete and essential MSI installation packages include the
2171    MySQL Server Instance Config Wizard in the MySQL 5.1 server. The
2172    MySQL Server Instance Config Wizard is only available for Windows.
2174    The workflow sequence for using the MySQL Server Instance Config
2175    Wizard is shown in the figure below:
2177    Figure 2.18. MySQL Server Instance Config Wizard Workflow
2178    MySQL Server Instance Config Wizard Workflow
2180 2.3.5.1. Starting the MySQL Server Instance Config Wizard
2182    The MySQL Server Instance Config Wizard is normally started as
2183    part of the installation process. You should only need to run the
2184    MySQL Server Instance Config Wizard again when you need to change
2185    the configuration parameters of your server.
2187    If you chose not to open a port prior to installing MySQL on
2188    Windows Vista or newer, you can choose to use the MySQL Server
2189    Instance Config Wizard after installation. However, you must open
2190    a port in the Windows Firewall. To do this see the instructions
2191    given in Section 2.3.3.1.1, "MySQL Installation Wizard:
2192    Downloading and Starting." Rather than opening a port, you also
2193    have the option of adding MySQL as a program that bypasses the
2194    Windows Firewall. One or the other option is sufficient---you need
2195    not do both. Additionally, when running the MySQL Server Config
2196    Wizard on Windows Vista or newer, ensure that you are logged in as
2197    a user with administrative rights.
2198    MySQL Server Instance Config Wizard
2200    You can launch the MySQL Config Wizard by clicking the MySQL
2201    Server Instance Config Wizard entry in the MySQL section of the
2202    Windows Start menu.
2204    Alternatively, you can navigate to the bin directory of your MySQL
2205    installation and launch the MySQLInstanceConfig.exe file directly.
2207    The MySQL Server Instance Config Wizard places the my.ini file in
2208    the installation directory for the MySQL server. This helps
2209    associate configuration files with particular server instances.
2211    To ensure that the MySQL server knows where to look for the my.ini
2212    file, an argument similar to this is passed to the MySQL server as
2213    part of the service installation:
2214 --defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini"
2216    Here, C:\Program Files\MySQL\MySQL Server 5.1 is replaced with the
2217    installation path to the MySQL Server. The --defaults-file option
2218    instructs the MySQL server to read the specified file for
2219    configuration options when it starts.
2221    Apart from making changes to the my.ini file by running the MySQL
2222    Server Instance Config Wizard again, you can modify it by opening
2223    it with a text editor and making any necessary changes. You can
2224    also modify the server configuration with the
2225    http://www.mysql.com/products/administrator/ utility. For more
2226    information about server configuration, see Section 5.1.3, "Server
2227    Command Options."
2229    MySQL clients and utilities such as the mysql and mysqldump
2230    command-line clients are not able to locate the my.ini file
2231    located in the server installation directory. To configure the
2232    client and utility applications, create a new my.ini file in the
2233    Windows installation directory (for example, C:\WINDOWS).
2235    Under Windows Server 2003, Windows Server 2000, Windows XP, and
2236    Windows Vista, MySQL Server Instance Config Wizard will configure
2237    MySQL to work as a Windows service. To start and stop MySQL you
2238    use the Services application that is supplied as part of the
2239    Windows Administrator Tools.
2241 2.3.5.2. MySQL Server Instance Config Wizard: Choosing a Maintenance
2242 Option
2244    If the MySQL Server Instance Config Wizard detects an existing
2245    configuration file, you have the option of either reconfiguring
2246    your existing server, or removing the server instance by deleting
2247    the configuration file and stopping and removing the MySQL
2248    service.
2250    To reconfigure an existing server, choose the Re-configure
2251    Instance option and click the Next button. Any existing
2252    configuration file is not overwritten, but renamed (within the
2253    same directory) using a timestamp (Windows) or sequential number
2254    (Linux). To remove the existing server instance, choose the Remove
2255    Instance option and click the Next button.
2257    If you choose the Remove Instance option, you advance to a
2258    confirmation window. Click the Execute button. The MySQL Server
2259    Config Wizard stops and removes the MySQL service, and then
2260    deletes the configuration file. The server installation and its
2261    data folder are not removed.
2263    If you choose the Re-configure Instance option, you advance to the
2264    Configuration Type dialog where you can choose the type of
2265    installation that you wish to configure.
2267 2.3.5.3. MySQL Server Instance Config Wizard: Choosing a
2268 Configuration Type
2270    When you start the MySQL Server Instance Config Wizard for a new
2271    MySQL installation, or choose the Re-configure Instance option for
2272    an existing installation, you advance to the Configuration Type
2273    dialog.
2274    MySQL Server Instance Config Wizard: Configuration Type
2276    There are two configuration types available: Detailed
2277    Configuration and Standard Configuration. The Standard
2278    Configuration option is intended for new users who want to get
2279    started with MySQL quickly without having to make many decisions
2280    about server configuration. The Detailed Configuration option is
2281    intended for advanced users who want more fine-grained control
2282    over server configuration.
2284    If you are new to MySQL and need a server configured as a
2285    single-user developer machine, the Standard Configuration should
2286    suit your needs. Choosing the Standard Configuration option causes
2287    the MySQL Config Wizard to set all configuration options
2288    automatically with the exception of Service Options and Security
2289    Options.
2291    The Standard Configuration sets options that may be incompatible
2292    with systems where there are existing MySQL installations. If you
2293    have an existing MySQL installation on your system in addition to
2294    the installation you wish to configure, the Detailed Configuration
2295    option is recommended.
2297    To complete the Standard Configuration, please refer to the
2298    sections on Service Options and Security Options in Section
2299    2.3.5.10, "MySQL Server Instance Config Wizard: The Service
2300    Options Dialog," and Section 2.3.5.11, "MySQL Server Instance
2301    Config Wizard: The Security Options Dialog," respectively.
2303 2.3.5.4. MySQL Server Instance Config Wizard: The Server Type Dialog
2305    There are three different server types available to choose from.
2306    The server type that you choose affects the decisions that the
2307    MySQL Server Instance Config Wizard makes with regard to memory,
2308    disk, and processor usage.
2309    MySQL Server Instance Config Wizard: Server Type
2311      * Developer Machine: Choose this option for a typical desktop
2312        workstation where MySQL is intended only for personal use. It
2313        is assumed that many other desktop applications are running.
2314        The MySQL server is configured to use minimal system
2315        resources.
2317      * Server Machine: Choose this option for a server machine where
2318        the MySQL server is running alongside other server
2319        applications such as FTP, email, and Web servers. The MySQL
2320        server is configured to use a moderate portion of the system
2321        resources.
2323      * Dedicated MySQL Server Machine: Choose this option for a
2324        server machine that is intended to run only the MySQL server.
2325        It is assumed that no other applications are running. The
2326        MySQL server is configured to use all available system
2327        resources.
2329    Note
2331    By selecting one of the preconfigured configurations, the values
2332    and settings of various options in your my.cnf or my.ini will be
2333    altered accordingly. The default values and options as described
2334    in the reference manual may therefore be different to the options
2335    and values that were created during the execution of the Config
2336    Wizard.
2338 2.3.5.5. MySQL Server Instance Config Wizard: The Database Usage
2339 Dialog
2341    The Database Usage dialog enables you to indicate the storage
2342    engines that you expect to use when creating MySQL tables. The
2343    option you choose determines whether the InnoDB storage engine is
2344    available and what percentage of the server resources are
2345    available to InnoDB.
2346    MySQL Server Instance Config Wizard: Usage Dialog
2348      * Multifunctional Database: This option enables both the InnoDB
2349        and MyISAM storage engines and divides resources evenly
2350        between the two. This option is recommended for users who use
2351        both storage engines on a regular basis.
2353      * Transactional Database Only: This option enables both the
2354        InnoDB and MyISAM storage engines, but dedicates most server
2355        resources to the InnoDB storage engine. This option is
2356        recommended for users who use InnoDB almost exclusively and
2357        make only minimal use of MyISAM.
2359      * Non-Transactional Database Only: This option disables the
2360        InnoDB storage engine completely and dedicates all server
2361        resources to the MyISAM storage engine. This option is
2362        recommended for users who do not use InnoDB.
2364    The Config Wizard uses a template to generate the server
2365    configuration file. The Database Usage dialog sets one of the
2366    following option strings:
2367 Multifunctional Database:        MIXED
2368 Transactional Database Only:     INNODB
2369 Non-Transactional Database Only: MYISAM
2371    When these options are processed through the default template
2372    (my-template.ini) the result is:
2373 Multifunctional Database:
2374 default-storage-engine=InnoDB
2375 _myisam_pct=50
2377 Transactional Database Only:
2378 default-storage-engine=InnoDB
2379 _myisam_pct=5
2381 Non-Transactional Database Only:
2382 default-storage-engine=MyISAM
2383 _myisam_pct=100
2384 skip-innodb
2386    The _myisam_pct value is used to calculate the percentage of
2387    resources dedicated to MyISAM. The remaining resources are
2388    allocated to InnoDB.
2390 2.3.5.6. MySQL Server Instance Config Wizard: The InnoDB Tablespace
2391 Dialog
2393    Some users may want to locate the InnoDB tablespace files in a
2394    different location than the MySQL server data directory. Placing
2395    the tablespace files in a separate location can be desirable if
2396    your system has a higher capacity or higher performance storage
2397    device available, such as a RAID storage system.
2398    MySQL Server Instance Config Wizard: InnoDB Data Tablespace
2400    To change the default location for the InnoDB tablespace files,
2401    choose a new drive from the drop-down list of drive letters and
2402    choose a new path from the drop-down list of paths. To create a
2403    custom path, click the ... button.
2405    If you are modifying the configuration of an existing server, you
2406    must click the Modify button before you change the path. In this
2407    situation you must move the existing tablespace files to the new
2408    location manually before starting the server.
2410 2.3.5.7. MySQL Server Instance Config Wizard: The Concurrent
2411 Connections Dialog
2413    To prevent the server from running out of resources, it is
2414    important to limit the number of concurrent connections to the
2415    MySQL server that can be established. The Concurrent Connections
2416    dialog enables you to choose the expected usage of your server,
2417    and sets the limit for concurrent connections accordingly. It is
2418    also possible to set the concurrent connection limit manually.
2419    MySQL Server Instance Config Wizard: Connections
2421      * Decision Support (DSS)/OLAP: Choose this option if your server
2422        does not require a large number of concurrent connections. The
2423        maximum number of connections is set at 100, with an average
2424        of 20 concurrent connections assumed.
2426      * Online Transaction Processing (OLTP): Choose this option if
2427        your server requires a large number of concurrent connections.
2428        The maximum number of connections is set at 500.
2430      * Manual Setting: Choose this option to set the maximum number
2431        of concurrent connections to the server manually. Choose the
2432        number of concurrent connections from the drop-down box
2433        provided, or enter the maximum number of connections into the
2434        drop-down box if the number you desire is not listed.
2436 2.3.5.8. MySQL Server Instance Config Wizard: The Networking and
2437 Strict Mode Options Dialog
2439    Use the Networking Options dialog to enable or disable TCP/IP
2440    networking and to configure the port number that is used to
2441    connect to the MySQL server.
2442    MySQL Server Instance Config Wizard: Network Configuration
2444    TCP/IP networking is enabled by default. To disable TCP/IP
2445    networking, uncheck the box next to the Enable TCP/IP Networking
2446    option.
2448    Port 3306 is used by default. To change the port used to access
2449    MySQL, choose a new port number from the drop-down box or type a
2450    new port number directly into the drop-down box. If the port
2451    number you choose is in use, you are prompted to confirm your
2452    choice of port number.
2454    Set the Server SQL Mode to either enable or disable strict mode.
2455    Enabling strict mode (default) makes MySQL behave more like other
2456    database management systems. If you run applications that rely on
2457    MySQL's old "forgiving" behavior, make sure to either adapt those
2458    applications or to disable strict mode. For more information about
2459    strict mode, see Section 5.1.7, "Server SQL Modes."
2461 2.3.5.9. MySQL Server Instance Config Wizard: The Character Set
2462 Dialog
2464    The MySQL server supports multiple character sets and it is
2465    possible to set a default server character set that is applied to
2466    all tables, columns, and databases unless overridden. Use the
2467    Character Set dialog to change the default character set of the
2468    MySQL server.
2469    MySQL Server Instance Config Wizard: Character Set
2471      * Standard Character Set: Choose this option if you want to use
2472        latin1 as the default server character set. latin1 is used for
2473        English and many Western European languages.
2475      * Best Support For Multilingualism: Choose this option if you
2476        want to use utf8 as the default server character set. This is
2477        a Unicode character set that can store characters from many
2478        different languages.
2480      * Manual Selected Default Character Set / Collation: Choose this
2481        option if you want to pick the server's default character set
2482        manually. Choose the desired character set from the provided
2483        drop-down list.
2485 2.3.5.10. MySQL Server Instance Config Wizard: The Service Options
2486 Dialog
2488    On Windows platforms, the MySQL server can be installed as a
2489    Windows service. When installed this way, the MySQL server can be
2490    started automatically during system startup, and even restarted
2491    automatically by Windows in the event of a service failure.
2493    The MySQL Server Instance Config Wizard installs the MySQL server
2494    as a service by default, using the service name MySQL. If you do
2495    not wish to install the service, uncheck the box next to the
2496    Install As Windows Service option. You can change the service name
2497    by picking a new service name from the drop-down box provided or
2498    by entering a new service name into the drop-down box.
2499    Note
2501    Service names can include any legal character except forward (/)
2502    or backward (\) slashes, and must be less than 256 characters
2503    long.
2504    Warning
2506    If you are installing multiple versions of MySQL onto the same
2507    machine, you must choose a different service name for each version
2508    that you install. If you do not choose a different service for
2509    each installed version then the service manager information will
2510    be inconsistent and this will cause problems when you try to
2511    uninstall a previous version.
2513    If you have already installed multiple versions using the same
2514    service name, you must manually edit the contents of the
2515    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services parameters
2516    within the Windows registry to update the association of the
2517    service name with the correct server version.
2519    Typically, when installing multiple versions you create a service
2520    name based on the version information. For example, you might
2521    install MySQL 5.x as mysql5, or specific versions such as MySQL
2522    5.1.30 as mysql50130.
2524    To install the MySQL server as a service but not have it started
2525    automatically at startup, uncheck the box next to the Launch the
2526    MySQL Server Automatically option.
2528 2.3.5.11. MySQL Server Instance Config Wizard: The Security Options
2529 Dialog
2531    The content of the security options portion of the MySQL Server
2532    Instance Configuration Wizard will depend on whether this is a new
2533    installation, or modifying an existing installation.
2535      * Setting the root password for a new installation
2536        It is strongly recommended that you set a root password for
2537        your MySQL server, and the MySQL Server Instance Config Wizard
2538        requires by default that you do so. If you do not wish to set
2539        a root password, uncheck the box next to the Modify Security
2540        Settings option.
2541        Note
2542        If you have previously installed MySQL, but not deleted the
2543        data directory associated with the previous installation, you
2544        may be prompted to provide the current root password. The
2545        password will be the one configured with your old data
2546        directory. If you do not want to use this data, or do not know
2547        the root password, you should cancel the installation, delete
2548        the previous installation data, and then restart the
2549        installation process. For more information on deleting MySQL
2550        data on Microsoft Windows, see Section 2.3.3.3, "Removing
2551        MySQL When Installed from the MSI Package."
2552        MySQL Server Instance Config Wizard: Security
2554      * To set the root password, enter the desired password into both
2555        the New root password and Confirm boxes.
2556        Setting the root password for an existing installation
2557        If you are modifying the configuration of an existing
2558        configuration, or you are installing an upgrade and the MySQL
2559        Server Instance Configuration Wizard has detected an existing
2560        MySQL system, then you must enter the existing password for
2561        root before changing the configuration information.
2562        MySQL Server Instance Config Wizard: Security (Existing
2563        Installation)
2564        If you want to change the current root password, enter the
2565        desired new password into both the New root password and
2566        Confirm boxes.
2568    To permit root logins from across the network, check the box next
2569    to the Enable root access from remote machines option. This
2570    decreases the security of your root account.
2572    To create an anonymous user account, check the box next to the
2573    Create An Anonymous Account option. Creating an anonymous account
2574    can decrease server security and cause login and permission
2575    difficulties. For this reason, it is not recommended.
2577 2.3.5.12. MySQL Server Instance Config Wizard: The Confirmation
2578 Dialog
2580    The final dialog in the MySQL Server Instance Config Wizard is the
2581    Confirmation Dialog. To start the configuration process, click the
2582    Execute button. To return to a previous dialog, click the Back
2583    button. To exit the MySQL Server Instance Config Wizard without
2584    configuring the server, click the Cancel button.
2585    MySQL Server Instance Config Wizard: Confirmation
2587    After you click the Execute button, the MySQL Server Instance
2588    Config Wizard performs a series of tasks and displays the progress
2589    onscreen as the tasks are performed.
2591    The MySQL Server Instance Config Wizard first determines
2592    configuration file options based on your choices using a template
2593    prepared by MySQL developers and engineers. This template is named
2594    my-template.ini and is located in your server installation
2595    directory.
2597    The MySQL Config Wizard then writes these options to the
2598    corresponding configuration file.
2600    If you chose to create a service for the MySQL server, the MySQL
2601    Server Instance Config Wizard creates and starts the service. If
2602    you are reconfiguring an existing service, the MySQL Server
2603    Instance Config Wizard restarts the service to apply your
2604    configuration changes.
2606    If you chose to set a root password, the MySQL Config Wizard
2607    connects to the server, sets your new root password, and applies
2608    any other security settings you may have selected.
2610    After the MySQL Server Instance Config Wizard has completed its
2611    tasks, it displays a summary. Click the Finish button to exit the
2612    MySQL Server Config Wizard.
2614 2.3.5.13. MySQL Server Instance Config Wizard: Creating an Instance
2615 from the Command Line
2617    In addition to using the GUI interface to the MySQL Server
2618    Instance Config Wizard, you can also create instances
2619    automatically from the command line.
2621    To use the MySQL Server Instance Config Wizard on the command
2622    line, you need to use the MySQLInstanceConfig.exe command that is
2623    installed with MySQL in the bin directory within the installation
2624    directory. MySQLInstanceConfig.exe takes a number of command-line
2625    arguments the set the properties that would normally be selected
2626    through the GUI interface, and then creates a new configuration
2627    file (my.ini) by combining these selections with a template
2628    configuration file to produce the working configuration file.
2630    The main command line options are provided in the table below.
2631    Some of the options are required, while some options are optional.
2633    Table 2.7. MySQL Server Instance Config Wizard Command Line
2634    Options
2635    Option Description
2636    Required Parameters
2637    -nPRODUCTNAME The name of the instance when installed
2638    -pPATH Path of the base directory for installation. This is
2639    equivalent to the directory when using the basedir configuration
2640    parameter
2641    -vVERSION The version tag to use for this installation
2642    Action to Perform
2643    -i Install an instance
2644    -r Remove an instance
2645    -s Stop an existing instance
2646    -q Perform the operation quietly
2647    -lFILENAME Sae the installation progress in a logfile
2648    Config File to Use
2649    -tFILENAME Path to the template config file that will be used to
2650    generate the installed configuration file
2651    -cFILENAME Path to a config file to be generated
2653    The -t and -c options work together to set the configuration
2654    parameters for a new instance. The -t option specifies the
2655    template configuration file to use as the basic configuration,
2656    which are then merged with the configuration parameters generated
2657    by the MySQL Server Instance Config Wizard into the configuration
2658    file specified by the -c option.
2660    A sample template file, my-template.ini is provided in the
2661    toplevel MySQL installation directory. The file contains elements
2662    are replaced automatically by the MySQL Server Instance Config
2663    Wizard during configuration.
2665    If you specify a configuration file that already exists, the
2666    existing configuration file will be saved in the file with the
2667    original, with the date and time added. For example, the mysql.ini
2668    will be copied to mysql 2009-10-27 1646.ini.bak.
2670    The parameters that you can specify on the command line are listed
2671    in the table below.
2673    Table 2.8. MySQL Server Instance Config Wizard Parameters
2674    Parameter Description
2675    ServiceName=$ Specify the name of the service to be created
2676    AddBinToPath={yes | no} Specifies whether to add the binary
2677    directory of MySQL to the standard PATH environment variable
2678    ServerType={DEVELOPMENT | SERVER | DEDICATED} Specify the server
2679    type. For more information, see Section 2.3.5.4, "MySQL Server
2680    Instance Config Wizard: The Server Type Dialog"
2681    DatabaseType={MIXED | INNODB | MYISAM} Specify the default
2682    database type. For more information, see Section 2.3.5.5, "MySQL
2683    Server Instance Config Wizard: The Database Usage Dialog"
2684    ConnectionUsage={DSS | OLTP} Specify the type of connection
2685    support, this automates the setting for the number of concurrent
2686    connections (see the ConnectionCount parameter). For more
2687    information, see Section 2.3.5.7, "MySQL Server Instance Config
2688    Wizard: The Concurrent Connections Dialog"
2689    ConnectionCount=# Specify the number of concurrent connections to
2690    support. For more information, see Section 2.3.5.4, "MySQL Server
2691    Instance Config Wizard: The Server Type Dialog"
2692    SkipNetworking={yes | no} Specify whether network support should
2693    be supported. Specifying yes disables network access altogether
2694    Port=# Specify the network port number to use for network
2695    connections. For more information, see Section 2.3.5.8, "MySQL
2696    Server Instance Config Wizard: The Networking and Strict Mode
2697    Options Dialog"
2698    StrictMode={yes | no} Specify whether to use the strict SQL mode.
2699    For more information, see Section 2.3.5.8, "MySQL Server Instance
2700    Config Wizard: The Networking and Strict Mode Options Dialog"
2701    Charset=$ Specify the default character set. For more information,
2702    see Section 2.3.5.9, "MySQL Server Instance Config Wizard: The
2703    Character Set Dialog"
2704    RootPassword=$ Specify the root password
2705    RootCurrentPassword=$ Specify the current root password then
2706    stopping or reconfiguring an existing service
2707    Note
2709    When specifying options on the command line, you can enclose the
2710    entire command-line option and the value you are specifying using
2711    double quotation marks. This enables you to use spaces in the
2712    options. For example, "-cC:\mysql.ini".
2714    The following command installs a MySQL Server 5.1 instance from
2715    the directory C:\Program Files\MySQL\MySQL Server 5.1 using the
2716    service name MySQL51 and setting the root password to 1234.
2717 shell> MySQLInstanceConfig.exe -i -q "-lC:\mysql_install_log.txt" Â»
2718    "-nMySQL Server 5.1" "-pC:\Program Files\MySQL\MySQL Server 5.1" -
2719 v5.1.74 Â»
2720    "-tmy-template.ini" "-cC:\mytest.ini" ServerType=DEVELOPMENT Datab
2721 aseType=MIXED Â»
2722    ConnectionUsage=DSS Port=3311 ServiceName=MySQL51 RootPassword=123
2725    In the above example, a log file will be generated in
2726    mysql_install_log.txt containing the information about the
2727    instance creation process. The log file generated by the above
2728    example is shown below:
2729 Welcome to the MySQL Server Instance Configuration Wizard 1.0.16.0
2730 Date: 2009-10-27 17:07:21
2732 Installing service ...
2734 Product Name:         MySQL Server 5.1
2735 Version:              5.1.74
2736 Installation Path:    C:\Program Files\MySQL\MySQL Server 5.1\
2738 Creating configuration file C:\mytest.ini using template my-template.
2739 ini.
2740 Options:
2741 DEVELOPMENT
2742 MIXED
2744 STRICTMODE
2746 Variables:
2747 port: 3311
2748 default-character-set: latin1
2749 basedir: "C:/Program Files/MySQL/MySQL Server 5.1/"
2750 datadir: "C:/Program Files/MySQL/MySQL Server 5.1/Data/"
2753 Creating Windows service entry.
2754 Service name: "MySQL51"
2755 Parameters:   "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --
2756 defaults-file="C:\mytest.ini" MySQL51.
2757 Windows service MySQL51 installed.
2759    When using the command line, the return values in the following
2760    table indicate an error performing the specified option.
2762    Table 2.9. Return Value from MySQL Server Instance Config Wizard
2763    Value                   Description
2764    2     Configuration template file cannot be found
2765    3     The Windows service entry cannot be created
2766    4     Could not connect to the Service Control Manager
2767    5     The MySQL service cannot be started
2768    6     The MySQL service cannot be stopped
2769    7     The security settings cannot be applied
2770    8     The configuration file cannot be written
2771    9     The Windows service entry cannot be removed
2773    You can perform an installation of MySQL automatically using the
2774    MSI package. For more information, see Section 2.3.3.2,
2775    "Automating MySQL Installation on Microsoft Windows Using the MSI
2776    Package."
2778 2.3.6. Installing MySQL on Microsoft Windows Using a noinstall Zip
2779 Archive
2781    Users who are installing from the noinstall package can use the
2782    instructions in this section to manually install MySQL. The
2783    process for installing MySQL from a Zip archive is as follows:
2785     1. Extract the archive to the desired install directory
2787     2. Create an option file
2789     3. Choose a MySQL server type
2791     4. Start the MySQL server
2793     5. Secure the default user accounts
2795    This process is described in the sections that follow.
2797 2.3.6.1. Extracting the Install Archive
2799    To install MySQL manually, do the following:
2801     1. If you are upgrading from a previous version please refer to
2802        Section 2.3.8, "Upgrading MySQL Server on Microsoft Windows,"
2803        before beginning the upgrade process.
2805     2. Make sure that you are logged in as a user with administrator
2806        privileges.
2808     3. Choose an installation location. Traditionally, the MySQL
2809        server is installed in C:\mysql. The MySQL Installation Wizard
2810        installs MySQL under C:\Program Files\MySQL. If you do not
2811        install MySQL at C:\mysql, you must specify the path to the
2812        install directory during startup or in an option file. See
2813        Section 2.3.6.2, "Creating an Option File."
2815     4. Extract the install archive to the chosen installation
2816        location using your preferred Zip archive tool. Some tools may
2817        extract the archive to a folder within your chosen
2818        installation location. If this occurs, you can move the
2819        contents of the subfolder into the chosen installation
2820        location.
2822 2.3.6.2. Creating an Option File
2824    If you need to specify startup options when you run the server,
2825    you can indicate them on the command line or place them in an
2826    option file. For options that are used every time the server
2827    starts, you may find it most convenient to use an option file to
2828    specify your MySQL configuration. This is particularly true under
2829    the following circumstances:
2831      * The installation or data directory locations are different
2832        from the default locations (C:\Program Files\MySQL\MySQL
2833        Server 5.1 and C:\Program Files\MySQL\MySQL Server 5.1\data).
2835      * You need to tune the server settings, such as memory, cache,
2836        or InnoDB configuration information.
2838    When the MySQL server starts on Windows, it looks for option files
2839    in several locations, such as the Windows directory, C:\, and the
2840    MySQL installation directory (for the full list of locations, see
2841    Section 4.2.3.3, "Using Option Files"). The Windows directory
2842    typically is named something like C:\WINDOWS. You can determine
2843    its exact location from the value of the WINDIR environment
2844    variable using the following command:
2845 C:\> echo %WINDIR%
2847    MySQL looks for options in each location first in the my.ini file,
2848    and then in the my.cnf file. However, to avoid confusion, it is
2849    best if you use only one file. If your PC uses a boot loader where
2850    C: is not the boot drive, your only option is to use the my.ini
2851    file. Whichever option file you use, it must be a plain text file.
2853    You can also make use of the example option files included with
2854    your MySQL distribution; see Section 5.1.2, "Server Configuration
2855    Defaults."
2857    An option file can be created and modified with any text editor,
2858    such as Notepad. For example, if MySQL is installed in E:\mysql
2859    and the data directory is in E:\mydata\data, you can create an
2860    option file containing a [mysqld] section to specify values for
2861    the basedir and datadir options:
2862 [mysqld]
2863 # set basedir to your installation path
2864 basedir=E:/mysql
2865 # set datadir to the location of your data directory
2866 datadir=E:/mydata/data
2868    Note that Windows path names are specified in option files using
2869    (forward) slashes rather than backslashes. If you do use
2870    backslashes, double them:
2871 [mysqld]
2872 # set basedir to your installation path
2873 basedir=E:\\mysql
2874 # set datadir to the location of your data directory
2875 datadir=E:\\mydata\\data
2877    The rules for use of backslash in option file values are given in
2878    Section 4.2.3.3, "Using Option Files."
2880    In MySQL 5.1.23 and earlier, the MySQL installer places the data
2881    directory directly under the directory where you install MySQL. On
2882    MySQL 5.1.24 and later, the data directory is located within the
2883    AppData directory for the user running MySQL.
2885    If you would like to use a data directory in a different location,
2886    you should copy the entire contents of the data directory to the
2887    new location. For example, if you want to use E:\mydata as the
2888    data directory instead, you must do two things:
2890     1. Move the entire data directory and all of its contents from
2891        the default location (for example C:\Program Files\MySQL\MySQL
2892        Server 5.1\data) to E:\mydata.
2894     2. Use a --datadir option to specify the new data directory
2895        location each time you start the server.
2897 2.3.6.3. Selecting a MySQL Server Type
2899    The following table shows the available servers for Windows in
2900    MySQL 5.1.20 and earlier.
2902    Table 2.10. mysqld binary types for Microsoft Windows up to MySQL
2903    5.1.20
2904    Binary Description
2905    mysqld-nt Optimized binary with named-pipe support
2906    mysqld Optimized binary without named-pipe support
2907    mysqld-debug Like mysqld-nt, but compiled with full debugging and
2908    automatic memory allocation checking
2910    The following table shows the available servers for Windows in
2911    MySQL 5.1.21 and later.
2913    Table 2.11. mysqld binary types for Microsoft Windows MySQL 5.1.21
2914    and later
2915    Binary Description
2916    mysqld Optimized binary with named-pipe support
2917    mysqld-debug Like mysqld, but compiled with full debugging and
2918    automatic memory allocation checking
2920    All of the preceding binaries are optimized for modern Intel
2921    processors, but should work on any Intel i386-class or higher
2922    processor.
2924    Each of the servers in a distribution support the same set of
2925    storage engines. The SHOW ENGINES statement displays which engines
2926    a given server supports.
2928    All Windows MySQL 5.1 servers have support for symbolic linking of
2929    database directories.
2931    MySQL supports TCP/IP on all Windows platforms. MySQL servers on
2932    Windows support named pipes as indicated in the following list.
2933    However, the default is to use TCP/IP regardless of platform.
2934    (Named pipes are slower than TCP/IP in many Windows
2935    configurations.)
2937    Use of named pipes is subject to these conditions:
2939      * Named pipes are enabled only if you start the server with the
2940        --enable-named-pipe option. It is necessary to use this option
2941        explicitly because some users have experienced problems with
2942        shutting down the MySQL server when named pipes were used.
2944      * For MySQL 5.1.20 and earlier, named-pipe connections are
2945        permitted only by the mysqld-nt and mysqld-debug servers. For
2946        MySQL 5.1.21 and later, the mysqld and mysqld-debug servers
2947        both contain support for named-pipe connections.
2949    Note
2951    Most of the examples in this manual use mysqld as the server name.
2952    If you choose to use a different server, such as mysqld-nt or
2953    mysqld-debug, make the appropriate substitutions in the commands
2954    that are shown in the examples.
2956 2.3.6.4. Starting MySQL Server on Microsoft Windows for the First
2957 Time
2959    This section gives a general overview of starting the MySQL
2960    server. The following sections provide more specific information
2961    for starting the MySQL server from the command line or as a
2962    Windows service.
2964    The information here applies primarily if you installed MySQL
2965    using the Noinstall version, or if you wish to configure and test
2966    MySQL manually rather than with the GUI tools.
2968    The examples in these sections assume that MySQL is installed
2969    under the default location of C:\Program Files\MySQL\MySQL Server
2970    5.1. Adjust the path names shown in the examples if you have MySQL
2971    installed in a different location.
2973    Clients have two options. They can use TCP/IP, or they can use a
2974    named pipe if the server supports named-pipe connections.
2976    MySQL for Windows also supports shared-memory connections if the
2977    server is started with the --shared-memory option. Clients can
2978    connect through shared memory by using the --protocol=MEMORY
2979    option.
2981    For information about which server binary to run, see Section
2982    2.3.6.3, "Selecting a MySQL Server Type."
2984    Testing is best done from a command prompt in a console window (or
2985    "DOS window"). In this way you can have the server display status
2986    messages in the window where they are easy to see. If something is
2987    wrong with your configuration, these messages make it easier for
2988    you to identify and fix any problems.
2990    To start the server, enter this command:
2991 C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --console
2993    For a server that includes InnoDB support, you should see the
2994    messages similar to those following as it starts (the path names
2995    and sizes may differ):
2996 InnoDB: The first specified datafile c:\ibdata\ibdata1 did not exist:
2997 InnoDB: a new database to be created!
2998 InnoDB: Setting file c:\ibdata\ibdata1 size to 209715200
2999 InnoDB: Database physically writes the file full: wait...
3000 InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be creat
3002 InnoDB: Setting log file c:\iblogs\ib_logfile0 size to 31457280
3003 InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be creat
3005 InnoDB: Setting log file c:\iblogs\ib_logfile1 size to 31457280
3006 InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be creat
3008 InnoDB: Setting log file c:\iblogs\ib_logfile2 size to 31457280
3009 InnoDB: Doublewrite buffer not found: creating new
3010 InnoDB: Doublewrite buffer created
3011 InnoDB: creating foreign key constraint system tables
3012 InnoDB: foreign key constraint system tables created
3013 011024 10:58:25  InnoDB: Started
3015    When the server finishes its startup sequence, you should see
3016    something like this, which indicates that the server is ready to
3017    service client connections:
3018 mysqld: ready for connections
3019 Version: '5.1.74'  socket: ''  port: 3306
3021    The server continues to write to the console any further
3022    diagnostic output it produces. You can open a new console window
3023    in which to run client programs.
3025    If you omit the --console option, the server writes diagnostic
3026    output to the error log in the data directory (C:\Program
3027    Files\MySQL\MySQL Server 5.1\data by default). The error log is
3028    the file with the .err extension.
3029    Note
3031    The accounts that are listed in the MySQL grant tables initially
3032    have no passwords. After starting the server, you should set up
3033    passwords for them using the instructions in Section 2.12.2,
3034    "Securing the Initial MySQL Accounts."
3036 2.3.6.5. Starting MySQL Server from the Windows Command Line
3038    The MySQL server can be started manually from the command line.
3039    This can be done on any version of Windows.
3041    To start the mysqld server from the command line, you should start
3042    a console window (or "DOS window") and enter this command:
3043 C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
3045    The path to mysqld may vary depending on the install location of
3046    MySQL on your system.
3048    You can stop the MySQL server by executing this command:
3049 C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root
3050  shutdown
3052    Note
3054    If the MySQL root user account has a password, you need to invoke
3055    mysqladmin with the -p option and supply the password when
3056    prompted.
3058    This command invokes the MySQL administrative utility mysqladmin
3059    to connect to the server and tell it to shut down. The command
3060    connects as the MySQL root user, which is the default
3061    administrative account in the MySQL grant system. Note that users
3062    in the MySQL grant system are wholly independent from any login
3063    users under Windows.
3065    If mysqld doesn't start, check the error log to see whether the
3066    server wrote any messages there to indicate the cause of the
3067    problem. The error log is located in the C:\Program
3068    Files\MySQL\MySQL Server 5.1\data directory. It is the file with a
3069    suffix of .err. You can also try to start the server as mysqld
3070    --console; in this case, you may get some useful information on
3071    the screen that may help solve the problem.
3073    The last option is to start mysqld with the --standalone and
3074    --debug options. In this case, mysqld writes a log file
3075    C:\mysqld.trace that should contain the reason why mysqld doesn't
3076    start. See Section 22.4.3, "The DBUG Package."
3078    Use mysqld --verbose --help to display all the options that mysqld
3079    supports.
3081 2.3.6.6. Customizing the PATH for MySQL Tools
3083    To make it easier to invoke MySQL programs, you can add the path
3084    name of the MySQL bin directory to your Windows system PATH
3085    environment variable:
3087      * On the Windows desktop, right-click the My Computer icon, and
3088        select Properties.
3090      * Next select the Advanced tab from the System Properties menu
3091        that appears, and click the Environment Variables button.
3093      * Under System Variables, select Path, and then click the Edit
3094        button. The Edit System Variable dialogue should appear.
3096      * Place your cursor at the end of the text appearing in the
3097        space marked Variable Value. (Use the End key to ensure that
3098        your cursor is positioned at the very end of the text in this
3099        space.) Then enter the complete path name of your MySQL bin
3100        directory (for example, C:\Program Files\MySQL\MySQL Server
3101        5.1\bin)
3102        Note
3103        There must be a semicolon separating this path from any values
3104        present in this field.
3105        Dismiss this dialogue, and each dialogue in turn, by clicking
3106        OK until all of the dialogues that were opened have been
3107        dismissed. You should now be able to invoke any MySQL
3108        executable program by typing its name at the DOS prompt from
3109        any directory on the system, without having to supply the
3110        path. This includes the servers, the mysql client, and all
3111        MySQL command-line utilities such as mysqladmin and mysqldump.
3112        You should not add the MySQL bin directory to your Windows
3113        PATH if you are running multiple MySQL servers on the same
3114        machine.
3116    Warning
3118    You must exercise great care when editing your system PATH by
3119    hand; accidental deletion or modification of any portion of the
3120    existing PATH value can leave you with a malfunctioning or even
3121    unusable system.
3123 2.3.6.7. Starting MySQL Server as a Microsoft Windows Service
3125    On Windows, the recommended way to run MySQL is to install it as a
3126    Windows service, so that MySQL starts and stops automatically when
3127    Windows starts and stops, and can be managed using the service
3128    manager framework. A MySQL server installed as a service can also
3129    be controlled from the command line using NET commands, or with
3130    the graphical Services utility. Generally, to install MySQL as a
3131    Windows service you should be logged in using an account that has
3132    administrator rights.
3134    The Services utility (the Windows Service Control Manager) can be
3135    found in the Windows Control Panel (under Administrative Tools on
3136    Windows 2000, XP, Vista, and Server 2003). To avoid conflicts, it
3137    is advisable to close the Services utility while performing server
3138    installation or removal operations from the command line.
3140 Installing the service
3142    Before installing MySQL as a Windows service, you should first
3143    stop the current server if it is running by using the following
3144    command:
3145 C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin"
3146           -u root shutdown
3148    Note
3150    If the MySQL root user account has a password, you need to invoke
3151    mysqladmin with the -p option and supply the password when
3152    prompted.
3154    This command invokes the MySQL administrative utility mysqladmin
3155    to connect to the server and tell it to shut down. The command
3156    connects as the MySQL root user, which is the default
3157    administrative account in the MySQL grant system. Note that users
3158    in the MySQL grant system are wholly independent from any login
3159    users under Windows.
3161    Install the server as a service using this command:
3162 C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install
3164    Note
3166    The service-installation command does not start the server.
3168    The following additional arguments can be used when installing the
3169    service:
3171      * You can specify a service name immediately following the
3172        --install option. The default service name is MySQL.
3174      * If a service name is given, it can be followed by a single
3175        option. By convention, this should be
3176        --defaults-file=file_name to specify the name of an option
3177        file from which the server should read options when it starts.
3178        The use of a single option other than --defaults-file is
3179        possible but discouraged. --defaults-file is more flexible
3180        because it enables you to specify multiple startup options for
3181        the server by placing them in the named option file.
3183      * You can also specify a --local-service option following the
3184        service name. This causes the server to run using the
3185        LocalService Windows account that has limited system
3186        privileges. This account is available only for Windows XP or
3187        newer. If both --defaults-file and --local-service are given
3188        following the service name, they can be in any order.
3190    For a MySQL server that is installed as a Windows service, the
3191    following rules determine the service name and option files that
3192    the server uses:
3194      * If the service-installation command specifies no service name
3195        or the default service name (MySQL) following the --install
3196        option, the server uses the a service name of MySQL and reads
3197        options from the [mysqld] group in the standard option files.
3199      * If the service-installation command specifies a service name
3200        other than MySQL following the --install option, the server
3201        uses that service name. It reads options from the [mysqld]
3202        group and the group that has the same name as the service in
3203        the standard option files. This enables you to use the
3204        [mysqld] group for options that should be used by all MySQL
3205        services, and an option group with the service name for use by
3206        the server installed with that service name.
3208      * If the service-installation command specifies a
3209        --defaults-file option after the service name, the server
3210        reads options the same way as described in the previous item,
3211        except that it reads options only from the the named file and
3212        ignores the standard option files.
3214    As a more complex example, consider the following command:
3215 C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
3216           --install MySQL --defaults-file=C:\my-opts.cnf
3218    Here, the default service name (MySQL) is given after the
3219    --install option. If no --defaults-file option had been given,
3220    this command would have the effect of causing the server to read
3221    the [mysqld] group from the standard option files. However,
3222    because the --defaults-file option is present, the server reads
3223    options from the [mysqld] option group, and only from the named
3224    file.
3225    Note
3227    On Windows, if the server is started with the --defaults-file and
3228    --install options, --install must be first. Otherwise, mysqld.exe
3229    will attempt to start the MySQL server.
3231    You can also specify options as Start parameters in the Windows
3232    Services utility before you start the MySQL service.
3234 Starting the service
3236    Once a MySQL server has been installed as a service, Windows
3237    starts the service automatically whenever Windows starts. The
3238    service also can be started immediately from the Services utility,
3239    or by using a NET START MySQL command. The NET command is not case
3240    sensitive.
3242    When run as a service, mysqld has no access to a console window,
3243    so no messages can be seen there. If mysqld does not start, check
3244    the error log to see whether the server wrote any messages there
3245    to indicate the cause of the problem. The error log is located in
3246    the MySQL data directory (for example, C:\Program
3247    Files\MySQL\MySQL Server 5.1\data). It is the file with a suffix
3248    of .err.
3250    When a MySQL server has been installed as a service, and the
3251    service is running, Windows stops the service automatically when
3252    Windows shuts down. The server also can be stopped manually by
3253    using the Services utility, the NET STOP MySQL command, or the
3254    mysqladmin shutdown command.
3256    You also have the choice of installing the server as a manual
3257    service if you do not wish for the service to be started
3258    automatically during the boot process. To do this, use the
3259    --install-manual option rather than the --install option:
3260 C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install-m
3261 anual
3263 Removing the service
3265    To remove a server that is installed as a service, first stop it
3266    if it is running by executing NET STOP MySQL. Then use the
3267    --remove option to remove it:
3268 C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --remove
3270    If mysqld is not running as a service, you can start it from the
3271    command line. For instructions, see Section 2.3.6.5, "Starting
3272    MySQL Server from the Windows Command Line."
3274    Please see Section 2.3.7, "Troubleshooting a Microsoft Windows
3275    MySQL Server Installation," if you encounter difficulties during
3276    installation.
3278 2.3.6.8. Testing The MySQL Server Installation on Microsoft Windows
3280    You can test whether the MySQL server is working by executing any
3281    of the following commands:
3282 C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow"
3283 C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow" -u root
3284 mysql
3285 C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" version
3286  status proc
3287 C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql" test
3289    Note
3291    By default, mysqlshow will try to connect using the ODBC user.
3292    This user is not created by default. You should specify a valid
3293    user, or root with the right password to check the operation of
3294    the server.
3296    If mysqld is slow to respond to TCP/IP connections from client
3297    programs, there is probably a problem with your DNS. In this case,
3298    start mysqld with the --skip-name-resolve option and use only
3299    localhost and IP addresses in the Host column of the MySQL grant
3300    tables.
3302    You can force a MySQL client to use a named-pipe connection rather
3303    than TCP/IP by specifying the --pipe or --protocol=PIPE option, or
3304    by specifying . (period) as the host name. Use the --socket option
3305    to specify the name of the pipe if you do not want to use the
3306    default pipe name.
3308    Note that if you have set a password for the root account, deleted
3309    the anonymous account, or created a new user account, then you
3310    must use the appropriate -u and -p options with the commands shown
3311    above to connect with the MySQL Server. See Section 4.2.2,
3312    "Connecting to the MySQL Server."
3314    For more information about mysqlshow, see Section 4.5.6,
3315    "mysqlshow --- Display Database, Table, and Column Information."
3317 2.3.7. Troubleshooting a Microsoft Windows MySQL Server Installation
3319    When installing and running MySQL for the first time, you may
3320    encounter certain errors that prevent the MySQL server from
3321    starting. The purpose of this section is to help you diagnose and
3322    correct some of these errors.
3324    Your first resource when troubleshooting server issues is the
3325    error log
3326    (http://dev.mysql.com/doc/refman/5.5/en/glossary.html#glos_error_l
3327    og). The MySQL server uses the error log to record information
3328    relevant to the error that prevents the server from starting. The
3329    error log is located in the data directory
3330    (http://dev.mysql.com/doc/refman/5.5/en/glossary.html#glos_data_di
3331    rectory) specified in your my.ini file. The default data directory
3332    location is C:\Program Files\MySQL\MySQL Server 5.1\data, or
3333    C:\ProgramData\Mysql on Windows 7 and Windows Server 2008. The
3334    C:\ProgramData directory is hidden by default. You need to change
3335    your folder options to see the directory and contents. For more
3336    information on the error log and understanding the content, see
3337    Section 5.2.2, "The Error Log."
3339    Another source of information regarding possible errors is the
3340    console messages displayed when the MySQL service is starting. Use
3341    the NET START MySQL command from the command line after installing
3342    mysqld as a service to see any error messages regarding the
3343    starting of the MySQL server as a service. See Section 2.3.6.7,
3344    "Starting MySQL Server as a Microsoft Windows Service."
3346    The following examples show other common error messages you may
3347    encounter when installing MySQL and starting the server for the
3348    first time:
3350      * If the MySQL server cannot find the mysql privileges database
3351        or other critical files, you may see these messages:
3352 System error 1067 has occurred.
3353 Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't
3354 exist
3355        These messages often occur when the MySQL base or data
3356        directories are installed in different locations than the
3357        default locations (C:\Program Files\MySQL\MySQL Server 5.1 and
3358        C:\Program Files\MySQL\MySQL Server 5.1\data, respectively).
3359        This situation may occur when MySQL is upgraded and installed
3360        to a new location, but the configuration file is not updated
3361        to reflect the new location. In addition, there may be old and
3362        new configuration files that conflict. Be sure to delete or
3363        rename any old configuration files when upgrading MySQL.
3364        If you have installed MySQL to a directory other than
3365        C:\Program Files\MySQL\MySQL Server 5.1, you need to ensure
3366        that the MySQL server is aware of this through the use of a
3367        configuration (my.ini) file. The my.ini file needs to be
3368        located in your Windows directory, typically C:\WINDOWS. You
3369        can determine its exact location from the value of the WINDIR
3370        environment variable by issuing the following command from the
3371        command prompt:
3372 C:\> echo %WINDIR%
3373        An option file can be created and modified with any text
3374        editor, such as Notepad. For example, if MySQL is installed in
3375        E:\mysql and the data directory is D:\MySQLdata, you can
3376        create the option file and set up a [mysqld] section to
3377        specify values for the basedir and datadir options:
3378 [mysqld]
3379 # set basedir to your installation path
3380 basedir=E:/mysql
3381 # set datadir to the location of your data directory
3382 datadir=D:/MySQLdata
3383        Note that Windows path names are specified in option files
3384        using (forward) slashes rather than backslashes. If you do use
3385        backslashes, double them:
3386 [mysqld]
3387 # set basedir to your installation path
3388 basedir=C:\\Program Files\\MySQL\\MySQL Server 5.1
3389 # set datadir to the location of your data directory
3390 datadir=D:\\MySQLdata
3391        The rules for use of backslash in option file values are given
3392        in Section 4.2.3.3, "Using Option Files."
3393        If you change the datadir value in your MySQL configuration
3394        file, you must move the contents of the existing MySQL data
3395        directory before restarting the MySQL server.
3396        See Section 2.3.6.2, "Creating an Option File."
3398      * If you reinstall or upgrade MySQL without first stopping and
3399        removing the existing MySQL service and install MySQL using
3400        the MySQL Config Wizard, you may see this error:
3401 Error: Cannot create Windows service for MySql. Error: 0
3402        This occurs when the Config Wizard tries to install the
3403        service and finds an existing service with the same name.
3404        One solution to this problem is to choose a service name other
3405        than mysql when using the configuration wizard. This enables
3406        the new service to be installed correctly, but leaves the
3407        outdated service in place. Although this is harmless, it is
3408        best to remove old services that are no longer in use.
3409        To permanently remove the old mysql service, execute the
3410        following command as a user with administrative privileges, on
3411        the command-line:
3412 C:\> sc delete mysql
3413 [SC] DeleteService SUCCESS
3414        If the sc utility is not available for your version of
3415        Windows, download the delsrv utility from
3416        http://www.microsoft.com/windows2000/techinfo/reskit/tools/exi
3417        sting/delsrv-o.asp and use the delsrv mysql syntax.
3419 2.3.8. Upgrading MySQL Server on Microsoft Windows
3421    This section lists some of the steps you should take when
3422    upgrading MySQL on Windows.
3424     1. Review Section 2.13.1, "Upgrading MySQL," for additional
3425        information on upgrading MySQL that is not specific to
3426        Windows.
3428     2. You should always back up your current MySQL installation
3429        before performing an upgrade. See Section 7.2, "Database
3430        Backup Methods."
3432     3. Download the latest Windows distribution of MySQL from
3433        http://dev.mysql.com/downloads/.
3435     4. Before upgrading MySQL, you must stop the server. If the
3436        server is installed as a service, stop the service with the
3437        following command from the command prompt:
3438 C:\> NET STOP MySQL
3439        If you are not running the MySQL server as a service, use
3440        mysqladmin to stop it. For example, before upgrading from
3441        MySQL 5.0 to 5.1, use mysqladmin from MySQL 5.0 as follows:
3442 C:\> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqladmin" -u root
3443  shutdown
3444        Note
3445        If the MySQL root user account has a password, you need to
3446        invoke mysqladmin with the -p option and supply the password
3447        when prompted.
3449     5. Before upgrading to MySQL 5.1 from a version previous to
3450        4.1.5, or from a version of MySQL installed from a Zip archive
3451        to a version of MySQL installed with the MySQL Installation
3452        Wizard, you must first manually remove the previous
3453        installation and MySQL service (if the server is installed as
3454        a service).
3455        To remove the MySQL service, use the following command:
3456 C:\> C:\mysql\bin\mysqld --remove
3457        Important
3458        If you do not remove the existing service, the MySQL
3459        Installation Wizard may fail to properly install the new MySQL
3460        service.
3462     6. When upgrading from MySQL 5.1.23 to MySQL 5.1.24, the change
3463        in the default location of the data directory from a directory
3464        within the MySQL installation to the AppData folder means that
3465        you must manually copy the data files from your old
3466        installation to the new location.
3468     7. If you are using the MySQL Installation Wizard, start the
3469        wizard as described in Section 2.3.3.1, "Using the MySQL
3470        Installation Wizard for Microsoft Windows."
3472     8. If you are installing MySQL from a Zip archive, extract the
3473        archive. You may either overwrite your existing MySQL
3474        installation (usually located at C:\mysql), or install it into
3475        a different directory, such as C:\mysql5. Overwriting the
3476        existing installation is recommended.
3478     9. If you were running MySQL as a Windows service and you had to
3479        remove the service earlier in this procedure, reinstall the
3480        service. (See Section 2.3.6.7, "Starting MySQL Server as a
3481        Microsoft Windows Service.")
3482    10. Restart the server. For example, use NET START MySQL if you
3483        run MySQL as a service, or invoke mysqld directly otherwise.
3484    11. As Administrator, run mysql_upgrade to check your tables,
3485        attempt to repair them if necessary, and update your grant
3486        tables if they have changed so that you can take advantage of
3487        any new capabilities. See Section 4.4.8, "mysql_upgrade ---
3488        Check and Upgrade MySQL Tables."
3489    12. If you encounter errors, see Section 2.3.7, "Troubleshooting a
3490        Microsoft Windows MySQL Server Installation."
3492 2.3.9. MySQL Server on Microsoft Windows Postinstallation Procedures
3494    On Windows, you need not create the data directory and the grant
3495    tables. MySQL Windows distributions include the grant tables with
3496    a set of preinitialized accounts in the mysql database under the
3497    data directory. Regarding passwords, if you installed MySQL using
3498    the Windows Installation Wizard, you may have already assigned
3499    passwords to the accounts. (See Section 2.3.3.1, "Using the MySQL
3500    Installation Wizard for Microsoft Windows.") Otherwise, use the
3501    password-assignment procedure given in Section 2.12.2, "Securing
3502    the Initial MySQL Accounts."
3504    Before setting up passwords, you might want to try running some
3505    client programs to make sure that you can connect to the server
3506    and that it is operating properly. Make sure that the server is
3507    running (see Section 2.3.6.4, "Starting MySQL Server on Microsoft
3508    Windows for the First Time"), and then issue the following
3509    commands to verify that you can retrieve information from the
3510    server. You may need to specify directory different from
3511    C:\mysql\bin on the command line. If you used the Windows
3512    Installation Wizard, the default directory is C:\Program
3513    Files\MySQL\MySQL Server 5.1, and the mysql and mysqlshow client
3514    programs are in C:\Program Files\MySQL\MySQL Server 5.1\bin. See
3515    Section 2.3.3.1, "Using the MySQL Installation Wizard for
3516    Microsoft Windows," for more information.
3518    Use mysqlshow to see what databases exist:
3519 C:\> C:\mysql\bin\mysqlshow
3520 +--------------------+
3521 |     Databases      |
3522 +--------------------+
3523 | information_schema |
3524 | mysql              |
3525 | test               |
3526 +--------------------+
3528    The list of installed databases may vary, but will always include
3529    the minimum of mysql and information_schema. In most cases, the
3530    test database will also be installed automatically.
3532    The preceding command (and commands for other MySQL programs such
3533    as mysql) may not work if the correct MySQL account does not
3534    exist. For example, the program may fail with an error, or you may
3535    not be able to view all databases. If you installed using the MSI
3536    packages and used the MySQL Server Instance Config Wizard, then
3537    the root user will have been created automatically with the
3538    password you supplied. In this case, you should use the -u root
3539    and -p options. (You will also need to use the -u root and -p
3540    options if you have already secured the initial MySQL accounts.)
3541    With -p, you will be prompted for the root password. For example:
3542 C:\> C:\mysql\bin\mysqlshow -u root -p
3543 Enter password: (enter root password here)
3544 +--------------------+
3545 |     Databases      |
3546 +--------------------+
3547 | information_schema |
3548 | mysql              |
3549 | test               |
3550 +--------------------+
3552    If you specify a database name, mysqlshow displays a list of the
3553    tables within the database:
3554 C:\> C:\mysql\bin\mysqlshow mysql
3555 Database: mysql
3556 +---------------------------+
3557 |          Tables           |
3558 +---------------------------+
3559 | columns_priv              |
3560 | db                        |
3561 | event                     |
3562 | func                      |
3563 | help_category             |
3564 | help_keyword              |
3565 | help_relation             |
3566 | help_topic                |
3567 | host                      |
3568 | plugin                    |
3569 | proc                      |
3570 | procs_priv                |
3571 | servers                   |
3572 | tables_priv               |
3573 | time_zone                 |
3574 | time_zone_leap_second     |
3575 | time_zone_name            |
3576 | time_zone_transition      |
3577 | time_zone_transition_type |
3578 | user                      |
3579 +---------------------------+
3581    Use the mysql program to select information from a table in the
3582    mysql database:
3583 C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM mysql.db"
3584 +------+--------+------+
3585 | host | db     | user |
3586 +------+--------+------+
3587 | %    | test   |      |
3588 | %    | test_% |      |
3589 +------+--------+------+
3591    For more information about mysqlshow and mysql, see Section 4.5.6,
3592    "mysqlshow --- Display Database, Table, and Column Information,"
3593    and Section 4.5.1, "mysql --- The MySQL Command-Line Tool."
3595    If you are running a version of Windows that supports services,
3596    you can set up the MySQL server to run automatically when Windows
3597    starts. See Section 2.3.6.7, "Starting MySQL Server as a Microsoft
3598    Windows Service."
3600 2.4. Installing MySQL on Mac OS X
3602    MySQL for Mac OS X is available in a number of different forms:
3604      * Native Package Installer format, which uses the native Mac OS
3605        X installer to walk you through the installation of MySQL. For
3606        more information, see Section 2.4.2, "Installing MySQL on Mac
3607        OS X Using Native Packages." You can use the package installer
3608        with Mac OS X 10.3 and later, and the package is available for
3609        both PowerPC and Intel architectures, and 32-bit and 64-bit
3610        architectures. There is no Universal Binary available using
3611        the package installation method. The user you use to perform
3612        the installation must have administrator privileges.
3614      * Tar package format, which uses a file packaged using the Unix
3615        tar and gzip commands. To use this method, you will need to
3616        open a Terminal window. You do not need administrator
3617        privileges using this method, as you can install the MySQL
3618        server anywhere using this method. For more information on
3619        using this method, you can use the generic instructions for
3620        using a tarball, Section 2.2, "Installing MySQL on Unix/Linux
3621        Using Generic Binaries."You can use the package installer with
3622        Mac OS X 10.3 and later, and available for both PowerPC and
3623        Intel architectures, and both 32-bit and 64-bit architectures.
3624        A Universal Binary, incorporating both Power PC and Intel
3625        architectures and 32-bit and 64-bit binaries is available.
3626        In addition to the core installation, the Package Installer
3627        also includes Section 2.4.3, "Installing the MySQL Startup
3628        Item" and Section 2.4.4, "Installing and Using the MySQL
3629        Preference Pane," both of which simplify the management of
3630        your installation.
3632      * Mac OS X server includes a version of MySQL as standard. If
3633        you want to use a more recent version than that supplied with
3634        the Mac OS X server release, you can make use of the package
3635        or tar formats. For more information on using the MySQL
3636        bundled with Mac OS X, see Section 2.4.5, "Using the Bundled
3637        MySQL on Mac OS X Server."
3639    For additional information on using MySQL on Mac OS X, see Section
3640    2.4.1, "General Notes on Installing MySQL on Mac OS X."
3642 2.4.1. General Notes on Installing MySQL on Mac OS X
3644    You should keep the following issues and notes in mind:
3646      * The default location for the MySQL Unix socket is different on
3647        Mac OS X and Mac OS X Server depending on the installation
3648        type you chose. The following table shows the default
3649        locations by installation type.
3650        Table 2.12. MySQL Unix Socket Locations on Mac OS X by
3651        Installation Type
3653                Installation Type             Socket Location
3654        Package Installer from MySQL       /tmp/mysql.sock
3655        Tarball from MySQL                 /tmp/mysql.sock
3656        MySQL Bundled with Mac OS X Server /var/mysql/mysql.sock
3657        To prevent issues, you should either change the configuration
3658        of the socket used within your application (for example,
3659        changing php.ini), or you should configure the socket location
3660        using a MySQL configuration file and the socket option. For
3661        more information, see Section 5.1.3, "Server Command Options."
3663      * You may need (or want) to create a specific mysql user to own
3664        the MySQL directory and data. On Mac OS X 10.4 and lower you
3665        can do this by using the Netinfo Manager application, located
3666        within the Utilities folder within the Applications folder. On
3667        Mac OS X 10.5 and later you can do this through the Directory
3668        Utility. From Mac OS X 10.5 and later (including Mac OS X
3669        Server 10.5) the mysql should already exist. For use in single
3670        user mode, an entry for _mysql (note the underscore prefix)
3671        should already exist within the system /etc/passwd file.
3673      * Due to a bug in the Mac OS X package installer, you may see
3674        this error message in the destination disk selection dialog:
3675 You cannot install this software on this disk. (null)
3676        If this error occurs, click the Go Back button once to return
3677        to the previous screen. Then click Continue to advance to the
3678        destination disk selection again, and you should be able to
3679        choose the destination disk correctly. We have reported this
3680        bug to Apple and it is investigating this problem.
3682      * If you get an "insecure startup item disabled" error when
3683        MySQL launches, use the following procedure. Adjust the
3684        pathnames appropriately for your system.
3686          1. Modify the mysql.script using this command (enter it on a
3687             single line):
3688 shell> sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit
3689   /usr/local/mysql/support-files/mysql.server
3691          2. Locate the option file that defines the basedir value and
3692             modify it to contain these lines:
3693 basedir=/usr/local/mysql
3694 datadir=/usr/local/mysql/data
3695             In the /Library/StartupItems/MySQLCOM/ directory, make
3696             the following group ID changes from staff to wheel:
3697 shell> sudo chgrp wheel MySQLCOM StartupParameters.plist
3699          3. Start the server from System Preferences or Terminal.app.
3701      * Because the MySQL package installer installs the MySQL
3702        contents into a version and platform specific directory, you
3703        can use this to upgrade and migrate your database between
3704        versions. You will need to either copy the data directory from
3705        the old version to the new version, or alternatively specify
3706        an alternative datadir value to set location of the data
3707        directory.
3709      * You might want to add aliases to your shell's resource file to
3710        make it easier to access commonly used programs such as mysql
3711        and mysqladmin from the command line. The syntax for bash is:
3712 alias mysql=/usr/local/mysql/bin/mysql
3713 alias mysqladmin=/usr/local/mysql/bin/mysqladmin
3714        For tcsh, use:
3715 alias mysql /usr/local/mysql/bin/mysql
3716 alias mysqladmin /usr/local/mysql/bin/mysqladmin
3717        Even better, add /usr/local/mysql/bin to your PATH environment
3718        variable. You can do this by modifying the appropriate startup
3719        file for your shell. For more information, see Section 4.2.1,
3720        "Invoking MySQL Programs."
3722      * After you have copied over the MySQL database files from the
3723        previous installation and have successfully started the new
3724        server, you should consider removing the old installation
3725        files to save disk space. Additionally, you should also remove
3726        older versions of the Package Receipt directories located in
3727        /Library/Receipts/mysql-VERSION.pkg.
3729 2.4.2. Installing MySQL on Mac OS X Using Native Packages
3731    You can install MySQL on Mac OS X 10.3.x ("Panther") or newer
3732    using a Mac OS X binary package in DMG format instead of the
3733    binary tarball distribution. Please note that older versions of
3734    Mac OS X (for example, 10.1.x or 10.2.x) are not supported by this
3735    package.
3737    The package is located inside a disk image (.dmg) file that you
3738    first need to mount by double-clicking its icon in the Finder. It
3739    should then mount the image and display its contents.
3740    Note
3742    Before proceeding with the installation, be sure to stop all
3743    running MySQL server instances by using either the MySQL Manager
3744    Application (on Mac OS X Server) or mysqladmin shutdown on the
3745    command line.
3747    When installing from the package version, you should also install
3748    the MySQL Preference Pane, which will enable you to control the
3749    startup and execution of your MySQL server from System
3750    Preferences. For more information, see Section 2.4.4, "Installing
3751    and Using the MySQL Preference Pane."
3753    When installing using the package installer, the files are
3754    installed into a directory within /usr/local matching the name of
3755    the installation version and platform. For example, the installer
3756    file mysql-5.1.39-osx10.5-x86_64.pkg installs MySQL into
3757    /usr/local/mysql-5.1.39-osx10.5-x86_64 . The following table shows
3758    the layout of the installation directory.
3760    Table 2.13. MySQL Installation Layout on Mac OS X
3761    Directory Contents of Directory
3762    bin Client programs and the mysqld server
3763    data Log files, databases
3764    docs Manual in Info format
3765    include Include (header) files
3766    lib Libraries
3767    man Unix manual pages
3768    mysql-test MySQL test suite
3769    scripts mysql_install_db
3770    share Miscellaneous support files, including error messages,
3771    sample configuration files, SQL for database installation
3772    sql-bench Benchmarks
3773    support-files Scripts and sample configuration files
3774    /tmp/mysql.sock Location of the MySQL Unix socket
3776    During the package installer process, a symbolic link from
3777    /usr/local/mysql to the version/platform specific directory
3778    created during installation will be created automatically.
3780     1. Download and open the MySQL package installer, which is
3781        provided on a disk image (.dmg) that includes the main MySQL
3782        installation package, the MySQLStartupItem.pkg installation
3783        package, and the MySQL.prefPane. Double-click the disk image
3784        to open it.
3786     2. Double-click the MySQL installer package. It will be named
3787        according to the version of MySQL you have downloaded. For
3788        example, if you have downloaded MySQL 5.1.39, double-click
3789        mysql-5.1.39-osx10.5-x86.pkg.
3791     3. You will be presented with the opening installer dialog. Click
3792        Continue to begin installation.
3793        MySQL Package Installer: Step 1
3795     4. A copy of the installation instructions and other important
3796        information relevant to this installation are displayed. Click
3797        Continue .
3799     5. If you have downloaded the community version of MySQL, you
3800        will be shown a copy of the relevant GNU General Public
3801        License. Click Continue .
3803     6. Select the drive you want to use to install the MySQL Startup
3804        Item. The drive must have a valid, bootable, Mac OS X
3805        operating system installed. Click Continue.
3806        MySQL Package Installer: Step 4
3808     7. You will be asked to confirm the details of the installation,
3809        including the space required for the installation. To change
3810        the drive on which the startup item is installed, click either
3811        Go Back or Change Install Location.... To install the startup
3812        item, click Install.
3814     8. Once the installation has been completed successfully, you
3815        will be shown an Install Succeeded message.
3817    For convenience, you may also want to install the startup item and
3818    preference pane. See Section 2.4.3, "Installing the MySQL Startup
3819    Item," and Section 2.4.4, "Installing and Using the MySQL
3820    Preference Pane."
3822 2.4.3. Installing the MySQL Startup Item
3824    The MySQL Installation Package includes a startup item that can be
3825    used to automatically start and stop MySQL.
3827    To install the MySQL Startup Item:
3829     1. Download and open the MySQL package installer, which is
3830        provided on a disk image (.dmg) that includes the main MySQL
3831        installation package, the MySQLStartupItem.pkg installation
3832        package, and the MySQL.prefPane. Double-click the disk image
3833        to open it.
3835     2. Double-click the MySQLStartItem.pkg file to start the
3836        installation process.
3838     3. You will be presented with the Install MySQL Startup Item
3839        dialog.
3840        MySQL Startup Item Installer: Step 1
3841        Click Continue to continue the installation process.
3843     4. A copy of the installation instructions and other important
3844        information relevant to this installation are displayed. Click
3845        Continue .
3847     5. Select the drive you want to use to install the MySQL Startup
3848        Item. The drive must have a valid, bootable, Mac OS X
3849        operating system installed. Click Continue.
3850        MySQL Startup Item Installer: Step 3
3852     6. You will be asked to confirm the details of the installation.
3853        To change the drive on which the startup item is installed,
3854        click either Go Back or Change Install Location.... To install
3855        the startup item, click Install.
3857     7. Once the installation has been completed successfully, you
3858        will be shown an Install Succeeded message.
3859        MySQL Startup Item Installer: Step 5
3861    The Startup Item for MySQL is installed into
3862    /Library/StartupItems/MySQLCOM. The Startup Item installation adds
3863    a variable MYSQLCOM=-YES- to the system configuration file
3864    /etc/hostconfig. If you want to disable the automatic startup of
3865    MySQL, change this variable to MYSQLCOM=-NO-.
3867    After the installation, you can start and stop MySQL by running
3868    the following commands in a terminal window. You must have
3869    administrator privileges to perform these tasks, and you may be
3870    prompted for your password.
3872    If you have installed the Startup Item, use this command to start
3873    the server:
3874 shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
3876    If you have installed the Startup Item, use this command to stop
3877    the server:
3878 shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
3880 2.4.4. Installing and Using the MySQL Preference Pane
3882    The MySQL Package installer disk image also includes a custom
3883    MySQL Preference Pane that enables you to start, stop, and control
3884    automated startup during boot of your MySQL installation.
3886    To install the MySQL Preference Pane:
3888     1. Download and open the MySQL package installer package, which
3889        is provided on a disk image (.dmg) that includes the main
3890        MySQL installation package, the MySQLStartupItem.pkg
3891        installation package, and the MySQL.prefPane. Double-click the
3892        disk image to open it.
3894     2. Double-click the MySQL.prefPane. The MySQL System Preferences
3895        will open.
3897     3. If this is the first time you have installed the preference
3898        pane, you will be asked to confirm installation and whether
3899        you want to install the preference pane for all users, or only
3900        the current user. To install the preference pane for all users
3901        you will need administrator privileges. If necessary, you will
3902        be prompted for the username and password for a user with
3903        administrator privileges.
3905     4. If you already have the MySQL Preference Pane installed, you
3906        will be asked to confirm whether you want to overwrite the
3907        existing MySQL Preference Pane.
3909    Note
3911    The MySQL Preference Pane only starts and stops MySQL installation
3912    installed from the MySQL package installation that have been
3913    installed in the default location.
3915    Once the MySQL Preference Pane has been installed, you can control
3916    your MySQL server instance using the preference pane. To use the
3917    preference pane, open the System Preferences... from the Apple
3918    menu. Select the MySQL preference pane by clicking the MySQL logo
3919    within the Other section of the preference panes list.
3920    MySQL Preference Pane
3922    The MySQL Preference Pane shows the current status of the MySQL
3923    server, showing stopped (in red) if the server is not running and
3924    running (in green) if the server has already been started. The
3925    preference pane also shows the current setting for whether the
3926    MySQL server has been set to start automatically.
3928      * To start MySQL using the preference pane: 
3929        Click Start MySQL Server. You may be prompted for the username
3930        and password of a user with administrator privileges to start
3931        the MySQL server.
3933      * To stop MySQL using the preference pane: 
3934        Click Stop MySQL Server. You may be prompted for the username
3935        and password of a user with administrator privileges to stop
3936        the MySQL server.
3938      * To automatically start the MySQL server when the system boots:
3939        Check the check box next to Automatically Start MySQL Server
3940        on Startup.
3942      * To disable automatic MySQL server startup when the system
3943        boots:
3944        Uncheck the check box next to Automatically Start MySQL Server
3945        on Startup.
3947    You can close the System Preferences... window once you have
3948    completed your settings.
3950 2.4.5. Using the Bundled MySQL on Mac OS X Server
3952    If you are running Mac OS X Server, a version of MySQL should
3953    already be installed. The following table shows the versions of
3954    MySQL that ship with Mac OS X Server versions.
3956    Table 2.14. MySQL Versions Preinstalled with Mac OS X Server
3957    Mac OS X Server Version MySQL Version
3958    10.2-10.2.2             3.23.51
3959    10.2.3-10.2.6           3.23.53
3960    10.3                    4.0.14
3961    10.3.2                  4.0.16
3962    10.4.0                  4.1.10a
3963    10.5.0                  5.0.45
3964    10.6.0                  5.0.82
3966    The following table shows the installation layout of MySQL on Mac
3967    OS X Server.
3969    Table 2.15. MySQL Directory Layout for Preinstalled MySQL
3970    Installations on Mac OS X Server
3971    Directory Contents of Directory
3972    /usr/bin Client programs
3973    /var/mysql Log files, databases
3974    /usr/libexec The mysqld server
3975    /usr/share/man Unix manual pages
3976    /usr/share/mysql/mysql-test MySQL test suite
3977    /usr/share/mysql Miscellaneous support files, including error
3978    messages, character set files, sample configuration files, SQL for
3979    database installation
3980    /var/mysql/mysql.sock Location of the MySQL Unix socket
3982 Additional Resources
3985      * For more information on managing the bundled MySQL instance in
3986        Mac OS X Server 10.5, see Mac OS X Server: Web Technologies
3987        Administration For Version 10.5 Leopard
3988        (http://images.apple.com/server/macosx/docs/Web_Technologies_A
3989        dmin_v10.5.pdf).
3991      * For more information on managing the bundled MySQL instance in
3992        Mac OS X Server 10.6, see Mac OS X Server: Web Technologies
3993        Administration Version 10.6 Snow Leopard
3994        (http://manuals.info.apple.com/en_US/WebTech_v10.6.pdf).
3996      * The MySQL server bundled with Mac OS X Server does not include
3997        the MySQL client libraries and header files required to access
3998        and use MySQL from a third-party driver, such as Perl DBI or
3999        PHP. For more information on obtaining and installing MySQL
4000        libraries, see Mac OS X Server version 10.5: MySQL libraries
4001        available for download (http://support.apple.com/kb/TA25017).
4002        Alternatively, you can ignore the bundled MySQL server and
4003        install MySQL from the package or tarball installation.
4005 2.5. Installing MySQL on Linux
4007    Linux supports a number of different solutions for installing
4008    MySQL. The recommended method is to use one of the distributions
4009    from Oracle. If you choose this method, there are several options
4010    available:
4012      * Installing from a generic binary package in .tar.gz format.
4013        See Section 2.2, "Installing MySQL on Unix/Linux Using Generic
4014        Binaries" for more information.
4016      * Extracting and compiling MySQL from a source distribution. For
4017        detailed instructions, see Section 2.11, "Installing MySQL
4018        from Source."
4020      * Installing using a precompiled RPM package. For more
4021        information, see Section 2.5.1, "Installing MySQL on Linux
4022        Using RPM Packages."
4024    As an alternative, you can use the native package manager within
4025    your Linux distribution to automatically download and install
4026    MySQL for you. Native package installations can take care of the
4027    download and dependencies required to run MySQL, but the MySQL
4028    version will often be some versions behind the currently available
4029    release. You will also normally be unable to install development
4030    releases, as these are not usually made available in the native
4031    repository. For more information on using the native package
4032    installers, see Section 2.5.2, "Installing MySQL on Linux Using
4033    Native Package Managers."
4034    Note
4036    For many Linux installations, you will want to set up MySQL to be
4037    started automatically when your machine starts. Many of the native
4038    package installations perform this operation for you, but for
4039    source, binary and RPM solutions you may need to set this up
4040    separately. The required script, mysql.server, can be found in the
4041    support-files directory under the MySQL installation directory or
4042    in a MySQL source tree. You can install it as /etc/init.d/mysql
4043    for automatic MySQL startup and shutdown. See Section 2.12.1.2,
4044    "Starting and Stopping MySQL Automatically."
4046 2.5.1. Installing MySQL on Linux Using RPM Packages
4048    The recommended way to install MySQL on RPM-based Linux
4049    distributions is by using the RPM packages. The RPMs that we
4050    provide to the community should work on all versions of Linux that
4051    support RPM packages and use glibc 2.3. To obtain RPM packages,
4052    see Section 2.1.3, "How to Get MySQL."
4054    For non-RPM Linux distributions, you can install MySQL using a
4055    .tar.gz package. See Section 2.2, "Installing MySQL on Unix/Linux
4056    Using Generic Binaries."
4058    Installations created from our Linux RPM distributions result in
4059    files under the system directories shown in the following table.
4061    Table 2.16. MySQL Installation Layout for Linux RPM Packages
4062    Directory Contents of Directory
4063    /usr/bin Client programs and scripts
4064    /usr/sbin The mysqld server
4065    /var/lib/mysql Log files, databases
4066    /usr/share/info Manual in Info format
4067    /usr/share/man Unix manual pages
4068    /usr/include/mysql Include (header) files
4069    /usr/lib/mysql Libraries
4070    /usr/share/mysql Miscellaneous support files, including error
4071    messages, character set files, sample configuration files, SQL for
4072    database installation
4073    /usr/share/sql-bench Benchmarks
4074    Note
4076    RPM distributions of MySQL are also provided by other vendors. Be
4077    aware that they may differ from those built by us in features,
4078    capabilities, and conventions (including communication setup), and
4079    that the instructions in this manual do not necessarily apply to
4080    installing them. The vendor's instructions should be consulted
4081    instead. Because of these differences, RPM packages built by us
4082    check whether such RPMs built by other vendors are installed. If
4083    so, the RPM does not install and produces a message explaining
4084    this.
4086    In most cases, you need to install only the MySQL-server and
4087    MySQL-client packages to get a functional MySQL installation. The
4088    other packages are not required for a standard installation.
4090    RPMs for MySQL Cluster.  Beginning with MySQL 5.1.24, standard
4091    MySQL server RPMs built by MySQL no longer provide support for the
4092    NDBCLUSTER storage engine. MySQL Cluster users should check the
4093    MySQL Cluster Downloads page at
4094    http://dev.mysql.com/downloads/cluster/ for RPMs that should work
4095    with most Linux distributions for both of these release series.
4096    Important
4098    When upgrading a MySQL Cluster RPM installation, you must upgrade
4099    all installed RPMs, including the Server and Client RPMs.
4101    For more information about installing MySQL Cluster from RPMs, see
4102    Section 17.2.1.2, "Installing MySQL Cluster from RPM."
4104    For upgrades, if your installation was originally produced by
4105    installing multiple RPM packages, it is best to upgrade all the
4106    packages, not just some. For example, if you previously installed
4107    the server and client RPMs, do not upgrade just the server RPM.
4109    The RPM packages shown in the following list are available. The
4110    names shown here use a suffix of .glibc23.i386.rpm, but particular
4111    packages can have different suffixes, described later.
4113      * MySQL-server-VERSION.glibc23.i386.rpm
4114        The MySQL server. You need this unless you only want to
4115        connect to a MySQL server running on another machine.
4117      * MySQL-client-VERSION.glibc23.i386.rpm
4118        The standard MySQL client programs. You probably always want
4119        to install this package.
4121      * MySQL-devel-VERSION.glibc23.i386.rpm
4122        The libraries and include files that are needed if to compile
4123        other MySQL clients, such as the Perl modules. Install this
4124        RPM if you intend to compile C API applications.
4126      * MySQL-debuginfo-VERSION.glibc23.i386.rpm
4127        This package contains debugging information. It is specific to
4128        Red Hat Enterprise Linux. debuginfo RPMs are never needed to
4129        use MySQL software; this is true both for the server and for
4130        client programs. However, they contain additional information
4131        that might be needed by a debugger to analyze a crash.
4133      * MySQL-shared-VERSION.glibc23.i386.rpm
4134        This package contains the shared libraries
4135        (libmysqlclient.so*) that certain languages and applications
4136        need to dynamically load and use MySQL. It contains
4137        single-threaded and thread-safe libraries. Install this RPM if
4138        you intend to compile or run C API applications that depend on
4139        the shared client library. If you install this package, do not
4140        install the MySQL-shared-compat package.
4142      * MySQL-shared-compat-VERSION.glibc23.i386.rpm
4143        This package includes the shared libraries for older releases,
4144        up to the current release. It contains single-threaded and
4145        thread-safe libraries. Install this package instead of
4146        MySQL-shared if you have applications installed that are
4147        dynamically linked against older versions of MySQL but you
4148        want to upgrade to the current version without breaking the
4149        library dependencies.
4151      * MySQL-shared-compat-advanced-gpl-VERSION.glibc23.i386.rpm,
4152        MySQL-shared-compat-advanced-VERSION.glibc23.i386.rpm
4153        These are like the MySQL-shared-compat package, but are for
4154        the "MySQL Enterprise Server - Advanced Edition" products.
4155        Install these packages rather than the normal
4156        MySQL-shared-compat package if you want to included shared
4157        client libraries for older MySQL versions.
4159      * MySQL-embedded-VERSION.glibc23.i386.rpm
4160        The embedded MySQL server library.
4162      * MySQL-ndb-management-VERSION.glibc23.i386.rpm,
4163        MySQL-ndb-storage-VERSION.glibc23.i386.rpm,
4164        MySQL-ndb-tools-VERSION.glibc23.i386.rpm,
4165        MySQL-ndb-extra-VERSION.glibc23.i386.rpm
4166        Packages that contain additional files for MySQL Cluster
4167        installations.
4168        Note
4169        The MySQL-ndb-tools RPM requires a working installation of
4170        perl. Prior to MySQL 5.1.18, the DBI and HTML::Template
4171        packages were also required. See Section 2.15, "Perl
4172        Installation Notes," and Section 17.4.23, "ndb_size.pl ---
4173        NDBCLUSTER Size Requirement Estimator," for more information.
4175      * MySQL-test-VERSION.glibc23.i386.rpm
4176        This package includes the MySQL test suite.
4178      * MySQL-VERSION.src.rpm
4179        This contains the source code for all of the previous
4180        packages. It can also be used to rebuild the RPMs on other
4181        architectures (for example, Alpha or SPARC).
4183    The suffix of RPM package names (following the VERSION value) has
4184    the following syntax:
4185 .PLATFORM.CPU.rpm
4187    The PLATFORM and CPU values indicate the type of system for which
4188    the package is built. PLATFORM indicates the platform and CPU
4189    indicates the processor type or family.
4191    All packages are dynamically linked against glibc 2.3. The
4192    PLATFORM value indicates whether the package is platform
4193    independent or intended for a specific platform, as shown in the
4194    following table.
4196    Table 2.17. MySQL Linux Installation Packages
4197    PLATFORM Value Intended Use
4198    glibc23 Platform independent, should run on any Linux distribution
4199    that supports glibc 2.3
4200    rhel4, rhel5 Red Hat Enterprise Linux 4 or 5
4201    sles10, sles11 SuSE Linux Enterprise Server 10 or 11
4203    In MySQL 5.1, only glibc23 packages are available currently.
4205    The CPU value indicates the processor type or family for which the
4206    package is built.
4208    Table 2.18. MySQL Installation Packages for Linux CPU Identifiers
4209       CPU Value      Intended Processor Type or Family
4210    i386, i586, i686 Pentium processor or better, 32 bit
4211    x86_64           64-bit x86 processor
4212    ia64             Itanium (IA-64) processor
4214    To see all files in an RPM package (for example, a MySQL-server
4215    RPM), run a command like this:
4216 shell> rpm -qpl MySQL-server-VERSION.glibc23.i386.rpm
4218    To perform a standard minimal installation, install the server and
4219    client RPMs:
4220 shell> rpm -i MySQL-server-VERSION.glibc23.i386.rpm
4221 shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
4223    To install only the client programs, install just the client RPM:
4224 shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
4226    RPM provides a feature to verify the integrity and authenticity of
4227    packages before installing them. To learn more about this feature,
4228    see Section 2.1.4, "Verifying Package Integrity Using MD5
4229    Checksums or GnuPG."
4231    The server RPM places data under the /var/lib/mysql directory. The
4232    RPM also creates a login account for a user named mysql (if one
4233    does not exist) to use for running the MySQL server, and creates
4234    the appropriate entries in /etc/init.d/ to start the server
4235    automatically at boot time. (This means that if you have performed
4236    a previous installation and have made changes to its startup
4237    script, you may want to make a copy of the script so that you do
4238    not lose it when you install a newer RPM.) See Section 2.12.1.2,
4239    "Starting and Stopping MySQL Automatically," for more information
4240    on how MySQL can be started automatically on system startup.
4242    In MySQL 5.1.49 and later, during an upgrade installation using
4243    the RPM packages, if the MySQL server is running when the upgrade
4244    occurs, the MySQL server is stopped, the upgrade occurs, and the
4245    MySQL server is restarted. If the MySQL server is not already
4246    running when the RPM upgrade occurs, the MySQL server is not
4247    started at the end of the installation.
4249    If something goes wrong, you can find more information in the
4250    binary installation section. See Section 2.2, "Installing MySQL on
4251    Unix/Linux Using Generic Binaries."
4252    Note
4254    The accounts that are listed in the MySQL grant tables initially
4255    have no passwords. After starting the server, you should set up
4256    passwords for them using the instructions in Section 2.12,
4257    "Postinstallation Setup and Testing."
4259    During RPM installation, a user named mysql and a group named
4260    mysql are created on the system. This is done using the useradd,
4261    groupadd, and usermod commands. Those commands require appropriate
4262    administrative privileges, which is required for locally managed
4263    users and groups (as listed in the /etc/passwd and /etc/group
4264    files) by the RPM installation process being run by root.
4266    If you log in as the mysql user, you may find that MySQL displays
4267    "Invalid (old?) table or database name" errors that mention
4268    .mysqlgui, lost+found, .mysqlgui, .bash_history, .fonts.cache-1,
4269    .lesshst, .mysql_history, .profile, .viminfo, and similar files
4270    created by MySQL or operating system utilities. You can safely
4271    ignore these error messages or remove the files or directories
4272    that cause them if you do not need them.
4274    For nonlocal user management (LDAP, NIS, and so forth), the
4275    administrative tools may require additional authentication (such
4276    as a password), and will fail if the installing user does not
4277    provide this authentication. Even if they fail, the RPM
4278    installation will not abort but succeed, and this is intentional.
4279    If they failed, some of the intended transfer of ownership may be
4280    missing, and it is recommended that the system administrator then
4281    manually ensures some appropriate user and group exists and
4282    manually transfers ownership following the actions in the RPM spec
4283    file.
4285 2.5.2. Installing MySQL on Linux Using Native Package Managers
4287    Many Linux distributions include a version of the MySQL server,
4288    client tools, and development components into the standard package
4289    management system built into distributions such as Fedora, Debian,
4290    Ubuntu, and Gentoo. This section provides basic instructions for
4291    installing MySQL using these systems.
4292    Important
4294    Native package installations can take care of the download and
4295    dependencies required to run MySQL, but the MySQL version will
4296    often be some way behind the currently available release. You will
4297    also normally be unable to install development releases, as these
4298    are not usually made available in the native repository.
4300    Distribution specific instructions are shown below:
4302      * Red Hat Linux, Fedora, CentOS
4303        For Red Hat and similar distributions, the MySQL distribution
4304        is divided into a number of separate packages, mysql for the
4305        client tools, mysql-server for the server and associated
4306        tools, and mysql-libs for the libraries. The libraries are
4307        required if you want to provide connectivity from different
4308        languages and environments such as Perl, Python and others.
4309        To install, use the yum command to specify the packages that
4310        you want to install. For example:
4311 root-shell> yum install mysql mysql-server mysql-libs mysql-server
4312 Loaded plugins: presto, refresh-packagekit
4313 Setting up Install Process
4314 Resolving Dependencies
4315 --> Running transaction check
4316 ---> Package mysql.x86_64 0:5.1.48-2.fc13 set to be updated
4317 ---> Package mysql-libs.x86_64 0:5.1.48-2.fc13 set to be updated
4318 ---> Package mysql-server.x86_64 0:5.1.48-2.fc13 set to be updated
4319 --> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5
4320 .1.48-2.fc13.x86_64
4321 --> Running transaction check
4322 ---> Package perl-DBD-MySQL.x86_64 0:4.017-1.fc13 set to be updated
4323 --> Finished Dependency Resolution
4325 Dependencies Resolved
4327 =====================================================================
4328 ===========
4329  Package               Arch          Version               Repository
4330       Size
4331 =====================================================================
4332 ===========
4333 Installing:
4334  mysql                 x86_64        5.1.48-2.fc13         updates
4335      889 k
4336  mysql-libs            x86_64        5.1.48-2.fc13         updates
4337      1.2 M
4338  mysql-server          x86_64        5.1.48-2.fc13         updates
4339      8.1 M
4340 Installing for dependencies:
4341  perl-DBD-MySQL        x86_64        4.017-1.fc13          updates
4342      136 k
4344 Transaction Summary
4345 =====================================================================
4346 ===========
4347 Install       4 Package(s)
4348 Upgrade       0 Package(s)
4350 Total download size: 10 M
4351 Installed size: 30 M
4352 Is this ok [y/N]: y
4353 Downloading Packages:
4354 Setting up and reading Presto delta metadata
4355 Processing delta metadata
4356 Package(s) data still to download: 10 M
4357 (1/4): mysql-5.1.48-2.fc13.x86_64.rpm                    | 889 kB
4358  00:04
4359 (2/4): mysql-libs-5.1.48-2.fc13.x86_64.rpm               | 1.2 MB
4360  00:06
4361 (3/4): mysql-server-5.1.48-2.fc13.x86_64.rpm             | 8.1 MB
4362  00:40
4363 (4/4): perl-DBD-MySQL-4.017-1.fc13.x86_64.rpm            | 136 kB
4364  00:00
4365 ---------------------------------------------------------------------
4366 -----------
4367 Total                                           201 kB/s |  10 MB
4368  00:52
4369 Running rpm_check_debug
4370 Running Transaction Test
4371 Transaction Test Succeeded
4372 Running Transaction
4373   Installing     : mysql-libs-5.1.48-2.fc13.x86_64
4374        1/4
4375   Installing     : mysql-5.1.48-2.fc13.x86_64
4376        2/4
4377   Installing     : perl-DBD-MySQL-4.017-1.fc13.x86_64
4378        3/4
4379   Installing     : mysql-server-5.1.48-2.fc13.x86_64
4380        4/4
4382 Installed:
4383   mysql.x86_64 0:5.1.48-2.fc13            mysql-libs.x86_64 0:5.1.48-
4384 2.fc13
4385   mysql-server.x86_64 0:5.1.48-2.fc13
4387 Dependency Installed:
4388   perl-DBD-MySQL.x86_64 0:4.017-1.fc13
4391 Complete!
4392        MySQL and the MySQL server should now be installed. A sample
4393        configuration file is installed into /etc/my.cnf. An init
4394        script, to start and stop the server, will have been installed
4395        into /etc/init.d/mysqld. To start the MySQL server use
4396        service:
4397 root-shell> service mysqld start
4398        To enable the server to be started and stopped automatically
4399        during boot, use chkconfig:
4400 root-shell> chkconfig --levels 235 mysqld on
4401        Which enables the MySQL server to be started (and stopped)
4402        automatically at the specified the run levels.
4403        The database tables will have been automatically created for
4404        you, if they do not already exist. You should, however, run
4405        mysql_secure_installation to set the root passwords on your
4406        server.
4408      * Debian, Ubuntu, Kubuntu
4409        On Debian and related distributions, there are two packages,
4410        mysql-client and mysql-server, for the client and server
4411        components respectively. You should specify an explicit
4412        version, for example mysql-client-5.1, to ensure that you
4413        install the version of MySQL that you want.
4414        To download and install, including any dependencies, use the
4415        apt-get command, specifying the packages that you want to
4416        install.
4417        Note
4418        Before installing, make sure that you update your apt-get
4419        index files to ensure you are downloading the latest available
4420        version.
4421        A sample installation of the MySQL packages might look like
4422        this (some sections trimmed for clarity):
4423 root-shell> apt-get install mysql-client-5.1 mysql-server-5.1
4424 Reading package lists... Done
4425 Building dependency tree
4426 Reading state information... Done
4427 The following packages were automatically installed and are no longer
4428  required:
4429   linux-headers-2.6.28-11 linux-headers-2.6.28-11-generic
4430 Use 'apt-get autoremove' to remove them.
4431 The following extra packages will be installed:
4432   bsd-mailx libdbd-mysql-perl libdbi-perl libhtml-template-perl
4433   libmysqlclient15off libmysqlclient16 libnet-daemon-perl libplrpc-pe
4434 rl mailx
4435   mysql-common postfix
4436 Suggested packages:
4437   dbishell libipc-sharedcache-perl tinyca procmail postfix-mysql post
4438 fix-pgsql
4439   postfix-ldap postfix-pcre sasl2-bin resolvconf postfix-cdb
4440 The following NEW packages will be installed
4441   bsd-mailx libdbd-mysql-perl libdbi-perl libhtml-template-perl
4442   libmysqlclient15off libmysqlclient16 libnet-daemon-perl libplrpc-pe
4443 rl mailx
4444   mysql-client-5.1 mysql-common mysql-server-5.1 postfix
4445 0 upgraded, 13 newly installed, 0 to remove and 182 not upgraded.
4446 Need to get 1907kB/25.3MB of archives.
4447 After this operation, 59.5MB of additional disk space will be used.
4448 Do you want to continue [Y/n]? Y
4449 Get: 1 http://gb.archive.ubuntu.com jaunty-updates/main mysql-common
4450 5.1.30really5.0.75-0ubuntu10.5 [63.6kB]
4451 Get: 2 http://gb.archive.ubuntu.com jaunty-updates/main libmysqlclien
4452 t15off 5.1.30really5.0.75-0ubuntu10.5 [1843kB]
4453 Fetched 1907kB in 9s (205kB/s)
4455 Preconfiguring packages ...
4456 Selecting previously deselected package mysql-common.
4457 (Reading database ... 121260 files and directories currently installe
4460 Processing 1 added doc-base file(s)...
4461 Registering documents with scrollkeeper...
4462 Setting up libnet-daemon-perl (0.43-1) ...
4463 Setting up libplrpc-perl (0.2020-1) ...
4464 Setting up libdbi-perl (1.607-1) ...
4465 Setting up libmysqlclient15off (5.1.30really5.0.75-0ubuntu10.5) ...
4467 Setting up libdbd-mysql-perl (4.008-1) ...
4468 Setting up libmysqlclient16 (5.1.31-1ubuntu2) ...
4470 Setting up mysql-client-5.1 (5.1.31-1ubuntu2) ...
4472 Setting up mysql-server-5.1 (5.1.31-1ubuntu2) ...
4474  * Stopping MySQL database server mysqld
4475    ...done.
4476 100825 11:46:15  InnoDB: Started; log sequence number 0 46409
4477 100825 11:46:15  InnoDB: Starting shutdown...
4478 100825 11:46:17  InnoDB: Shutdown completed; log sequence number 0 46
4480 100825 11:46:17 [Warning] Forcing shutdown of 1 plugins
4482  * Starting MySQL database server mysqld
4483    ...done.
4485  * Checking for corrupt, not cleanly closed and upgrade needing table
4488 Processing triggers for libc6 ...
4489 ldconfig deferred processing now taking place
4490        Note
4491        The apt-get command will install a number of packages,
4492        including the MySQL server, in order to provide the typical
4493        tools and application environment. This can mean that you
4494        install a large number of packages in addition to the main
4495        MySQL package.
4496        During installation, the initial database will be created, and
4497        you will be prompted for the MySQL root password (and
4498        confirmation). A configuration file will have been created in
4499        /etc/mysql/my.cnf. An init script will have been created in
4500        /etc/init.d/mysql.
4501        The server will already be started. You can manually start and
4502        stop the server using:
4503 root-shell> service mysql [start|stop]
4504        The service will automatically be added to the 2, 3 and 4 run
4505        levels, with stop scripts in the single, shutdown and restart
4506        levels.
4508      * Gentoo Linux
4509        As a source-based distribution, installing MySQL on Gentoo
4510        involves downloading the source, patching the Gentoo
4511        specifics, and then compiling the MySQL server and installing
4512        it. This process is handled automatically by the emerge
4513        command. Depending on the version of MySQL that you want to
4514        install, you may need to unmask the specific version that you
4515        want for your chosen platform.
4516        The MySQL server and client tools are provided within a single
4517        package, dev-db/mysql. You can obtain a list of the versions
4518        available to install by looking at the portage directory for
4519        the package:
4520 root-shell> ls /usr/portage/dev-db/mysql/mysql-5.1*
4521 mysql-5.1.39-r1.ebuild
4522 mysql-5.1.44-r1.ebuild
4523 mysql-5.1.44-r2.ebuild
4524 mysql-5.1.44-r3.ebuild
4525 mysql-5.1.44.ebuild
4526 mysql-5.1.45-r1.ebuild
4527 mysql-5.1.45.ebuild
4528 mysql-5.1.46.ebuild
4529        To install a specific MySQL version, you must specify the
4530        entire atom. For example:
4531 root-shell> emerge =dev-db/mysql-5.1.46
4532        A simpler alternative is to use the virtual/mysql-5.1 package,
4533        which will install the latest version:
4534 root-shell> emerge =virtual/mysql-5.1
4535        If the package is masked (because it is not tested or
4536        certified for the current platform), use the ACCEPT_KEYWORDS
4537        environment variable. For example:
4538 root-shell> ACCEPT_KEYWORDS="~x86" emerge =virtual/mysql-5.1
4539        After installation, you should create a new database using
4540        mysql_install_db, and set the password for the root user on
4541        MySQL. You can use the configuration interface to set the
4542        password and create the initial database:
4543 root-shell> emerge --config =dev-db/mysql-5.1.46
4544        A sample configuration file will have been created for you in
4545        /etc/mysql/my.cnf, and an init script will have been created
4546        in /etc/init.d/mysql.
4547        To enable MySQL to start automatically at the normal (default)
4548        run levels, you can use:
4549 root-shell> rc-update add mysql default
4551 2.6. Installing MySQL on Solaris and OpenSolaris
4553    MySQL on Solaris and OpenSolaris is available in a number of
4554    different formats.
4556      * For information on installing using the native Solaris PKG
4557        format, see Section 2.6.1, "Installing MySQL on Solaris Using
4558        a Solaris PKG."
4560      * On OpenSolaris, the standard package repositories include
4561        MySQL packages specially built for OpenSolaris that include
4562        entries for the Service Management Framework (SMF) to enable
4563        control of the installation using the SMF administration
4564        commands. For more information, see Section 2.6.2, "Installing
4565        MySQL on OpenSolaris Using IPS."
4567      * To use a standard tar binary installation, use the notes
4568        provided in Section 2.2, "Installing MySQL on Unix/Linux Using
4569        Generic Binaries." Check the notes and hints at the end of
4570        this section for Solaris specific notes that you may need
4571        before or after installation.
4573      * For information on installing MySQL on Solaris or OpenSolaris
4574        using a source distribution, first check the Solaris advice,
4575        Section 2.11.8, "Notes on Installing MySQL on Solaris from
4576        Source." For detailed instructions on installing from source,
4577        see Section 2.11, "Installing MySQL from Source."
4579    To obtain a binary MySQL distribution for Solaris in tarball or
4580    PKG format, http://dev.mysql.com/downloads/mysql/5.1.html.
4582    Additional notes to be aware of when installing and using MySQL on
4583    Solaris:
4585      * If you want to use MySQL with the mysql user and group, use
4586        the groupadd and useradd commands:
4587 groupadd mysql
4588 useradd -g mysql mysql
4590      * If you install MySQL using a binary tarball distribution on
4591        Solaris, you may run into trouble even before you get the
4592        MySQL distribution unpacked, as the Solaris tar cannot handle
4593        long file names. This means that you may see errors when you
4594        try to unpack MySQL.
4595        If this occurs, you must use GNU tar (gtar) to unpack the
4596        distribution. In Solaris 10 and OpenSolaris gtar is normally
4597        located in /usr/sfw/bin/gtar, but may not be included in the
4598        default path definition.
4600      * When using Solaris 10 for x86_64, you should mount any file
4601        systems on which you intend to store InnoDB files with the
4602        forcedirectio option. (By default mounting is done without
4603        this option.) Failing to do so will cause a significant drop
4604        in performance when using the InnoDB storage engine on this
4605        platform.
4607      * If you would like MySQL to start automatically, you can copy
4608        support-files/mysql.server to /etc/init.d and create a
4609        symbolic link to it named /etc/rc3.d/S99mysql.server.
4611      * If too many processes try to connect very rapidly to mysqld,
4612        you should see this error in the MySQL log:
4613 Error in accept: Protocol error
4614        You might try starting the server with the --back_log=50
4615        option as a workaround for this.
4617      * To configure the generation of core files on Solaris you
4618        should use the coreadm command. Because of the security
4619        implications of generating a core on a setuid() application,
4620        by default, Solaris does not support core files on setuid()
4621        programs. However, you can modify this behavior using coreadm.
4622        If you enable setuid() core files for the current user, they
4623        will be generated using the mode 600 and owned by the
4624        superuser.
4626 2.6.1. Installing MySQL on Solaris Using a Solaris PKG
4628    You can install MySQL on Solaris and OpenSolaris using a binary
4629    package using the native Solaris PKG format instead of the binary
4630    tarball distribution.
4632    To use this package, download the corresponding
4633    mysql-VERSION-solaris10-PLATFORM.pkg.gz file, then uncompress it.
4634    For example:
4635 shell> gunzip mysql-5.1.74-solaris10-x86_64.pkg.gz
4637    To install a new package, use pkgadd and follow the onscreen
4638    prompts. You must have root privileges to perform this operation:
4639 shell> pkgadd -d mysql-5.1.74-solaris10-x86_64.pkg
4641 The following packages are available:
4642   1  mysql     MySQL Community Server (GPL)
4643                (i86pc) 5.1.74
4645 Select package(s) you wish to process (or 'all' to process
4646 all packages). (default: all) [?,??,q]:
4648    The PKG installer installs all of the files and tools needed, and
4649    then initializes your database if one does not exist. To complete
4650    the installation, you should set the root password for MySQL as
4651    provided in the instructions at the end of the installation.
4652    Alternatively, you can run the mysql_secure_installation script
4653    that comes with the installation.
4655    By default, the PKG package installs MySQL under the root path
4656    /opt/mysql. You can change only the installation root path when
4657    using pkgadd, which can be used to install MySQL in a different
4658    Solaris zone. If you need to install in a specific directory, use
4659    a binary tar file distribution.
4661    The pkg installer copies a suitable startup script for MySQL into
4662    /etc/init.d/mysql. To enable MySQL to startup and shutdown
4663    automatically, you should create a link between this file and the
4664    init script directories. For example, to ensure safe startup and
4665    shutdown of MySQL you could use the following commands to add the
4666    right links:
4667 shell> ln /etc/init.d/mysql /etc/rc3.d/S91mysql
4668 shell> ln /etc/init.d/mysql /etc/rc0.d/K02mysql
4670    To remove MySQL, the installed package name is mysql. You can use
4671    this in combination with the pkgrm command to remove the
4672    installation.
4674    To upgrade when using the Solaris package file format, you must
4675    remove the existing installation before installing the updated
4676    package. Removal of the package does not delete the existing
4677    database information, only the server, binaries and support files.
4678    The typical upgrade sequence is therefore:
4679 shell> mysqladmin shutdown
4680 shell> pkgrm mysql
4681 shell> pkgadd -d mysql-5.1.74-solaris10-x86_64.pkg
4682 shell> mysqld_safe &
4683 shell> mysql_upgrade
4685    You should check the notes in Section 2.13, "Upgrading or
4686    Downgrading MySQL" before performing any upgrade.
4688 2.6.2. Installing MySQL on OpenSolaris Using IPS
4690    OpenSolaris includes standard packages for MySQL in the core
4691    repository. The MySQL packages are based on a specific release of
4692    MySQL and updated periodically. For the latest release you must
4693    use either the native Solaris PKG, tar, or source installations.
4694    The native OpenSolaris packages include SMF files so that you can
4695    easily control your MySQL installation, including automatic
4696    startup and recovery, using the native service management tools.
4698    To install MySQL on OpenSolaris, use the pkg command. You will
4699    need to be logged in as root, or use the pfexec tool, as shown in
4700    the example below:
4701 shell> pfexec pkg install SUNWmysql51
4703    The package set installs three individual packages,
4704    SUNWmysql51lib, which contains the MySQL client libraries;
4705    SUNWmysql51r which contains the root components, including SMF and
4706    configuration files; and SUNWmysql51u which contains the scripts,
4707    binary tools and other files. You can install these packages
4708    individually if you only need the corresponding components.
4710    The MySQL files are installed into /usr/mysql which symbolic links
4711    for the sub directories (bin, lib, etc.) to a version specific
4712    directory. For MySQL 5.1, the full installation is located in
4713    /usr/mysql/5.1. The default data directory is /var/mysql/5.1/data.
4714    The configuration file is installed in /etc/mysql/5.1/my.cnf. This
4715    layout permits multiple versions of MySQL to be installed, without
4716    overwriting the data and binaries from other versions.
4718    Once installed, you must run mysql_install_db to initialize the
4719    database, and use the mysql_secure_installation to secure your
4720    installation.
4722 Using SMF to manage your MySQL installation
4724    Once installed, you can start and stop your MySQL server using the
4725    installed SMF configuration. The service name is mysql, or if you
4726    have multiple versions installed, you should use the full version
4727    name, for example mysql:version_51. To start and enable MySQL to
4728    be started at boot time:
4729 shell> svcadm enable mysql
4731    To disable MySQL from starting during boot time, and shut the
4732    MySQL server down if it is running, use:
4733 shell> svcadm disable mysql
4735    To restart MySQL, for example after a configuration file changes,
4736    use the restart option:
4737 shell> svcadm restart mysql
4739    You can also use SMF to configure the data directory and enable
4740    full 64-bit mode. For example, to set the data directory used by
4741    MySQL:
4742 shell> svccfg 
4743 svc:> select mysql:version_51 
4744 svc:/application/database/mysql:version_51> setprop mysql/data=/data0
4745 /mysql
4748    By default, the 32-bit binaries are used. To enable the 64-bit
4749    server on 64-bit platforms, set the enable_64bit parameter. For
4750    example:
4751 svc:/application/database/mysql:version_51> setprop mysql/enable_64bi
4754    You need to refresh the SMF after settings these options:
4755 shell> svcadm refresh mysql
4757 2.7. Installing MySQL on IBM AIX
4759    MySQL for IBM AIX is available in a number of different forms:
4761      * Using a binary tarball distribution provided at
4762        http://dev.mysql.com/downloads/. Please read the general notes
4763        on AIX installation before continuing. For more information on
4764        binary installations, see Section 2.2, "Installing MySQL on
4765        Unix/Linux Using Generic Binaries."
4767      * Using a source tarball and compiling MySQL. Please read the
4768        general notes on AIX installation before continuing. You
4769        should also check the instructions on building on AIX from
4770        source. For general information on building from source, see
4771        Section 2.11, "Installing MySQL from Source."
4773 2.7.1. General Notes on Installing MySQL on AIX
4775    General notes on using MySQL on IBM AIX:
4777      * If you have problems with threads on AIX 5.3, you should
4778        upgrade AIX 5.3 to technology level 7 (5300-07).
4780 2.8. Installing MySQL on HP-UX
4782    MySQL for HP-UX is available in a number of different forms:
4784      * Using a DEPOT distribution provided at
4785        http://dev.mysql.com/downloads/. Please read the general notes
4786        on HP-UX installation before continuing. For more information
4787        on DEPOT installations, see Section 2.8.2, "Installing MySQL
4788        on HP-UX Using DEPOT Packages."
4790      * Using a binary tarball distribution provided at
4791        http://dev.mysql.com/downloads/. Please read the general notes
4792        on HP-UX installation before continuing. For more information
4793        on binary installations, see Section 2.2, "Installing MySQL on
4794        Unix/Linux Using Generic Binaries."
4796      * Using a source tarball and compiling MySQL. Please read the
4797        general notes on HP-UX installation before continuing. You
4798        should also check the instructions on building on HP-UX from
4799        source. For general information on building from source, see
4800        Section 2.11, "Installing MySQL from Source."
4802 2.8.1. General Notes on Installing MySQL on HP-UX
4804    Some additional notes on installing and using MySQL on HP-UX:
4806      * If you install MySQL using a binary tarball distribution on
4807        HP-UX, you may run into trouble even before you get the MySQL
4808        distribution unpacked, as the HP-UX tar cannot handle long
4809        file names. This means that you may see errors when you try to
4810        unpack MySQL.
4811        If this occurs, you must use GNU tar (gtar) to unpack the
4812        distribution.
4814      * Because of some critical bugs in the standard HP-UX libraries,
4815        you should install the following patches before trying to run
4816        MySQL on HP-UX 11.0:
4817 PHKL_22840 Streams cumulative
4818 PHNE_22397 ARPA cumulative
4819        This solves the problem of getting EWOULDBLOCK from recv() and
4820        EBADF from accept() in threaded applications.
4822 2.8.2. Installing MySQL on HP-UX Using DEPOT Packages
4824    The HP-UX DEPOT format packages can be installed using the
4825    swinstall command. You should install the ncurses and zlib
4826    libraries before installing the MySQL DEPOT package. You can use
4827    the free software depothelper tool to install these packages and
4828    any dependencies for you automatically.
4830    To install using the MySQL DEPOT packages, follow this guide:
4832     1. Download the MySQL DEPOT package from
4833        http://dev.mysql.com/downloads/. You must uncompress the
4834        package before installation:
4835 root-shell> gunzip mysql-5.1.48-hpux11.31-ia64-64bit.depot.gz
4837     2. Install the DEPOT package using swinstall:
4838 root-shell> swinstall -s mysql-5.1.49-hpux11.31-ia64-64bit.depot
4839        MySQL will be installed into a directory matching the depot
4840        package name, within /usr/local. For convenience, you may want
4841        to create a symbolic link to the installed directory, for
4842        example:
4843 root-shell> ln -s mysql-5.1.49-hpux11.31-ia64-64bit mysql
4845     3. Your package is now installed. You should complete the
4846        configuration of MySQL by creating a user and group:
4847 root-shell> /usr/sbin/groupadd mysql
4848 root-shell> /usr/sbin/useradd -g mysql -d /var/lib/mysql/ -s /bin/fal
4849 se mysql
4851     4. Create the standard database using the new user/group you have
4852        created, and set the permissions:
4853 root-shell> cd /usr/local/
4854 root-shell> scripts/mysql_install_db --user=mysql
4855 root-shell> chown -R root .
4856 root-shell> chown -R mysql data
4858     5. Finally, secure your new installation by setting the root
4859        passwords, and then start your MySQL server using the mysql
4860        user:
4861 root-shell> mysql_secure_installation
4862 root-shell> mysqld_safe --user=mysql &
4864 2.9. Installing MySQL on FreeBSD
4866    This section provides information about installing MySQL on
4867    variants of FreeBSD Unix.
4869    You can install MySQL on FreeBSD by using the binary distribution
4870    provided by Oracle. For more information, see Section 2.2,
4871    "Installing MySQL on Unix/Linux Using Generic Binaries."
4873    The easiest (and preferred) way to install MySQL is to use the
4874    mysql-server and mysql-client ports available at
4875    http://www.freebsd.org/. Using these ports gives you the following
4876    benefits:
4878      * A working MySQL with all optimizations enabled that are known
4879        to work on your version of FreeBSD.
4881      * Automatic configuration and build.
4883      * Startup scripts installed in /usr/local/etc/rc.d.
4885      * The ability to use pkg_info -L to see which files are
4886        installed.
4888      * The ability to use pkg_delete to remove MySQL if you no longer
4889        want it on your machine.
4891    The MySQL build process requires GNU make (gmake) to work. If GNU
4892    make is not available, you must install it first before compiling
4893    MySQL.
4895    To install using the ports system:
4896 # cd /usr/ports/databases/mysql51-server
4897 # make
4899 # cd /usr/ports/databases/mysql51-client
4900 # make
4903    The standard port installation places the server into
4904    /usr/local/libexec/mysqld, with the startup script for the MySQL
4905    server placed in /usr/local/etc/rc.d/mysql-server.
4907    Some additional notes on the BSD implementation:
4909      * To remove MySQL after installation using the ports system:
4910 # cd /usr/ports/databases/mysql51-server
4911 # make deinstall
4913 # cd /usr/ports/databases/mysql51-client
4914 # make deinstall
4917      * If you get problems with the current date in MySQL, setting
4918        the TZ variable should help. See Section 2.14, "Environment
4919        Variables."
4921 2.10. Installing MySQL on i5/OS
4923    The i5/OS POWER MySQL package was created in cooperation with IBM.
4924    MySQL works within the Portable Application Solution Environment
4925    (PASE) on the System i series of hardware and will also provide
4926    database services for the Zend Core for i5/OS.
4928    MySQL for i5/OS is provided both as a tar file and as a save file
4929    (.savf) package that can be downloaded and installed directly
4930    without any additional installation steps required. To install
4931    MySQL using the tar file, see Section 2.2, "Installing MySQL on
4932    Unix/Linux Using Generic Binaries."
4934    MySQL is only supported on i5/OS V5R4 or later releases. The i5/OS
4935    PASE must be installed for MySQL to operate. You must be able to
4936    login as a user in *SECOFR class.
4938    You should the installation notes and tips for i5/OS before
4939    starting installation. See i5/OS Installation Notes.
4941    Before Installation:
4942    Note
4944    The installation package will use an existing configuration if you
4945    have previously installed MySQL (which is identified by looking
4946    for the file /etc/my.cnf). The values for the data directory
4947    (DATADIR) and owner of the MySQL files (USRPRF) specified during
4948    the installation will be ignored, and the values determined from
4949    the /etc/my.cnf will be used instead.
4951    If you want to change these parameters during a new install, you
4952    should temporarily rename /etc/my.cnf, install MySQL using the new
4953    parameters you want to use, and then merge your previous
4954    /etc/my.cnf configuration settings with the new /etc/my.cnf file
4955    that is created during installation.
4957      * You must have a user profile with PASE with suitable
4958        privileges. The user should be within the *SECOFR class, such
4959        as the QSECOFR user ID. You can use the WRKUSRPRF command to
4960        check your user profile.
4962      * For network connections to MySQL, you must have TCP/IP
4963        enabled. You should also check the following:
4965           + Ensure that a name has defined for the system. Run the
4966             Configure TCP/IP (CFGTCP) command and select option 12
4967             (Change TCP/IP domain information) to display this
4968             setting. Make sure that a value is listed in the Host
4969             name field.
4971           + Make sure that the system has a loopback entry which
4972             represents the localhost or 127.0.0.1.
4974           + Ensure that the IP address of the IBM i machine is mapped
4975             correctly to the host name.
4977    To install MySQL on i5/OS, follow these steps:
4979     1. On the System i machine, create a save file that will be used
4980        to receive the downloaded installation save file. The file
4981        should be located within the General Purpose Library (QGPL):
4982 CRTSAVF FILE(QGPL/MYSQLINST) TESXT('MySQL Save file')
4984     2. Download the MySQL installation save file in 32-bit
4985        (mysql-5.1.74-i5os-power-32bit.savf) or 64-bit
4986        (mysql-5.1.74-i5os-power-64bit.savf) from MySQL Downloads
4987        (http://dev.mysql.com/downloads/).
4989     3. You need to FTP the downloaded .savf file directly into the
4990        QGPL/MYSQLINST file on the System i server. You can do this
4991        through FTP using the following steps after logging in to the
4992        System i machine:
4993 ftp> bin
4994 ftp> cd qgpl
4995 ftp> put mysql-5.1.74-i5os-power.savf mysqlinst
4997     4. Log into the System i server using a user in the *SECOFR
4998        class, such as the QSECOFR user ID.
5000     5. You need to restore the installation library stored in the
5001        .savf save file:
5002 RSTLIB MYSQLINST DEV(*SAVF) SAVF(QGPL/MYSQLINST) MBROPT(*ALL) ALWOBJD
5003 IF(*ALL)
5004        Note
5005        You can ignore the security changes-type message at the bottom
5006        of the installation panel.
5008     6. Once you have finished restoring the MYSQLINST library, check
5009        that all the necessary objects for installation are on the
5010        system by using the Display Library (DSPLIB) command:
5011 DSPLIB LIB(MYSQLINST)
5013     7. You need to execute the installation command,
5014        MYSQLINST/INSMYSQL. You can specify three parameter settings
5015        during installation:
5017           + DIR('/QOpenSys/usr/local/mysql') sets the installation
5018             location for the MySQL files. The directory will be
5019             created if it does not already exist.
5021           + DATADIR('/QOpenSys/usr/local/mysql/data') sets the
5022             location of the directory that will be used to store the
5023             database files and binary logs. The default setting is
5024             /QOpenSys/usr/local/mysql/data. Note that if the
5025             installer detects an existing installation (due to the
5026             existence of /etc/my.cnf), then the existing setting will
5027             be used instead of the default.
5029           + USRPRF(MYSQL) sets the user profile that will own the
5030             files that are installed. The profile will be created if
5031             it does not already exist.
5032             Note
5033             You should choose an appropriate user for using the MySQL
5034             server installation. The user will be used whenever you
5035             need to do any administration on the MySQL server.
5036        Once you have set the appropriate parameters, you can begin
5037        the installation.
5038        The installation copies all the necessary files into a
5039        directory matching the DIR configuration value; sets the
5040        ownership on those files, sets up the MySQL environment and
5041        creates the MySQL configuration file (in /etc/my.cnf)
5042        completing all the steps in a typical binary installation
5043        process automatically. If this is a new installation of MySQL,
5044        or if the installer detects that this is a new version
5045        (because the /etc/my.cnf file does not exist), then the
5046        initial core MySQL databases will also be created during
5047        installation.
5048        Once the installation has been completed, you will get a
5049        notice advising you to set the password for the root user. For
5050        more information, Section 2.12, "Postinstallation Setup and
5051        Testing."
5053     8. Once the installation has completed, you can delete the
5054        installation file:
5055 DLTLIB LIB(MYSQLINST)
5057    Upgrading an existing MySQL instance
5059    You need to execute the upgrade command, MYSQLINST/UPGMYSQL.
5060    Note
5062    You cannot use MYSQLINST/UPGMYSQL to upgrade between major
5063    versions of MySQL (for example from 5.0 to 5.1). For information
5064    and advice on migrating between major versions you can use the
5065    advice provided in Section 2.13.1.1, "Upgrading from MySQL 5.0 to
5066    5.1."
5068    You must specify 6 parameters to perform an upgrade:
5070      * DIR('/QOpenSys/usr/local/'): Sets the installation location
5071        for the MySQL files. The directory will be created if it does
5072        not already exist. This is the directory that the MySQL server
5073        will be installed into, inside a directory with a name
5074        matching the version and release. For example, if installing
5075        MySQL 5.1.74 with the DIR set to /QOpenSys/usr/local/ would
5076        result in /QOpenSys/usr/local/mysql-5.1.74-i5os-power64 and a
5077        symbolic link to this directory will be created in
5078        /QOpenSys/usr/local/mysql.
5080      * DATADIR('/QOpenSys/mysql/data'): Sets the location of the
5081        directory that will be upgraded.
5083      * USRPRF('MYSQL'): Sets the user profile that will own the files
5084        that are installed. The profile will be created if it does not
5085        already exist; if it is created as part of the upgrade
5086        process, it will be disabled initially. You may wish to enable
5087        this user profile so that it can be used to start the MySQL
5088        server later. It is best practice to use the one previously
5089        created during the first installation.
5091      * MYSQLUSR('root user'): Any user account in the current MySQL
5092        server with SUPER privileges.
5094      * PASSWORD('root user password'): The password for the above
5095        account. This is necessary as the upgrade starts the MySQL
5096        server to upgrade the tables and the password is need to be
5097        able to shutdown the MySQL server.
5099      * CURINST('path to previous install'): The full path to the
5100        installation that is being upgraded. For example an
5101        installation in /QOpenSys/usr/local/ will be
5102        /QOpenSys/usr/local/mysql-5.1.74-i5os-power64. Failure to
5103        specify this option may result in corruption of your existing
5104        data files.
5106    For example:
5107 MYSQLINST/UPGMYSQL DIR('/QOpenSys/usr/local/') DATADIR('/QOpenSys/mys
5108 ql/data') Â»
5109      USERPRF(MYSQL) MYSQLUSR('root') PASSWORD('root') CURINST('/QOpen
5110 Sys/usr/local/mysql-5.1.74-i5os-power64')
5112    You should receive a Program Message indicating UPGRADE
5113    SUCCESSFUL! upon completion or an error message if there is a
5114    problem.You can view the upgrade programs progression and the
5115    error in the text file upgrade.log in the installation directory.
5117    To start MySQL:
5119     1. Log into the System i server using the user profile create or
5120        specified during installation. By default, this is MYSQL.
5121        Note
5122        You should start mysqld_safe using a user that in the PASE
5123        environment has the id=0 (the equivalent of the standard Unix
5124        root user). If you do not use a user with this ID then the
5125        system will be unable to change the user when executing mysqld
5126        as set using --user option. If this happens, mysqld may be
5127        unable to read the files located within the MySQL data
5128        directory and the execution will fail.
5130     2. Enter the PASE environment using call qp2term.
5132     3. Start the MySQL server by changing to the installation
5133        directory and running mysqld_safe, specifying the user name
5134        used to install the server. The installer conveniently
5135        installs a symbolic link to the installation directory
5136        (mysql-5.0.42-i5os-power-32bit) as /opt/mysql/mysql:
5137 > cd /opt/mysql/mysql
5138 > bin/mysqld_safe --user=mysql &
5139        You should see a message similar to the following:
5140 Starting mysqld daemon with databases Â»
5141      from /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data
5143    If you are having problems starting MySQL server, see Section
5144    2.12.1.3, "Starting and Troubleshooting the MySQL Server."
5146    To stop MySQL:
5148     1. Log into the System i server using the user profile create or
5149        specified during installation. By default, this is MYSQL.
5151     2. Enter the PASE environment using call qp2term.
5153     3. Stop the MySQL server by changing into the installation
5154        directory and running mysqladmin, specifying the user name
5155        used to install the server:
5156 > cd /opt/mysql/mysql
5157 > bin/mysqladmin -u root shutdown
5158        If the session that you started and stopped MySQL are the
5159        same, you may get the log output from mysqld:
5160    STOPPING server from pid file Â»
5161      /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data/I5DBX.R
5162 CHLAND.IBM.COM.pid
5163    070718 10:34:20  mysqld ended
5164        If the sessions used to start and stop MySQL are different,
5165        you will not receive any confirmation of the shutdown.
5167    Note and tips
5169      * A problem has been identified with the installation process on
5170        DBCS systems. If you are having problems install MySQL on a
5171        DBCS system, you need to change your job's coded character set
5172        identifier (CSSID) to 37 (EBCDIC) before executing the install
5173        command, INSMYSQL. To do this, determine your existing CSSID
5174        (using DSPJOB and selecting option 2), execute CHGJOB
5175        CSSID(37), run INSMYSQL to install MySQL and then execute
5176        CHGJOB again with your original CSSID.
5178      * If you want to use the Perl scripts that are included with
5179        MySQL, you need to download the iSeries Tools for Developers
5180        (5799-PTL). See
5181        http://www-03.ibm.com/servers/enable/site/porting/tools/.
5183 2.11. Installing MySQL from Source
5185    Building MySQL from the source code enables you to customize build
5186    parameters, compiler optimizations, and installation location. For
5187    a list of systems on which MySQL is known to run, see Section
5188    2.1.1, "Operating Systems Supported by MySQL Community Server."
5190    Before you proceed with an installation from source, check whether
5191    we produce a precompiled binary distribution for your platform and
5192    whether it works for you. We put a great deal of effort into
5193    ensuring that our binaries are built with the best possible
5194    options for optimal performance. Instructions for installing
5195    binary distributions are available in Section 2.2, "Installing
5196    MySQL on Unix/Linux Using Generic Binaries."
5198    To obtain a source distribution for MySQL, see Section 2.1.3, "How
5199    to Get MySQL." MySQL source distributions are available as
5200    compressed tar files, Zip archives, or RPM packages. Distribution
5201    files have names of the form mysql-VERSION.tar.gz,
5202    mysql-VERSION.zip, or mysql-VERSION.rpm, where VERSION is a number
5203    like 5.1.74.
5205    To perform a MySQL installation using the source code:
5207      * To build MySQL from source on Unix-like systems, including
5208        Linux, commercial Unix, BSD, Mac OS X and others using a
5209        .tar.gz or RPM-based source code distribution, see Section
5210        2.11.2, "Installing MySQL Using a Standard Source
5211        Distribution."
5213      * To build MySQL from source on Windows (Windows XP or newer
5214        required), see Section 2.11.7, "Installing MySQL from Source
5215        on Windows."
5217      * For information on building from one of our development trees,
5218        see Section 2.11.3, "Installing MySQL Using a Development
5219        Source Tree."
5221      * For information on using the configure command to specify the
5222        source build parameters, including links to platform specific
5223        parameters that you might need, see Section 2.11.4, "MySQL
5224        Source-Configuration Options."
5226    To install MySQL from source, your system must have the following
5227    tools:
5229      * GNU gunzip to uncompress the distribution and a reasonable tar
5230        to unpack it (if you use a .tar.gz distribution), or WinZip or
5231        another tool that can read .zip files (if you use a .zip
5232        distribution).
5233        GNU tar is known to work. The standard tar provided with some
5234        operating systems is not able to unpack the long file names in
5235        the MySQL distribution. You should download and install GNU
5236        tar, or if available, use a preinstalled version of GNU tar.
5237        Usually this is available as gnutar, gtar, or as tar within a
5238        GNU or Free Software directory, such as /usr/sfw/bin or
5239        /usr/local/bin. GNU tar is available from
5240        http://www.gnu.org/software/tar/.
5242      * A working ANSI C++ compiler. GCC 3.4.6 or later, Sun Studio 10
5243        or later, Visual Studio 2005 or later, and many current
5244        vendor-supplied compilers are known to work.
5246      * A good make program. Although some platforms come with their
5247        own make implementations, it is highly recommended that you
5248        use GNU make 3.75 or newer. It may already be available on
5249        your system as gmake. GNU make is available from
5250        http://www.gnu.org/software/make/.
5252      * libtool 1.5, available from
5253        http://www.gnu.org/software/libtool/. 1.5.24 or later is
5254        recommended.
5256    If you run into problems and need to file a bug report, please use
5257    the instructions in Section 1.7, "How to Report Bugs or Problems."
5259 2.11.1. MySQL Layout for Source Installation
5261    By default, when you install MySQL after compiling it from a
5262    source distribution, the installation step installs files under
5263    /usr/local. Components are installed in the directories shown in
5264    the following table. To configure particular installation
5265    locations, use the options described at Section 2.11.4, "MySQL
5266    Source-Configuration Options."
5268    Table 2.19. MySQL Layout for Installation from Source
5269    Directory Contents of Directory
5270    bin Client programs and scripts
5271    include/mysql Include (header) files
5272    Docs Manual in Info format
5273    man Unix manual pages
5274    lib/mysql Libraries
5275    libexec The mysqld server
5276    share/mysql Miscellaneous support files, including error messages,
5277    sample configuration files, SQL for database installation
5278    sql-bench Benchmarks
5279    var Log files, databases
5281    Within its installation directory, the layout of a source
5282    installation differs from that of a binary installation in the
5283    following ways:
5285      * The mysqld server is installed in the libexec directory rather
5286        than in the bin directory.
5288      * The data directory is var rather than data.
5290      * mysql_install_db is installed in the bin directory rather than
5291        in the scripts directory.
5293      * The header file and library directories are include/mysql and
5294        lib/mysql rather than include and lib.
5296 2.11.2. Installing MySQL Using a Standard Source Distribution
5298    To install MySQL from source, first configure, build, and install
5299    from a source package. Then follow the same postinstallation setup
5300    sequence as for a binary installation.
5302    If you start from a source RPM, use the following command to make
5303    a binary RPM that you can install. If you do not have rpmbuild,
5304    use rpm instead.
5305 shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm
5307    The result is one or more binary RPM packages that you install as
5308    indicated in Section 2.5.1, "Installing MySQL on Linux Using RPM
5309    Packages."
5311    The sequence for installation from a compressed tar file source
5312    distribution is similar to the process for installing from a
5313    generic binary distribution that is detailed in Section 2.2,
5314    "Installing MySQL on Unix/Linux Using Generic Binaries." For a
5315    MySQL .tar.gz source distribution, the basic installation command
5316    sequence looks like this:
5317 # Preconfiguration setup
5318 shell> groupadd mysql
5319 shell> useradd -g mysql mysql
5320 # Beginning of source-build specific instructions
5321 shell> tar zxvf mysql-VERSION.tar.gz
5322 shell> cd mysql-VERSION
5323 shell> ./configure --prefix=/usr/local/mysql
5324 shell> make
5325 shell> make install
5326 # End of source-build specific instructions
5327 # Postinstallation setup
5328 shell> cd /usr/local/mysql
5329 shell> chown -R mysql .
5330 shell> chgrp -R mysql .
5331 shell> bin/mysql_install_db --user=mysql
5332 shell> chown -R root .
5333 shell> chown -R mysql var
5334 # Next command is optional
5335 shell> cp support-files/my-medium.cnf /etc/my.cnf
5336 shell> bin/mysqld_safe --user=mysql &
5337 # Next command is optional
5338 shell> cp support-files/mysql.server /etc/init.d/mysql.server
5340    A more detailed version of the source-build specific instructions
5341    is shown following. Perform the following steps as the mysql user,
5342    except as noted.
5343    Note
5345    The procedure shown here does not set up any passwords for MySQL
5346    accounts. After following the procedure, proceed to Section 2.12,
5347    "Postinstallation Setup and Testing," for postinstallation setup
5348    and testing.
5350     1. Set up the mysql user and group that will be used to run and
5351        execute the MySQL server and own the database directory. For
5352        details, see Creating a mysql System User and Group, in
5353        Section 2.2, "Installing MySQL on Unix/Linux Using Generic
5354        Binaries."
5356     2. Pick the directory under which you want to unpack the
5357        distribution and change location into it.
5359     3. Obtain a distribution file using the instructions in Section
5360        2.1.3, "How to Get MySQL."
5362     4. Unpack the distribution into the current directory. tar can
5363        uncompress and unpack the distribution if it has z option
5364        support:
5365 shell> tar zxvf /path/to/mysql-VERSION.tar.gz
5366        This command creates a directory named mysql-VERSION.
5367        If your tar does not have z option support, use gunzip to
5368        unpack the distribution and tar to unpack it:
5369 shell> gunzip < /path/to/mysql-VERSION.tar.gz | tar xvf -
5371     5. Change location into the top-level directory of the unpacked
5372        distribution:
5373 shell> cd mysql-VERSION
5375     6. Configure the source directory:
5376 shell> ./configure --prefix=/usr/local/mysql
5377        When you run configure, you might want to specify other
5378        options. For example, if you need to debug mysqld or a MySQL
5379        client, run configure with the --with-debug option, and then
5380        recompile and link your clients with the new client library.
5381        See Section 22.4, "Debugging and Porting MySQL."
5382        Run ./configure --help for a list of options. Section 2.11.4,
5383        "MySQL Source-Configuration Options," discusses some of the
5384        more useful options.
5385        If configure fails and you are going to send mail to a MySQL
5386        mailing list to ask for assistance, please include any lines
5387        from config.log that you think can help solve the problem.
5388        Also include the last couple of lines of output from
5389        configure. To file a bug report, please use the instructions
5390        in Section 1.7, "How to Report Bugs or Problems."
5392     7. Compile the source distribution:
5393 shell> make
5394        Use gmake instead on systems where you are using GNU make and
5395        it has been installed as gmake.
5396        If the compile fails, see Section 2.11.5, "Dealing with
5397        Problems Compiling MySQL," for help.
5399     8. Install the distribution:
5400 shell> make install
5401        You might need to run this command as root.
5403    The remainder of the installation process, including setting up
5404    the configuration file, creating the core databases, and starting
5405    the MySQL server, are identical to the remainder of the process as
5406    shown in Generic Binary Install.
5408    After everything has been installed, test the distribution. To
5409    start the MySQL server, use the following command:
5410 shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &
5412    If you run the command as root, you should use the --user option
5413    as shown. The option value is the name of the login account that
5414    you created in the first step to use for running the server. If
5415    you run the mysqld_safe command while logged in as that user, you
5416    can omit the --user option.
5418    If the command fails immediately and prints mysqld ended, look for
5419    information in the error log (which by default is the
5420    host_name.err file in the data directory).
5422    For more information about mysqld_safe, see Section 4.3.2,
5423    "mysqld_safe --- MySQL Server Startup Script."
5425    To make it more convenient to invoke programs installed in
5426    /usr/local/mysql/bin, you can add that directory to your PATH
5427    environment variable setting. That enables you to run a program by
5428    typing only its name, not its entire path name. See Section 4.2.4,
5429    "Setting Environment Variables."
5430    Note
5432    The accounts that are listed in the MySQL grant tables initially
5433    have no passwords. After starting the server, you should set up
5434    passwords for them using the instructions in Section 2.12,
5435    "Postinstallation Setup and Testing."
5437 2.11.3. Installing MySQL Using a Development Source Tree
5439    This section discusses how to install MySQL from the latest
5440    development source code. Development trees have not necessarily
5441    received the same level of testing as standard release
5442    distributions, so this installation method is usually required
5443    only if you need the most recent code changes. Do not use a
5444    development tree for production systems. If your goal is simply to
5445    get MySQL up and running on your system, you should use a standard
5446    release distribution (either a binary or source distribution). See
5447    Section 2.1.3, "How to Get MySQL."
5449    To obtain the source tree, you must have Bazaar installed. The
5450    Bazaar VCS Web site (http://bazaar-vcs.org) has instructions for
5451    downloading and installing Bazaar on different platforms. Bazaar
5452    is supported on any platform that supports Python, and is
5453    therefore compatible with any Linux, Unix, Windows, or Mac OS X
5454    host.
5456    MySQL development projects are hosted on Launchpad
5457    (http://launchpad.net/). MySQL projects, including MySQL Server,
5458    MySQL Workbench, and others are available from the Oracle/MySQL
5459    Engineering (http://launchpad.net/~mysql) page. For the
5460    repositories related only to MySQL Server, see the MySQL Server
5461    (http://launchpad.net/mysql-server) page.
5463    To build under Unix/Linux, you must have the following tools
5464    installed:
5466      * A good make program. Although some platforms come with their
5467        own make implementations, it is highly recommended that you
5468        use GNU make 3.75 or newer. It may already be available on
5469        your system as gmake. GNU make is available from
5470        http://www.gnu.org/software/make/.
5472      * autoconf 2.58 (or newer), available from
5473        http://www.gnu.org/software/autoconf/.
5475      * automake 1.8.1, available from
5476        http://www.gnu.org/software/automake/.
5478      * libtool 1.5, available from
5479        http://www.gnu.org/software/libtool/. 1.5.24 or later is
5480        recommended.
5482      * m4, available from http://www.gnu.org/software/m4/.
5484      * bison, available from http://www.gnu.org/software/bison/. You
5485        should use the latest version of bison where possible.
5486        Versions 1.75 and 2.1 are known to work. There have been
5487        reported problems with bison 1.875. If you experience
5488        problems, upgrade to a later, rather than earlier, version.
5490    To build under Windows you must have Microsoft Visual C++ 2005
5491    Express Edition, Visual Studio .Net 2003 (7.1), or Visual Studio
5492    2005 (8.0) compiler system.
5494    Once the necessary tools are installed, create a local branch of
5495    the MySQL development tree on your machine using this procedure:
5497     1. To obtain a copy of the MySQL source code, you must create a
5498        new Bazaar branch. If you do not already have a Bazaar
5499        repository directory set up, you must initialize a new
5500        directory:
5501 shell> mkdir mysql-server
5502 shell> bzr init-repo --trees mysql-server
5503        This is a one-time operation.
5505     2. Assuming that you have an initialized repository directory,
5506        you can branch from the public MySQL server repositories to
5507        create a local source tree. To create a branch of a specific
5508        version:
5509 shell> cd mysql-server
5510 shell> bzr branch lp:mysql-server/5.1 mysql-5.1
5511        This is a one-time operation per source tree. You can branch
5512        the source trees for several versions of MySQL under the
5513        mysql-server directory.
5515     3. The initial download will take some time to complete,
5516        depending on the speed of your connection. Please be patient.
5517        Once you have downloaded the first tree, additional trees
5518        should take significantly less time to download.
5520     4. When building from the Bazaar branch, you may want to create a
5521        copy of your active branch so that you can make configuration
5522        and other changes without affecting the original branch
5523        contents. You can achieve this by branching from the original
5524        branch:
5525 shell> bzr branch mysql-5.1 mysql-5.1-build
5527     5. To obtain changes made after you have set up the branch
5528        initially, update it using the pull option periodically. Use
5529        this command in the top-level directory of the local copy:
5530 shell> bzr pull
5531        To examine the changeset comments for the tree, use the log
5532        option to bzr:
5533 shell> bzr log
5534        You can also browse changesets, comments, and source code
5535        online at the Launchpad MySQL Server
5536        (http://launchpad.net/mysql-server) page.
5537        If you see diffs (changes) or code that you have a question
5538        about, do not hesitate to send email to the MySQL internals
5539        mailing list. See Section 1.6.1, "MySQL Mailing Lists." If you
5540        think you have a better idea on how to do something, send an
5541        email message to the list with a patch.
5543    After you have the local branch, you can build MySQL server from
5544    the source code. On Windows, the build process is different from
5545    Unix/Linux: see Section 2.11.7, "Installing MySQL from Source on
5546    Windows."
5548    On Unix/Linux, use the autoconf system to create the configure
5549    script so that you can configure the build environment before
5550    building. The following example shows the typical commands
5551    required to build MySQL from a source tree.
5553     1. Change location to the top-level directory of the source tree;
5554        replace mysql-5.1 with the appropriate directory name.
5555 shell> cd mysql-5.1
5557     2. Prepare the source tree for configuration.
5558        Prior to MySQL 5.1.12, you must separately configure the
5559        InnoDB storage engine. Run the following command from the main
5560        source directory:
5561 shell> (cd storage/innobase; autoreconf --force --install)
5562        You can omit the previous command for MySQL 5.1.12 and later,
5563        or if you do not require InnoDB support.
5564        Prepare the remainder of the source tree:
5565 shell> autoreconf --force --install
5566        As an alternative to the preceding autoreconf command, you can
5567        use BUILD/autorun.sh, which acts as a shortcut for the
5568        following sequence of commands:
5569 shell> aclocal; autoheader
5570 shell> libtoolize --automake --force
5571 shell> automake --force --add-missing; autoconf
5572        If you get some strange errors during this stage, verify that
5573        you have the correct version of libtool installed.
5575     3. Configure the source tree and compile MySQL:
5576 shell> ./configure  # Add your favorite options here
5577 shell> make
5578        For a description of some configure options, see Section
5579        2.11.4, "MySQL Source-Configuration Options."
5580        A collection of configuration scripts is located in the BUILD/
5581        subdirectory. For example, you may find it more convenient to
5582        use the BUILD/compile-pentium-debug script than the preceding
5583        set of shell commands. To compile on a different architecture,
5584        modify the script by removing flags that are Pentium-specific,
5585        or use another script that may be more appropriate. These
5586        scripts are provided on an "as-is" basis. They are not
5587        supported and their contents may change from release to
5588        release.
5590     4. When the build is done, run make install. Be careful with this
5591        on a production machine; the installation command may
5592        overwrite your live release installation. If you already have
5593        MySQL installed and do not want to overwrite it, run
5594        ./configure with values for the --prefix, --with-tcp-port, and
5595        --with-unix-socket-path options different from those used by
5596        your production server. For additional information about
5597        preventing multiple servers from interfering with each other,
5598        see Section 5.3, "Running Multiple MySQL Instances on One
5599        Machine."
5601     5. Play hard with your new installation. For example, try to make
5602        new features crash. Start by running make test. See Section
5603        22.1.2, "The MySQL Test Suite."
5605     6. If you have gotten to the make stage, but the distribution
5606        does not compile, please enter the problem into our bugs
5607        database using the instructions given in Section 1.7, "How to
5608        Report Bugs or Problems." If you have installed the latest
5609        versions of the required tools, and they crash trying to
5610        process our configuration files, please report that also.
5611        However, if you get a command not found error or a similar
5612        problem for required tools, do not report it. Instead, make
5613        sure that all the required tools are installed and that your
5614        PATH variable is set correctly so that your shell can find
5615        them.
5617 2.11.4. MySQL Source-Configuration Options
5619    The configure script provides a great deal of control over how you
5620    configure a MySQL source distribution. Typically, you do this
5621    using options on the configure command line. For a full list of
5622    options supported by configure, run this command:
5623 shell> ./configure --help
5625    You can also affect configure using certain environment variables.
5626    See Section 2.14, "Environment Variables."
5628    The following table shows the available configure options.
5630    Table 2.20. MySQL Source-Configuration Option Reference
5631    (configure)
5632    Formats Description Default Introduced Removed
5633    --bindir=DIR User executables EPREFIX/bin
5634    --build=BUILD Configure for building on BUILD guessed
5635    --cache-file=FILE Cache test results in FILE disabled
5636    -C Alias for `--cache-file=config.cache'
5637    --config-cache
5638    --datadir=DIR Read-only architecture-independent data PREFIX/share
5640    --disable-FEATURE Do not include FEATURE
5641    --disable-community-features Disable additional features provided
5642    by the community 5.1.28
5643    --disable-dependency-tracking Disable dependency tracking
5644    --disable-grant-options Disable GRANT options
5645    --disable-largefile Omit support for large files
5646    --disable-libtool-lock Disable libtool lock
5647    --disable-thread-safe-client Compile the client without threads
5648    5.1.7
5649    --enable-FEATURE Enable FEATURE
5650    --enable-assembler Use assembler versions of some string functions
5651    if available
5652    --enable-debug-sync Compile in Debug Sync facility 5.1.41
5653    --enable-dependency-tracking Do not reject slow dependency
5654    extractors
5655    --enable-fast-install Optimize for fast installation yes
5656    --enable-local-infile Enable LOCAL for LOAD DATA INFILE disabled
5658    --enable-profiling Build a version with query profiling code
5659    5.1.24
5660    --enable-shared Build shared libraries yes
5661    --enable-static Build static libraries yes
5662    --enable-thread-safe-client Compile the client with threads
5663    5.1.6
5664    --exec-prefix=EPREFIX Install architecture-dependent files in
5665    EPREFIX
5666    -h Display this help and exit
5667    --help
5668    --help=short Display options specific to this package
5669    --help=recursive Display the short help of all the included
5670    packages
5671    --host=HOST Cross-compile to build programs to run on HOST
5672    --includedir=DIR C header files PREFIX/include
5673    --infodir=DIR Info documentation PREFIX/info
5674    --libdir=DIR Object code libraries EPREFIX/lib
5675    --libexecdir=DIR Program executables EPREFIX/libexec
5676    --localstatedir=DIR Modifiable single-machine data PREFIX/var
5677    --mandir=DIR man documentation PREFIX/man
5678    -n Do not create output files
5679    --no-create
5680    --oldincludedir=DIR C header files for non-gcc /usr/include
5681    --prefix=PREFIX Install architecture-independent files in PREFIX
5683    --program-prefix=PREFIX Prepend PREFIX to installed program names
5685    --program-suffix=SUFFIX Append SUFFIX to installed program names
5687    --program-transform-name=PROGRAM run sed PROGRAM on installed
5688    program names
5689    -q Do not print `checking...' messages
5690    --quiet
5691    --sbindir=DIR System administrative executables EPREFIX/sbin
5692    --sharedstatedir=DIR Modifiable architecture-independent data
5693    PREFIX/com
5694    --srcdir=DIR Find the sources in DIR configure directory or ..
5695    --sysconfdir=DIR Read-only single-machine data PREFIX/etc
5696    --target=TARGET Configure for building compilers for TARGET
5697    -V Display version information and exit
5698    --version
5699    --with-PACKAGE Use PACKAGE
5700    --with-archive-storage-engine Enable the Archive Storage Engine no
5701      5.1.9
5702    --with-atomic-ops Implement atomic operations using pthread
5703    rwlocks or atomic CPU instructions for multi-processor 5.1.12
5704    --with-berkeley-db Use BerkeleyDB located in DIR no   5.1.11
5705    --with-berkeley-db-includes Find Berkeley DB headers in DIR
5706    5.1.11
5707    --with-berkeley-db-libs Find Berkeley DB libraries in DIR   5.1.11
5708    --with-big-tables Support tables with more than 4 G rows even on
5709    32 bit platforms
5710    --with-blackhole-storage-engine Enable the Blackhole Storage
5711    Engine no   5.1.9
5712    --with-charset Default character set
5713    --with-client-ldflags Extra linking arguments for clients
5714    --with-collation Default collation
5715    --with-comment Comment about compilation environment
5716    --with-csv-storage-engine Enable the CSV Storage Engine yes
5717    5.1.9
5718    --with-darwin-mwcc Use Metrowerks CodeWarrior wrappers on OS
5719    X/Darwin
5720    --with-debug Add debug code 5.1.7
5721    --with-debug=full Add debug code (adds memory checker, very slow)
5723    --with-embedded-privilege-control Build parts to check user's
5724    privileges (only affects embedded library)
5725    --with-embedded-server Build the embedded server
5726    --with-error-inject Enable error injection in MySQL Server 5.1.11
5728    --with-example-storage-engine Enable the Example Storage Engine no
5729      5.1.9
5730    --with-extra-charsets Use charsets in addition to default
5731    --with-fast-mutexes Compile with fast mutexes enabled 5.1.5
5732    --with-federated-storage-engine Enable federated storage engine no
5733    5.1.3 5.1.9
5734    --with-gnu-ld Assume the C compiler uses GNU ld no
5735    --with-innodb Enable innobase storage engine no 5.1.3 5.1.9
5736    --with-lib-ccflags Extra CC options for libraries
5737    --with-libwrap=DIR Compile in libwrap (tcp_wrappers) support
5738    --with-low-memory Try to use less memory to compile to avoid
5739    memory limitations
5740    --with-machine-type Set the machine type, like "powerpc"
5741    --with-max-indexes=N Sets the maximum number of indexes per table
5742    64
5743    --with-mysqld-ldflags Extra linking arguments for mysqld
5744    --with-mysqld-libs Extra libraries to link with for mysqld
5745    --with-mysqld-user What user the mysqld daemon shall be run as
5746    --with-mysqlmanager Build the mysqlmanager binary Build if server
5747    is built
5748    --with-named-curses-libs Use specified curses libraries
5749    --with-named-thread-libs Use specified thread libraries
5750    --with-ndb-ccflags Extra CC options for ndb compile
5751    --with-ndb-docs Include the NDB Cluster ndbapi and mgmapi
5752    documentation
5753    --with-ndb-port Port for NDB Cluster management server
5754    --with-ndb-port-base Port for NDB Cluster management server
5755    --with-ndb-sci=DIR Provide MySQL with a custom location of sci
5756    library
5757    --with-ndb-test Include the NDB Cluster ndbapi test programs
5758    --with-ndbcluster Include the NDB Cluster table handler no   5.1.9
5759    --with-openssl=DIR Include the OpenSSL support   5.1.9
5760    --with-openssl-includes Find OpenSSL headers in DIR   5.1.9
5761    --with-openssl-libs Find OpenSSL libraries in DIR   5.1.9
5762    --with-other-libc=DIR Link against libc and other standard
5763    libraries installed in the specified nonstandard location
5764    --with-pic Try to use only PIC/non-PIC objects Use both
5765    --with-plugin-PLUGIN Forces the named plugin to be linked into
5766    mysqld statically 5.1.11
5767    --with-plugins Plugins to include in mysqld none 5.1.11
5768    --with-pstack Use the pstack backtrace library   5.1.54
5769    --with-pthread Force use of pthread library
5770    --with-row-based-replication Include row-based replication 5.1.5
5771    5.1.6
5772    --with-server-suffix Append value to the version string
5773    --with-ssl=DIR Include SSL support 5.1.11
5774    --with-system-type Set the system type, like "sun-solaris10"
5775    --with-tags Include additional configurations automatic
5776    --with-tcp-port Which port to use for MySQL services 3306
5777    --with-unix-socket-path Where to put the unix-domain socket
5778    --with-yassl Include the yaSSL support   5.1.9
5779    --with-zlib-dir=no|bundled|DIR Provide MySQL with a custom
5780    location of compression library
5781    --without-PACKAGE Do not use PACKAGE
5782    --without-bench Skip building of the benchmark suite   5.1.11
5783    --without-debug Build a production version without debugging code
5784      5.1.6
5785    --without-docs Skip building of the documentation
5786    --without-extra-tools Skip building utilities in the tools
5787    directory   5.1.9
5788    --without-geometry Do not build geometry-related parts
5789    --without-libedit Use system libedit instead of bundled copy
5790    --without-man Skip building of the man pages
5791    --without-ndb-binlog Disable ndb binlog 5.1.6
5792    --without-ndb-debug Disable special ndb debug features
5793    --without-plugin-PLUGIN Exclude PLUGIN 5.1.11
5794    --without-query-cache Do not build query cache
5795    --without-readline Use system readline instead of bundled copy
5796    --without-row-based-replication Don't include row-based
5797    replication 5.1.7 5.1.14
5798    --without-server Only build the client
5799    --without-uca Skip building of the national Unicode collations
5801    If you are using a version of gcc recent enough to understand the
5802    -fno-exceptions option, it is very important that you use this
5803    option. Otherwise, you may compile a binary that crashes randomly.
5804    Also use -felide-constructors and -fno-rtti along with
5805    -fno-exceptions. When in doubt, do the following:
5806 CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
5807        -fno-exceptions -fno-rtti" ./configure \
5808        --prefix=/usr/local/mysql --enable-assembler \
5809        --with-mysqld-ldflags=-all-static
5811    On most systems, this gives you a fast and stable binary.
5813    When compiling from source, you should also be aware of any
5814    platform specific considerations that may influence and impact the
5815    build process. Knowing and applying this information will help to
5816    ensure you get the best performance and most stable binary for
5817    your chosen platform. For more information, use the following
5818    sections:
5820      * Section 2.11.9, "Notes on Installing MySQL on AIX from Source"
5822      * Section 2.11.10, "Notes on Installing MySQL on HP-UX from
5823        Source"
5825      * Section 2.11.8, "Notes on Installing MySQL on Solaris from
5826        Source"
5828    Some of the configure options available are described here. For
5829    options that may be of use if you have difficulties building
5830    MySQL, see Section 2.11.5, "Dealing with Problems Compiling
5831    MySQL."
5833    Many options configure compile-time defaults that can be
5834    overridden at server startup. For example, the --prefix,
5835    --with-tcp-port, and with-unix-socket-path options that configure
5836    the default installation base directory location, TCP/IP port
5837    number, and Unix socket file can be changed at server startup with
5838    the --basedir, --port, and --socket options for mysqld.
5840      * To compile just the MySQL client libraries and client programs
5841        and not the server, use the --without-server option:
5842 shell> ./configure --without-server
5843        If you have no C++ compiler, some client programs such as
5844        mysql cannot be compiled because they require C++. In this
5845        case, you can remove the code in configure that tests for the
5846        C++ compiler and then run ./configure with the
5847        --without-server option. The compile step should still try to
5848        build all clients, but you can ignore any warnings about files
5849        such as mysql.cc. (If make stops, try make -k to tell it to
5850        continue with the rest of the build even if errors occur.)
5852      * To build the embedded MySQL library (libmysqld.a), use the
5853        --with-embedded-server option.
5855      * To place your log files and database directories elsewhere
5856        than under /usr/local/var, use a configure command something
5857        like one of these:
5858 shell> ./configure --prefix=/usr/local/mysql
5859 shell> ./configure --prefix=/usr/local \
5860            --localstatedir=/usr/local/mysql/data
5861        The first command changes the installation prefix so that
5862        everything is installed under /usr/local/mysql rather than the
5863        default of /usr/local. The second command preserves the
5864        default installation prefix, but overrides the default
5865        location for database directories (normally /usr/local/var)
5866        and changes it to /usr/local/mysql/data.
5867        You can also specify the installation directory and data
5868        directory locations at server startup time by using the
5869        --basedir and --datadir options. These can be given on the
5870        command line or in an MySQL option file, although it is more
5871        common to use an option file. See Section 4.2.3.3, "Using
5872        Option Files."
5874      * The --with-tcp-port option specifies the port number on which
5875        the server listens for TCP/IP connections. The default is port
5876        3306. To listen on a different port, use a configure command
5877        like this:
5878 shell> ./configure --with-tcp-port=3307
5880      * On Unix, if you want the MySQL socket file location to be
5881        somewhere other than the default location (normally in the
5882        directory /tmp or /var/run), use a configure command like
5883        this:
5884 shell> ./configure \
5885            --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
5886        The socket file name must be an absolute path name. You can
5887        also change the location of mysql.sock at server startup by
5888        using a MySQL option file. See Section C.5.4.5, "How to
5889        Protect or Change the MySQL Unix Socket File."
5891      * To compile statically linked programs (for example, to make a
5892        binary distribution, to get better performance, or to work
5893        around problems with some Red Hat Linux distributions), run
5894        configure like this:
5895 shell> ./configure --with-client-ldflags=-all-static \
5896            --with-mysqld-ldflags=-all-static
5898      * If you are using gcc and do not have libg++ or libstdc++
5899        installed, you can tell configure to use gcc as your C++
5900        compiler:
5901 shell> CC=gcc CXX=gcc ./configure
5902        When you use gcc as your C++ compiler, it does not attempt to
5903        link in libg++ or libstdc++. This may be a good thing to do
5904        even if you have those libraries installed. Some versions of
5905        them have caused strange problems for MySQL users in the past.
5906        In most cases, you can get a reasonably optimized MySQL binary
5907        by using the following options on the configure line:
5908 --prefix=/usr/local/mysql --enable-assembler \
5909 --with-mysqld-ldflags=-all-static
5910        The full configure line would, in other words, be something
5911        like the following for all recent gcc versions:
5912 CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
5913 -felide-constructors -fno-exceptions -fno-rtti" ./configure \
5914 --prefix=/usr/local/mysql --enable-assembler \
5915 --with-mysqld-ldflags=-all-static
5916        The binaries we provide on the MySQL Web site at
5917        http://dev.mysql.com/downloads/ are all compiled with full
5918        optimization and should work well for most users. See Section
5919        2.2, "Installing MySQL on Unix/Linux Using Generic Binaries."
5921      * If the build fails and produces errors about your compiler or
5922        linker not being able to create the shared library
5923        libmysqlclient.so.N (where N is a version number), you can
5924        work around this problem by giving the --disable-shared option
5925        to configure. In this case, configure does not build a shared
5926        libmysqlclient.so.N library.
5928      * By default, MySQL uses the latin1 (cp1252 West European)
5929        character set. To change the default set, use the
5930        --with-charset option:
5931 shell> ./configure --with-charset=CHARSET
5932        CHARSET may be one of binary, armscii8, ascii, big5, cp1250,
5933        cp1251, cp1256, cp1257, cp850, cp852, cp866, cp932, dec8,
5934        eucjpms, euckr, gb2312, gbk, geostd8, greek, hebrew, hp8,
5935        keybcs2, koi8r, koi8u, latin1, latin2, latin5, latin7, macce,
5936        macroman, sjis, swe7, tis620, ucs2, ujis, utf8. (Additional
5937        character sets might be available. Check the output from
5938        ./configure --help for the current list.)
5939        The default collation may also be specified. MySQL uses the
5940        latin1_swedish_ci collation by default. To change this, use
5941        the --with-collation option:
5942 shell> ./configure --with-collation=COLLATION
5943        To change both the character set and the collation, use both
5944        the --with-charset and --with-collation options. The collation
5945        must be a legal collation for the character set. (Use the SHOW
5946        COLLATION statement to determine which collations are
5947        available for each character set.)
5948        With the configure option --with-extra-charsets=LIST, you can
5949        define which additional character sets should be compiled into
5950        the server. LIST is one of the following:
5952           + A list of character set names separated by spaces
5954           + complex to include all character sets that can't be
5955             dynamically loaded
5957           + all to include all character sets into the binaries
5958        Clients that want to convert characters between the server and
5959        the client should use the SET NAMES statement. See Section
5960        10.1.4, "Connection Character Sets and Collations."
5962      * To configure MySQL with debugging code, use the --with-debug
5963        option:
5964 shell> ./configure --with-debug
5965        This causes a safe memory allocator to be included that can
5966        find some errors and that provides output about what is
5967        happening. See Section 22.4, "Debugging and Porting MySQL."
5968        As of MySQL 5.1.12, using --with-debug to configure MySQL with
5969        debugging support enables you to use the
5970        --debug="d,parser_debug" option when you start the server.
5971        This causes the Bison parser that is used to process SQL
5972        statements to dump a parser trace to the server's standard
5973        error output. Typically, this output is written to the error
5974        log.
5976      * To cause the Debug Sync facility to be compiled into the
5977        server, use the --enable-debug-sync option. This facility is
5978        used for testing and debugging. When compiled in, Debug Sync
5979        is disabled by default at runtime. To enable it, start mysqld
5980        with the --debug-sync-timeout=N option, where N is a timeout
5981        value greater than 0. (The default value is 0, which disables
5982        Debug Sync.) N becomes the default timeout for individual
5983        synchronization points.
5984        Debug Sync is also compiled in if you configure with the
5985        --with-debug option (which implies --enable-debug-sync),
5986        unless you also use the --disable-debug-sync option.
5987        For a description of the Debug Sync facility and how to use
5988        synchronization points, see MySQL Internals: Test
5989        Synchronization
5990        (http://dev.mysql.com/doc/internals/en/test-synchronization.ht
5991        ml).
5992        The --enable-debug-sync and --disable-debug-sync options were
5993        added in MySQL 5.1.41.
5995      * If your client programs are using threads, you must compile a
5996        thread-safe version of the MySQL client library with the
5997        --enable-thread-safe-client configure option. This creates a
5998        libmysqlclient_r library with which you should link your
5999        threaded applications. See Section 21.8.4.2, "Writing C API
6000        Threaded Client Programs."
6002      * Some features require that the server be built with
6003        compression library support, such as the COMPRESS() and
6004        UNCOMPRESS() functions, and compression of the client/server
6005        protocol. The --with-zlib-dir=no|bundled|DIR option provides
6006        control over compression library support. The value no
6007        explicitly disables compression support. bundled causes the
6008        zlib library bundled in the MySQL sources to be used. A DIR
6009        path name specifies the directory in which to find the
6010        compression library sources.
6012      * It is possible to build MySQL with large table support using
6013        the --with-big-tables option.
6014        This option causes the variables that store table row counts
6015        to be declared as unsigned long long rather than unsigned
6016        long. This enables tables to hold up to approximately
6017        1.844E+19 ((2^32)^2) rows rather than 2^32 (~4.295E+09) rows.
6018        Previously it was necessary to pass -DBIG_TABLES to the
6019        compiler manually in order to enable this feature.
6021      * Run configure with the --disable-grant-options option to cause
6022        the --bootstrap, --skip-grant-tables, and --init-file options
6023        for mysqld to be disabled. For Windows, the configure.js
6024        script recognizes the DISABLE_GRANT_OPTIONS flag, which has
6025        the same effect. The capability is available as of MySQL
6026        5.1.15.
6028      * This option allows MySQL Community Server features to be
6029        enabled. Additional options may be required for individual
6030        features, such as --enable-profiling to enable statement
6031        profiling. This option was added in MySQL 5.1.24. It is
6032        enabled by default as of MySQL 5.1.28; to disable it, use
6033        --disable-community-features.
6035      * When given with --enable-community-features, the
6036        --enable-profiling option enables the statement profiling
6037        capability exposed by the SHOW PROFILE and SHOW PROFILES
6038        statements. (See Section 13.7.5.33, "SHOW PROFILES Syntax.")
6039        This option was added in MySQL 5.1.24. It is enabled by
6040        default as of MySQL 5.1.28; to disable it, use
6041        --disable-profiling.
6043      * See Section 2.1, "General Installation Guidance," for options
6044        that pertain to particular operating systems.
6046      * See Section 6.3.6.2, "Configuring MySQL for SSL," for options
6047        that pertain to configuring MySQL to support secure
6048        (encrypted) connections.
6050      * Several configure options apply to plugin selection and
6051        building:
6052 --with-plugins=PLUGIN[,PLUGIN]...
6053 --with-plugins=GROUP
6054 --with-plugin-PLUGIN
6055 --without-plugin-PLUGIN
6056        PLUGIN is an individual plugin name such as csv or archive.
6057        As shorthand, GROUP is a configuration group name such as none
6058        (select no plugins) or all (select all plugins).
6059        You can build a plugin as static (compiled into the server) or
6060        dynamic (built as a dynamic library that must be installed
6061        using the INSTALL PLUGIN statement or the --plugin-load option
6062        before it can be used). Some plugins might not support static
6063        or dynamic build.
6064        configure --help shows the following information pertaining to
6065        plugins:
6067           + The plugin-related options
6069           + The names of all available plugins
6071           + For each plugin, a description of its purpose, which
6072             build types it supports (static or dynamic), and which
6073             plugin groups it is a part of.
6074        --with-plugins can take a list of one or more plugin names
6075        separated by commas, or a plugin group name. The named plugins
6076        are configured to be built as static plugins.
6077        --with-plugin-PLUGIN configures the given plugin to be built
6078        as a static plugin.
6079        --without-plugin-PLUGIN disables the given plugin from being
6080        built.
6081        If a plugin is named both with a --with and --without option,
6082        the result is undefined.
6083        For any plugin that is not explicitly selected or disabled, it
6084        is selected to be built dynamically if it supports dynamic
6085        build, and not built if it does not support dynamic build.
6086        (Thus, in the case that no plugin options are given, all
6087        plugins that support dynamic build are selected to be built as
6088        dynamic plugins. Plugins that do not support dynamic build are
6089        not built.)
6091 2.11.5. Dealing with Problems Compiling MySQL
6093    All MySQL programs compile cleanly for us with no warnings on
6094    Solaris or Linux using gcc. On other systems, warnings may occur
6095    due to differences in system include files. For other problems,
6096    check the following list.
6098    The solution to many problems involves reconfiguring. If you do
6099    need to reconfigure, take note of the following:
6101      * If configure is run after it has previously been run, it may
6102        use information that was gathered during its previous
6103        invocation. This information is stored in config.cache. When
6104        configure starts up, it looks for that file and reads its
6105        contents if it exists, on the assumption that the information
6106        is still correct. That assumption is invalid when you
6107        reconfigure.
6109      * Each time you run configure, you must run make again to
6110        recompile. However, you may want to remove old object files
6111        from previous builds first because they were compiled using
6112        different configuration options.
6114    To prevent old configuration information or object files from
6115    being used, run these commands before re-running configure:
6116 shell> rm config.cache
6117 shell> make clean
6119    Alternatively, you can run make distclean.
6121    The following list describes some of the problems that have been
6122    found to occur most often when compiling MySQL:
6124      * If you get errors such as the ones shown here when compiling
6125        sql_yacc.cc, you probably have run out of memory or swap
6126        space:
6127 Internal compiler error: program cc1plus got fatal signal 11
6128 Out of virtual memory
6129 Virtual memory exhausted
6130        The problem is that gcc requires a huge amount of memory to
6131        compile sql_yacc.cc with inline functions. Try running
6132        configure with the --with-low-memory option:
6133 shell> ./configure --with-low-memory
6134        This option causes -fno-inline to be added to the compile line
6135        if you are using gcc and -O0 if you are using something else.
6136        You should try the --with-low-memory option even if you have
6137        so much memory and swap space that you think you can't
6138        possibly have run out. This problem has been observed to occur
6139        even on systems with generous hardware configurations, and the
6140        --with-low-memory option usually fixes it.
6142      * By default, configure picks c++ as the compiler name and GNU
6143        c++ links with -lg++. If you are using gcc, that behavior can
6144        cause problems during configuration such as this:
6145 configure: error: installation or configuration problem:
6146 C++ compiler cannot create executables.
6147        You might also observe problems during compilation related to
6148        g++, libg++, or libstdc++.
6149        One cause of these problems is that you may not have g++, or
6150        you may have g++ but not libg++, or libstdc++. Take a look at
6151        the config.log file. It should contain the exact reason why
6152        your C++ compiler did not work. To work around these problems,
6153        you can use gcc as your C++ compiler. Try setting the
6154        environment variable CXX to "gcc -O3". For example:
6155 shell> CXX="gcc -O3" ./configure
6156        This works because gcc compiles C++ source files as well as
6157        g++ does, but does not link in libg++ or libstdc++ by default.
6158        Another way to fix these problems is to install g++, libg++,
6159        and libstdc++. However, do not use libg++ or libstdc++ with
6160        MySQL because this only increases the binary size of mysqld
6161        without providing any benefits. Some versions of these
6162        libraries have also caused strange problems for MySQL users in
6163        the past.
6165      * To define flags to be used by your C or C++ compilers, specify
6166        them using the CFLAGS and CXXFLAGS environment variables. You
6167        can also specify the compiler names this way using CC and CXX.
6168        For example:
6169 shell> CC=gcc
6170 shell> CFLAGS=-O3
6171 shell> CXX=gcc
6172 shell> CXXFLAGS=-O3
6173 shell> export CC CFLAGS CXX CXXFLAGS
6174        To see what flags you might need to specify, invoke
6175        mysql_config with the --cflags option.
6177      * If you get errors such as those shown here when compiling
6178        mysqld, configure did not correctly detect the type of the
6179        last argument to accept(), getsockname(), or getpeername():
6180 cxx: Error: mysqld.cc, line 645: In this statement, the referenced
6181      type of the pointer value ''length'' is ''unsigned long'',
6182      which is not compatible with ''int''.
6183 new_sock = accept(sock, (struct sockaddr *)&cAddr, &length);
6184        To fix this, edit the config.h file (which is generated by
6185        configure). Look for these lines:
6186 /* Define as the base type of the last arg to accept */
6187 #define SOCKET_SIZE_TYPE XXX
6188        Change XXX to size_t or int, depending on your operating
6189        system. (You must do this each time you run configure because
6190        configure regenerates config.h.)
6192      * If your compile fails with errors such as any of the
6193        following, you must upgrade your version of make to GNU make:
6194 make: Fatal error in reader: Makefile, line 18:
6195 Badly formed macro assignment
6196        Or:
6197 make: file `Makefile' line 18: Must be a separator (:
6198        Or:
6199 pthread.h: No such file or directory
6200        Solaris and FreeBSD are known to have troublesome make
6201        programs.
6202        GNU make 3.75 is known to work.
6204      * The sql_yacc.cc file is generated from sql_yacc.yy. Normally,
6205        the build process does not need to create sql_yacc.cc because
6206        MySQL comes with a pregenerated copy. However, if you do need
6207        to re-create it, you might encounter this error:
6208 "sql_yacc.yy", line xxx fatal: default action causes potential...
6209        This is a sign that your version of yacc is deficient. You
6210        probably need to install bison (the GNU version of yacc) and
6211        use that instead.
6212        Versions of bison older than 1.75 may report this error:
6213 sql_yacc.yy:#####: fatal error: maximum table size (32767) exceeded
6214        The maximum table size is not actually exceeded; the error is
6215        caused by bugs in older versions of bison.
6217      * On Debian Linux 3.0, you need to install gawk instead of the
6218        default mawk.
6220      * If you get a compilation error on Linux (for example, SuSE
6221        Linux 8.1 or Red Hat Linux 7.3) similar to the following one,
6222        you probably do not have g++ installed:
6223 libmysql.c:1329: warning: passing arg 5 of `gethostbyname_r' from
6224 incompatible pointer type
6225 libmysql.c:1329: too few arguments to function `gethostbyname_r'
6226 libmysql.c:1329: warning: assignment makes pointer from integer
6227 without a cast
6228 make[2]: *** [libmysql.lo] Error 1
6229        By default, the configure script attempts to determine the
6230        correct number of arguments by using g++ (the GNU C++
6231        compiler). This test yields incorrect results if g++ is not
6232        installed. There are two ways to work around this problem:
6234           + Make sure that the GNU C++ g++ is installed. On some
6235             Linux distributions, the required package is called gpp;
6236             on others, it is named gcc-c++.
6238           + Use gcc as your C++ compiler by setting the CXX
6239             environment variable to gcc:
6240 export CXX="gcc"
6241        You must run configure again after making either of those
6242        changes.
6244    For information about acquiring or updating tools, see the system
6245    requirements in Section 2.11, "Installing MySQL from Source."
6247 2.11.6. Compiling and Linking an Optimized mysqld Server
6249    Most of the following tests were performed on Linux with the MySQL
6250    benchmarks, but they should give some indication for other
6251    operating systems and workloads.
6253    You obtain the fastest executables when you link with -static.
6255    By using better compiler and compilation options, you can obtain a
6256    10% to 30% speed increase in applications. This is particularly
6257    important if you compile the MySQL server yourself.
6259    When we tested both the Cygnus CodeFusion and Fujitsu compilers,
6260    neither was sufficiently bug-free to enable MySQL to be compiled
6261    with optimizations enabled.
6263    The standard MySQL binary distributions are compiled with support
6264    for all character sets. When you compile MySQL yourself, include
6265    support only for the character sets that you are going to use.
6266    This is controlled by the --with-charset option to configure.
6268    Here is a list of some measurements that we have made:
6270      * If you link dynamically (without -static), the result is 13%
6271        slower on Linux. Note that you still can use a dynamically
6272        linked MySQL library for your client applications. It is the
6273        server that is most critical for performance.
6275      * For a connection from a client to a server running on the same
6276        host, if you connect using TCP/IP rather than a Unix socket
6277        file, performance is 7.5% slower. (On Unix, if you connect to
6278        the host name localhost, MySQL uses a socket file by default.)
6280      * For TCP/IP connections from a client to a server, connecting
6281        to a remote server on another host is 8% to 11% slower than
6282        connecting to a server on the same host, even for connections
6283        faster than 100Mb/s Ethernet.
6285      * When running our benchmark tests using secure connections (all
6286        data encrypted with internal SSL support) performance was 55%
6287        slower than with unencrypted connections.
6289      * On a Sun UltraSPARC-IIe, a server compiled with Forte 5.0 is
6290        4% faster than one compiled with gcc 3.2.
6292      * On a Sun UltraSPARC-IIe, a server compiled with Forte 5.0 is
6293        4% faster in 32-bit mode than in 64-bit mode.
6295      * Compiling on Linux-x86 using gcc without frame pointers
6296        (-fomit-frame-pointer or -fomit-frame-pointer -ffixed-ebp)
6297        makes mysqld 1% to 4% faster.
6299 2.11.7. Installing MySQL from Source on Windows
6301    These instructions describe how to build binaries from source for
6302    MySQL 5.1 on Windows. Instructions are provided for building
6303    binaries from a standard source distribution or from the Bazaar
6304    tree that contains the latest development source.
6305    Note
6307    The instructions here are strictly for users who want to test
6308    MySQL on Microsoft Windows from the latest source distribution or
6309    from the Bazaar tree. For production use, we do not advise using a
6310    MySQL server built by yourself from source. Normally, it is best
6311    to use precompiled binary distributions of MySQL that are built
6312    specifically for optimal performance on Windows by Oracle
6313    Corporation. Instructions for installing binary distributions are
6314    available in Section 2.3, "Installing MySQL on Microsoft Windows."
6316    To build MySQL on Windows from source, you must satisfy the
6317    following system, compiler, and resource requirements:
6319      * Windows 2000, Windows XP, or newer version.
6320        Windows Vista is supported when using Visual Studio 2005
6321        provided you have installed the following updates:
6323           + Microsoft Visual Studio 2005 Professional Edition - ENU
6324             Service Pack 1 (KB926601)
6325             (http://support.microsoft.com/?kbid=926601)
6327           + Security Update for Microsoft Visual Studio 2005
6328             Professional Edition - ENU (KB937061)
6329             (http://support.microsoft.com/?kbid=937061)
6331           + Update for Microsoft Visual Studio 2005 Professional
6332             Edition - ENU (KB932232)
6333             (http://support.microsoft.com/?kbid=932232)
6335      * CMake, which can be downloaded from http://www.cmake.org.
6336        After installing, modify your PATH environment variable to
6337        include the directory where cmake is located.
6339      * Microsoft Visual C++ 2005 Express Edition, Visual Studio .Net
6340        2003 (7.1), or Visual Studio 2005 (8.0) compiler system.
6342      * If you are using Visual C++ 2005 Express Edition, you must
6343        also install an appropriate Platform SDK. More information and
6344        links to downloads for various Windows platforms is available
6345        from
6346        http://www.microsoft.com/downloads/details.aspx?familyid=0baf2
6347        b35-c656-4969-ace8-e4c0c0716adb.
6349      * If you are compiling from a Bazaar tree or making changes to
6350        the parser, you need bison for Windows, which can be
6351        downloaded from
6352        http://gnuwin32.sourceforge.net/packages/bison.htm. Download
6353        the package labeled "Complete package, excluding sources".
6354        After installing the package, modify your PATH environment
6355        variable to include the directory where bison is located.
6356        Note
6357        On Windows, the default location for bison is the C:\Program
6358        Files\GnuWin32 directory. Some utilities, including m4, may
6359        fail to find bison because of the space in the directory name.
6360        You can resolve this by installing into a directory that does
6361        not contain a space; for example C:\GnuWin32.
6363      * Cygwin might be necessary if you want to run the test script
6364        or package the compiled binaries and support files into a Zip
6365        archive. (Cygwin is needed only to test or package the
6366        distribution, not to build it.) Cygwin is available from
6367        http://cygwin.com.
6369      * 3GB to 5GB of disk space.
6371    You also need a MySQL source distribution for Windows, which can
6372    be obtained two ways:
6374      * Obtain a source distribution packaged by Oracle Corporation.
6375        These are available from http://dev.mysql.com/downloads/.
6377      * Package a source distribution yourself from the latest Bazaar
6378        developer source tree. For instructions on pulling the latest
6379        source files, see Section 2.11.3, "Installing MySQL Using a
6380        Development Source Tree."
6382    If you find something not working as expected, or you have
6383    suggestions about ways to improve the current build process on
6384    Windows, please send a message to the win32 mailing list. See
6385    Section 1.6.1, "MySQL Mailing Lists."
6386    Note
6388    To compile from the source code on Windows you must use the
6389    standard source distribution (for example, mysql-5.1.74.zip) or
6390    mysql-5.1.74.tar.gz). You build from the same distribution as used
6391    to build MySQL on Unix, Linux and other platforms. Do not use the
6392    Windows Source distributions as they do not contain the necessary
6393    configuration script and other files.
6395    Follow this procedure to build MySQL:
6397     1. If you are installing from a packaged source distribution,
6398        create a work directory (for example, C:\workdir), and unpack
6399        the source distribution there using WinZip or another Windows
6400        tool that can read .zip files. This directory is the work
6401        directory in the following instructions.
6402        Note
6403        Commands that are located in the win directory should be
6404        executed from the top-level source directory. Do not change
6405        location into the win directory, as the commands will not
6406        execute correctly.
6408     2. Start a command shell. If you have not configured the PATH and
6409        other environment variables for all command shells, you may be
6410        able to start a command shell from the Start Menu within the
6411        Windows Visual Studio menu that contains the necessary
6412        environment changes.
6414     3. Within the command shell, navigate to the work directory and
6415        run the following command:
6416 C:\workdir>win\configure.js options
6417        If you have associated the .js file extension with an
6418        application such as a text editor, then you may need to use
6419        the following command to force configure.js to be executed as
6420        a script:
6421 C:\workdir>cscript win\configure.js options
6422        These options are available for configure.js:
6424           + WITH_INNOBASE_STORAGE_ENGINE: Enable the InnoDB storage
6425             engine.
6427           + WITH_PARTITION_STORAGE_ENGINE: Enable user-defined
6428             partitioning.
6430           + WITH_ARCHIVE_STORAGE_ENGINE: Enable the ARCHIVE storage
6431             engine.
6433           + WITH_BLACKHOLE_STORAGE_ENGINE: Enable the BLACKHOLE
6434             storage engine.
6436           + WITH_EXAMPLE_STORAGE_ENGINE: Enable the EXAMPLE storage
6437             engine.
6439           + WITH_FEDERATED_STORAGE_ENGINE: Enable the FEDERATED
6440             storage engine.
6442           + WITH_NDBCLUSTER_STORAGE_ENGINE: Enable the NDBCLUSTER
6443             storage engine in the MySQL server; cause binaries for
6444             the MySQL Cluster management and data node, management
6445             client, and other programs to be built.
6446             This option is supported only in MySQL Cluster NDB 7.0
6447             and later (NDBCLUSTER storage engine versions 6.4.0 and
6448             later) using the MySQL Cluster sources. It cannot be used
6449             to enable clustering support in other MySQL source trees
6450             or distributions.
6452           + MYSQL_SERVER_SUFFIX=suffix: Server suffix, default none.
6454           + COMPILATION_COMMENT=comment: Server comment, default
6455             "Source distribution".
6457           + MYSQL_TCP_PORT=port: Server port, default 3306.
6459           + DISABLE_GRANT_OPTIONS: Disables the --bootstrap,
6460             --skip-grant-tables, and --init-file options for mysqld.
6461             This option is available as of MySQL 5.1.15.
6462        For example (type the command on one line):
6463 C:\workdir>win\configure.js WITH_INNOBASE_STORAGE_ENGINE
6464              WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro
6466     4. From the work directory, execute the win\build-vs9.bat
6467        (Windows Visual Studio 2008), win\build-vs8.bat (Windows
6468        Visual Studio 2005), or win\build-vs71.bat (Windows Visual
6469        Studio 2003) script, depending on the version of Visual Studio
6470        you have installed. The script invokes CMake, which generates
6471        the mysql.sln solution file.
6472        You can also use the corresponding 64-bit file (for example
6473        win\build-vs8_x64.bat or win\build-vs9_x64.bat) to build the
6474        64-bit version of MySQL. However, you cannot build the 64-bit
6475        version with Visual Studio Express Edition. You must use
6476        Visual Studio 2005 (8.0) or higher.
6478     5. From the work directory, open the generated mysql.sln file
6479        with Visual Studio and select the proper configuration using
6480        the Configuration menu. The menu provides Debug, Release,
6481        RelwithDebInfo, MinRelInfo options. Then select Solution >
6482        Build to build the solution.
6483        Remember the configuration that you use in this step. It is
6484        important later when you run the test script because that
6485        script needs to know which configuration you used.
6487     6. Test the server. The server built using the preceding
6488        instructions expects that the MySQL base directory and data
6489        directory are C:\mysql and C:\mysql\data by default. If you
6490        want to test your server using the source tree root directory
6491        and its data directory as the base directory and data
6492        directory, you need to tell the server their path names. You
6493        can either do this on the command line with the --basedir and
6494        --datadir options, or by placing appropriate options in an
6495        option file. (See Section 4.2.3.3, "Using Option Files.") If
6496        you have an existing data directory elsewhere that you want to
6497        use, you can specify its path name instead.
6498        When the server is running in standalone fashion or as a
6499        service based on your configuration, try to connect to it from
6500        the mysql interactive command-line utility.
6501        You can also run the standard test script, mysql-test-run.pl.
6502        This script is written in Perl, so you'll need either Cygwin
6503        or ActiveState Perl to run it. You may also need to install
6504        the modules required by the script. To run the test script,
6505        change location into the mysql-test directory under the work
6506        directory, set the MTR_VS_CONFIG environment variable to the
6507        configuration you selected earlier (or use the --vs-config
6508        option), and invoke mysql-test-run.pl. For example (using
6509        Cygwin and the bash shell):
6510 shell> cd mysql-test
6511 shell> export MTR_VS_CONFIG=debug
6512 shell> ./mysql-test-run.pl --force --timer
6513 shell> ./mysql-test-run.pl --force --timer --ps-protocol
6515    When you are satisfied that the programs you have built are
6516    working correctly, stop the server. Now you can install the
6517    distribution. One way to do this is to use the make_win_bin_dist
6518    script in the scripts directory of the MySQL source distribution
6519    (see Section 4.4.2, "make_win_bin_dist --- Package MySQL
6520    Distribution as Zip Archive"). This is a shell script, so you must
6521    have Cygwin installed if you want to use it. It creates a Zip
6522    archive of the built executables and support files that you can
6523    unpack in the location at which you want to install MySQL.
6525    It is also possible to install MySQL by copying directories and
6526    files directly:
6528     1. Create the directories where you want to install MySQL. For
6529        example, to install into C:\mysql, use these commands:
6530 C:\> mkdir C:\mysql
6531 C:\> mkdir C:\mysql\bin
6532 C:\> mkdir C:\mysql\data
6533 C:\> mkdir C:\mysql\share
6534 C:\> mkdir C:\mysql\scripts
6535        If you want to compile other clients and link them to MySQL,
6536        you should also create several additional directories:
6537 C:\> mkdir C:\mysql\include
6538 C:\> mkdir C:\mysql\lib
6539 C:\> mkdir C:\mysql\lib\debug
6540 C:\> mkdir C:\mysql\lib\opt
6541        If you want to benchmark MySQL, create this directory:
6542 C:\> mkdir C:\mysql\sql-bench
6543        Benchmarking requires Perl support for MySQL. See Section
6544        2.15, "Perl Installation Notes."
6546     2. From the work directory, copy into the C:\mysql directory the
6547        following files and directories:
6548 C:\> cd \workdir
6549 C:\workdir> mkdir C:\mysql
6550 C:\workdir> mkdir C:\mysql\bin
6551 C:\workdir> copy client\Release\*.exe C:\mysql\bin
6552 C:\workdir> copy sql\Release\mysqld.exe C:\mysql\bin\mysqld.exe
6553 C:\workdir> xcopy scripts\*.* C:\mysql\scripts /E
6554 C:\workdir> xcopy share\*.* C:\mysql\share /E
6555        If you want to compile other clients and link them to MySQL,
6556        you should also copy several libraries and header files:
6557 C:\workdir> copy lib\Release\mysqlclient.lib C:\mysql\lib\debug
6558 C:\workdir> copy lib\Release\libmysql.* C:\mysql\lib\debug
6559 C:\workdir> copy lib\Release\zlib.* C:\mysql\lib\debug
6560 C:\workdir> copy lib\Release\mysqlclient.lib C:\mysql\lib\opt
6561 C:\workdir> copy lib\Release\libmysql.* C:\mysql\lib\opt
6562 C:\workdir> copy lib\Release\zlib.* C:\mysql\lib\opt
6563 C:\workdir> copy include\*.h C:\mysql\include
6564 C:\workdir> copy libmysql\libmysql.def C:\mysql\include
6565        Note
6566        If you have compiled a Debug solution, rather than a Release
6567        solution, install it by replacing Release with Debug in the
6568        source file names just shown.
6569        If you want to benchmark MySQL, you should also do this:
6570 C:\workdir> xcopy sql-bench\*.* C:\mysql\bench /E
6572    After installation, set up and start the server in the same way as
6573    for binary Windows distributions. This includes creating the
6574    system tables by running mysql_install_db. For more information,
6575    see Section 2.3, "Installing MySQL on Microsoft Windows."
6577 2.11.8. Notes on Installing MySQL on Solaris from Source
6579    When building MySQL on Solaris you can use either the Sun Studio
6580    or GNU cc compilers. For more information on specific notes and
6581    environments, use the following hints.
6583      * When building you should ensure that your PATH variable
6584        includes the necessary tools, including ar for building
6585        libraries. Some tools are located in /usr/ccs/bin.
6587      * When running configure, you should specify the C and C++
6588        compiler explicitly to ensure that the right C compiler
6589        combination is used:
6590 CC=gcc CXX=g++ ./configure
6592      * For detailed information on performance tuning your MySQL
6593        installation for Solaris, you can use the information from
6594        Krish Shankar
6595        (http://blogs.sun.com/krishs/entry/sun_studio_compiler_options
6596        _for) and the Sun Solaris MySQL Performance Tuning
6597        (http://developers.sun.com/solaris/articles/mysql_perf_tune.ht
6598        ml) pages.
6600      * If you have an UltraSPARC system, you can get 4% better
6601        performance by adding -mcpu=v8 -Wa,-xarch=v8plusa to the
6602        CFLAGS and CXXFLAGS environment variables.
6604      * If you have Sun's Forte 5.00 (or newer) or Sun Studio
6605        compiler, you can run configure like this:
6606 CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt" \
6607 CXX=CC CXXFLAGS="-noex -mt" \
6608 ./configure --prefix=/usr/local/mysql --enable-assembler
6610      * To create a 64-bit SPARC binary with Sun's Forte or Sun Studio
6611        compiler, use the following configuration options:
6612 CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt -xarch=v9" \
6613 CXX=CC CXXFLAGS="-noex -mt -xarch=v9" ASFLAGS="-xarch=v9" \
6614 ./configure --prefix=/usr/local/mysql --enable-assembler
6615        To create a 64-bit Solaris binary using gcc, add -m64 to
6616        CFLAGS and CXXFLAGS and remove --enable-assembler from the
6617        configure line.
6618        In the MySQL benchmarks, we obtained a 4% speed increase on
6619        UltraSPARC when using Forte 5.0 in 32-bit mode, as compared to
6620        using gcc 3.2 with the -mcpu flag.
6621        If you create a 64-bit mysqld binary, it is 4% slower than the
6622        32-bit binary, but can handle more threads and memory.
6624      * If you get a problem with fdatasync or sched_yield, you can
6625        fix this by adding LIBS=-lrt to the configure line
6627      * Solaris does not provide static versions of all system
6628        libraries (libpthreads and libdl), so you cannot compile MySQL
6629        with --static. If you try to do so, you get one of the
6630        following errors:
6631 ld: fatal: library -ldl: not found
6632 undefined reference to `dlopen'
6633 cannot find -lrt
6635      * If you link your own MySQL client programs, you may see the
6636        following error at runtime:
6637 ld.so.1: fatal: libmysqlclient.so.#:
6638 open failed: No such file or directory
6639        To avoid this problem, use one of the following methods:
6641           + Use the crle tool to add the directory containing the
6642             libmysqlclient library file to the list of standard
6643             library directories. You need administrator privileges to
6644             do this. Make sure you update the library information,
6645             rather than replace it with the new path. For example,
6646             the following command adds the directory to the list of
6647             standard directories searched for libraries.
6648 crle -u -l /usr/local/mysql/lib
6649             For 64-bit libraries, add the -64 option:
6650 crle -64 -u -l /usr/local/mysql/lib
6652           + Link clients with the
6653             -Wl,r/full/path/to/libmysqlclient.so flag rather than
6654             with -Lpath).
6656           + Copy libmysqlclient.so to /usr/lib.
6658           + Add the path name of the directory where
6659             libmysqlclient.so is located to the LD_RUN_PATH
6660             environment variable before running your client.
6662      * If you have problems with configure trying to link with -lz
6663        when you do not have zlib installed, you have two options:
6665           + If you want to be able to use the compressed
6666             communication protocol, obtain and install zlib from
6667             ftp.gnu.org.
6669           + To build without zlib, run configure with the
6670             --with-named-z-libs=no option when building MySQL.
6672      * If you are using gcc and have problems with loading
6673        user-defined functions (UDFs) into MySQL, try adding -lgcc to
6674        the link line for the UDF.
6676 2.11.9. Notes on Installing MySQL on AIX from Source
6678    General notes on building MySQL from source on IBM AIX:
6680      * Automatic xlC detection is missing from Autoconf, so a number
6681        of variables need to be set before running configure. The
6682        following example uses the IBM compiler:
6683 export CC="xlc_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192 "
6684 export CXX="xlC_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192"
6685 export CFLAGS="-I /usr/local/include"
6686 export LDFLAGS="-L /usr/local/lib"
6687 export CPPFLAGS=$CFLAGS
6688 export CXXFLAGS=$CFLAGS
6690 ./configure --prefix=/usr/local \
6691                 --localstatedir=/var/mysql \
6692                 --sbindir='/usr/local/bin' \
6693                 --libexecdir='/usr/local/bin' \
6694                 --enable-thread-safe-client \
6695                 --enable-large-files
6696        The preceding options are used to compile the MySQL
6697        distribution that can be found at http://www-frec.bull.com/.
6699      * If you change the -O3 to -O2 in the preceding configure line,
6700        you must also remove the -qstrict option. This is a limitation
6701        in the IBM C compiler.
6703      * If you compile MySQL with gcc, you must use the
6704        -fno-exceptions flag because the exception handling in gcc is
6705        not thread-safe. There are also some known problems with IBM's
6706        assembler that may cause it to generate bad code when used
6707        with gcc.
6709      * If you have problems with signals (MySQL dies unexpectedly
6710        under high load), you may have found an OS bug with threads
6711        and signals. In this case, you can tell MySQL not to use
6712        signals by configuring as follows:
6713 CFLAGS=-DDONT_USE_THR_ALARM CXX=gcc \
6714 CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti \
6715 -DDONT_USE_THR_ALARM" \
6716 ./configure --prefix=/usr/local/mysql --with-debug \
6717     --with-low-memory
6718        This does not affect the performance of MySQL, but has the
6719        side effect that you cannot kill clients that are "sleeping"
6720        on a connection with mysqladmin kill or mysqladmin shutdown.
6721        Instead, the client dies when it issues its next command.
6723      * On some versions of AIX, linking with libbind.a makes
6724        getservbyname() dump core. This is an AIX bug and should be
6725        reported to IBM.
6727 2.11.10. Notes on Installing MySQL on HP-UX from Source
6729    General notes on compiling MySQL on HP-UX.
6731      * If you are using HP-UX compiler, you can use the following
6732        command (which has been tested with cc B.11.11.04):
6733 CC=cc CXX=aCC CFLAGS=+DD64 CXXFLAGS=+DD64 ./configure \
6734     --with-extra-character-set=complex
6735        You can ignore any errors of the following type:
6736 aCC: warning 901: unknown option: `-3': use +help for online
6737 documentation
6739      * If you get the following error from configure, verify that you
6740        do not have the path to the K&R compiler before the path to
6741        the HP-UX C and C++ compiler:
6742 checking for cc option to accept ANSI C... no
6743 configure: error: MySQL requires an ANSI C compiler (and a C++ compil
6744 er).
6745 Try gcc. See the Installation chapter in the Reference Manual.
6747      * Another reason for compile failure is that you did not define
6748        the +DD64 flags as just described.
6750 2.12. Postinstallation Setup and Testing
6752    This section discusses post-installation items for Unix systems.
6753    If you are using Windows, see Section 2.3.9, "MySQL Server on
6754    Microsoft Windows Postinstallation Procedures."
6756    After installing MySQL, there are some items that you should
6757    address. For example:
6759      * You should initialize the data directory and create the MySQL
6760        grant tables, as describe in Section 2.12.1, "Unix
6761        Postinstallation Procedures."
6763      * An important security concern is that the initial accounts in
6764        the grant tables have no passwords. You should assign
6765        passwords to prevent unauthorized access to the MySQL server.
6766        For instructions, see Section 2.12.2, "Securing the Initial
6767        MySQL Accounts."
6769      * Optionally, you can create time zone tables to enable
6770        recognition of named time zones. For instructions, see Section
6771        4.4.7, "mysql_tzinfo_to_sql --- Load the Time Zone Tables."
6773      * If you have trouble getting the server to start, see Section
6774        2.12.1.3, "Starting and Troubleshooting the MySQL Server."
6776      * When you are ready to create additional user accounts, you can
6777        find information on the MySQL access control system and
6778        account management in Section 6.2, "The MySQL Access Privilege
6779        System," and Section 6.3, "MySQL User Account Management."
6781 2.12.1. Unix Postinstallation Procedures
6783    After installing MySQL on Unix, you must initialize the grant
6784    tables, start the server, and make sure that the server works
6785    satisfactorily. You may also wish to arrange for the server to be
6786    started and stopped automatically when your system starts and
6787    stops. You should also assign passwords to the accounts in the
6788    grant tables.
6790    On Unix, the grant tables are set up by the mysql_install_db
6791    program. For some installation methods, this program is run for
6792    you automatically if an existing database cannot be found.
6794      * If you install MySQL on Linux using RPM distributions, the
6795        server RPM runs mysql_install_db.
6797      * Using the native packaging system on many platforms, including
6798        Debian Linux, Ubuntu Linux, Gentoo Linux and others, the
6799        mysql_install_db command is run for you.
6801      * If you install MySQL on Mac OS X using a DMG distribution, the
6802        installer runs mysql_install_db.
6804    For other platforms and installation types, including generic
6805    binary and source installs, you will need to run mysql_install_db
6806    yourself.
6808    The following procedure describes how to initialize the grant
6809    tables (if that has not previously been done) and start the
6810    server. It also suggests some commands that you can use to test
6811    whether the server is accessible and working properly. For
6812    information about starting and stopping the server automatically,
6813    see Section 2.12.1.2, "Starting and Stopping MySQL Automatically."
6815    After you complete the procedure and have the server running, you
6816    should assign passwords to the accounts created by
6817    mysql_install_db and perhaps restrict access to test databases.
6818    For instructions, see Section 2.12.2, "Securing the Initial MySQL
6819    Accounts."
6821    In the examples shown here, the server runs under the user ID of
6822    the mysql login account. This assumes that such an account exists.
6823    Either create the account if it does not exist, or substitute the
6824    name of a different existing login account that you plan to use
6825    for running the server. For information about creating the
6826    account, see Creating a mysql System User and Group, in Section
6827    2.2, "Installing MySQL on Unix/Linux Using Generic Binaries."
6829     1. Change location into the top-level directory of your MySQL
6830        installation, represented here by BASEDIR:
6831 shell> cd BASEDIR
6832        BASEDIR is the installation directory for your MySQL instance.
6833        It is likely to be something like /usr/local/mysql or
6834        /usr/local. The following steps assume that you have changed
6835        location to this directory.
6836        You will find several files and subdirectories in the BASEDIR
6837        directory. The most important for installation purposes are
6838        the bin and scripts subdirectories:
6840           + The bin directory contains client programs and the
6841             server. You should add the full path name of this
6842             directory to your PATH environment variable so that your
6843             shell finds the MySQL programs properly. See Section
6844             2.14, "Environment Variables."
6845             For some distribution types, mysqld is installed in the
6846             libexec directory.
6848           + The scripts directory contains the mysql_install_db
6849             script used to initialize the mysql database containing
6850             the grant tables that store the server access
6851             permissions.
6852             For some distribution types, mysql_install_db is
6853             installed in the bin directory.
6855     2. If necessary, ensure that the distribution contents are
6856        accessible to mysql. If you installed the distribution as
6857        mysql, no further action is required. If you installed the
6858        distribution as root, its contents will be owned by root.
6859        Change its ownership to mysql by executing the following
6860        commands as root in the installation directory. The first
6861        command changes the owner attribute of the files to the mysql
6862        user. The second changes the group attribute to the mysql
6863        group.
6864 shell> chown -R mysql .
6865 shell> chgrp -R mysql .
6867     3. If necessary, run the mysql_install_db program to set up the
6868        initial MySQL grant tables containing the privileges that
6869        determine how users are permitted to connect to the server.
6870        You will need to do this if you used a distribution type for
6871        which the installation procedure does not run the program for
6872        you.
6873        Typically, mysql_install_db needs to be run only the first
6874        time you install MySQL, so you can skip this step if you are
6875        upgrading an existing installation, However, mysql_install_db
6876        does not overwrite any existing privilege tables, so it should
6877        be safe to run in any circumstances.
6878        The exact location of mysql_install_db depends on the layout
6879        for your given installation. To initialize the grant tables,
6880        use one of the following commands, depending on whether
6881        mysql_install_db is located in the bin or scripts directory:
6882 shell> scripts/mysql_install_db --user=mysql
6883 shell> bin/mysql_install_db --user=mysql
6884        It might be necessary to specify other options such as
6885        --basedir or --datadir if mysql_install_db does not identify
6886        the correct locations for the installation directory or data
6887        directory. For example:
6888 shell> scripts/mysql_install_db --user=mysql \
6889          --basedir=/opt/mysql/mysql \
6890          --datadir=/opt/mysql/mysql/data
6891        The mysql_install_db script creates the server's data
6892        directory with mysql as the owner. Under the data directory,
6893        it creates directories for the mysql database that holds the
6894        grant tables and the test database that you can use to test
6895        MySQL. The script also creates privilege table entries for
6896        root and anonymous-user accounts. The accounts have no
6897        passwords initially. Section 2.12.2, "Securing the Initial
6898        MySQL Accounts," describes the initial privileges. Briefly,
6899        these privileges permit the MySQL root user to do anything,
6900        and permit anybody to create or use databases with a name of
6901        test or starting with test_. See Section 6.2, "The MySQL
6902        Access Privilege System," for a complete listing and
6903        description of the grant tables.
6904        It is important to make sure that the database directories and
6905        files are owned by the mysql login account so that the server
6906        has read and write access to them when you run it later. To
6907        ensure this if you run mysql_install_db as root, include the
6908        --user option as shown. Otherwise, you should execute the
6909        script while logged in as mysql, in which case you can omit
6910        the --user option from the command.
6911        If you do not want to have the test database, you can remove
6912        it after starting the server, using the instructions in
6913        Section 2.12.2, "Securing the Initial MySQL Accounts."
6914        If you have trouble with mysql_install_db at this point, see
6915        Section 2.12.1.1, "Problems Running mysql_install_db."
6917     4. Most of the MySQL installation can be owned by root if you
6918        like. The exception is that the data directory must be owned
6919        by mysql. To accomplish this, run the following commands as
6920        root in the installation directory. For some distribution
6921        types, the data directory might be named var rather than data;
6922        adjust the second command accordingly.
6923 shell> chown -R root .
6924 shell> chown -R mysql data
6926     5. If the plugin directory (the directory named by the plugin_dir
6927        system variable) is writable by the server, it may be possible
6928        for a user to write executable code to a file in the directory
6929        using SELECT ... INTO DUMPFILE. This can be prevented by
6930        making plugin_dir read only to the server or by setting
6931        --secure-file-priv to a directory where SELECT writes can be
6932        made safely.
6934     6. If you installed MySQL using a source distribution, you may
6935        want to optionally copy one of the provided configuration
6936        files from the support-files directory into your /etc
6937        directory. There are different sample configuration files for
6938        different use cases, server types, and CPU and RAM
6939        configurations. If you want to use one of these standard
6940        files, you should copy it to /etc/my.cnf, or /etc/mysql/my.cnf
6941        and edit and check the configuration before starting your
6942        MySQL server for the first time.
6943        If you do not copy one of the standard configuration files,
6944        the MySQL server will be started with the default settings.
6945        If you want MySQL to start automatically when you boot your
6946        machine, you can copy support-files/mysql.server to the
6947        location where your system has its startup files. More
6948        information can be found in the mysql.server script itself,
6949        and in Section 2.12.1.2, "Starting and Stopping MySQL
6950        Automatically."
6952     7. Start the MySQL server:
6953 shell> bin/mysqld_safe --user=mysql &
6954        It is important that the MySQL server be run using an
6955        unprivileged (non-root) login account. To ensure this if you
6956        run mysqld_safe as root, include the --user option as shown.
6957        Otherwise, you should execute the script while logged in as
6958        mysql, in which case you can omit the --user option from the
6959        command.
6960        For further instructions for running MySQL as an unprivileged
6961        user, see Section 6.1.5, "How to Run MySQL as a Normal User."
6962        If the command fails immediately and prints mysqld ended, look
6963        for information in the error log (which by default is the
6964        host_name.err file in the data directory).
6965        If you neglected to create the grant tables by running
6966        mysql_install_db before proceeding to this step, the following
6967        message appears in the error log file when you start the
6968        server:
6969 mysqld: Can't find file: 'host.frm'
6970        This error also occurs if you run mysql_install_db as root
6971        without the --user option. Remove the data directory and run
6972        mysql_install_db with the --user option as described
6973        previously.
6974        If you have other problems starting the server, see Section
6975        2.12.1.3, "Starting and Troubleshooting the MySQL Server." For
6976        more information about mysqld_safe, see Section 4.3.2,
6977        "mysqld_safe --- MySQL Server Startup Script."
6979     8. Use mysqladmin to verify that the server is running. The
6980        following commands provide simple tests to check whether the
6981        server is up and responding to connections:
6982 shell> bin/mysqladmin version
6983 shell> bin/mysqladmin variables
6984        The output from mysqladmin version varies slightly depending
6985        on your platform and version of MySQL, but should be similar
6986        to that shown here:
6987 shell> bin/mysqladmin version
6988 mysqladmin  Ver 14.12 Distrib 5.1.74, for pc-linux-gnu on i686
6991 Server version          5.1.74
6992 Protocol version        10
6993 Connection              Localhost via UNIX socket
6994 UNIX socket             /var/lib/mysql/mysql.sock
6995 Uptime:                 14 days 5 hours 5 min 21 sec
6997 Threads: 1  Questions: 366  Slow queries: 0
6998 Opens: 0  Flush tables: 1  Open tables: 19
6999 Queries per second avg: 0.000
7000        To see what else you can do with mysqladmin, invoke it with
7001        the --help option.
7003     9. Verify that you can shut down the server:
7004 shell> bin/mysqladmin -u root shutdown
7005    10. Verify that you can start the server again. Do this by using
7006        mysqld_safe or by invoking mysqld directly. For example:
7007 shell> bin/mysqld_safe --user=mysql &
7008        If mysqld_safe fails, see Section 2.12.1.3, "Starting and
7009        Troubleshooting the MySQL Server."
7010    11. Run some simple tests to verify that you can retrieve
7011        information from the server. The output should be similar to
7012        what is shown here:
7013 shell> bin/mysqlshow
7014 +--------------------+
7015 |     Databases      |
7016 +--------------------+
7017 | information_schema |
7018 | mysql              |
7019 | test               |
7020 +--------------------+
7022 shell> bin/mysqlshow mysql
7023 Database: mysql
7024 +---------------------------+
7025 |          Tables           |
7026 +---------------------------+
7027 | columns_priv              |
7028 | db                        |
7029 | event                     |
7030 | func                      |
7031 | help_category             |
7032 | help_keyword              |
7033 | help_relation             |
7034 | help_topic                |
7035 | host                      |
7036 | plugin                    |
7037 | proc                      |
7038 | procs_priv                |
7039 | servers                   |
7040 | tables_priv               |
7041 | time_zone                 |
7042 | time_zone_leap_second     |
7043 | time_zone_name            |
7044 | time_zone_transition      |
7045 | time_zone_transition_type |
7046 | user                      |
7047 +---------------------------+
7049 shell> bin/mysql -e "SELECT Host,Db,User FROM db" mysql
7050 +------+--------+------+
7051 | host | db     | user |
7052 +------+--------+------+
7053 | %    | test   |      |
7054 | %    | test_% |      |
7055 +------+--------+------+
7056    12. There is a benchmark suite in the sql-bench directory (under
7057        the MySQL installation directory) that you can use to compare
7058        how MySQL performs on different platforms. The benchmark suite
7059        is written in Perl. It requires the Perl DBI module that
7060        provides a database-independent interface to the various
7061        databases, and some other additional Perl modules:
7063 DBD::mysql
7064 Data::Dumper
7065 Data::ShowTable
7066        These modules can be obtained from CPAN
7067        (http://www.cpan.org/). See also Section 2.15.1, "Installing
7068        Perl on Unix."
7069        The sql-bench/Results directory contains the results from many
7070        runs against different databases and platforms. To run all
7071        tests, execute these commands:
7072 shell> cd sql-bench
7073 shell> perl run-all-tests
7074        If you do not have the sql-bench directory, you probably
7075        installed MySQL using RPM files other than the source RPM.
7076        (The source RPM includes the sql-bench benchmark directory.)
7077        In this case, you must first install the benchmark suite
7078        before you can use it. There are separate benchmark RPM files
7079        named mysql-bench-VERSION.i386.rpm that contain benchmark code
7080        and data.
7081        If you have a source distribution, there are also tests in its
7082        tests subdirectory that you can run. For example, to run
7083        auto_increment.tst, execute this command from the top-level
7084        directory of your source distribution:
7085 shell> mysql -vvf test < ./tests/auto_increment.tst
7086        The expected result of the test can be found in the
7087        ./tests/auto_increment.res file.
7088    13. At this point, you should have the server running. However,
7089        none of the initial MySQL accounts have a password, and the
7090        server permits permissive access to test databases. To tighten
7091        security, follow the instructions in Section 2.12.2, "Securing
7092        the Initial MySQL Accounts."
7094    The MySQL 5.1 installation procedure creates time zone tables in
7095    the mysql database but does not populate them. To do so, use the
7096    instructions in Section 10.6, "MySQL Server Time Zone Support."
7098    To make it more convenient to invoke programs installed in the bin
7099    directory under the installation directory, you can add that
7100    directory to your PATH environment variable setting. That enables
7101    you to run a program by typing only its name, not its entire path
7102    name. See Section 4.2.4, "Setting Environment Variables."
7104    You can set up new accounts using the bin/mysql_setpermission
7105    script if you install the DBI and DBD::mysql Perl modules. See
7106    Section 4.6.14, "mysql_setpermission --- Interactively Set
7107    Permissions in Grant Tables." For Perl module installation
7108    instructions, see Section 2.15, "Perl Installation Notes."
7110    If you would like to use mysqlaccess and have the MySQL
7111    distribution in some nonstandard location, you must change the
7112    location where mysqlaccess expects to find the mysql client. Edit
7113    the bin/mysqlaccess script at approximately line 18. Search for a
7114    line that looks like this:
7115 $MYSQL     = '/usr/local/bin/mysql';    # path to mysql executable
7117    Change the path to reflect the location where mysql actually is
7118    stored on your system. If you do not do this, a Broken pipe error
7119    will occur when you run mysqlaccess.
7121 2.12.1.1. Problems Running mysql_install_db
7123    The purpose of the mysql_install_db script is to generate new
7124    MySQL privilege tables. It does not overwrite existing MySQL
7125    privilege tables, and it does not affect any other data.
7127    If you want to re-create your privilege tables, first stop the
7128    mysqld server if it is running. Then rename the mysql directory
7129    under the data directory to save it, and then run
7130    mysql_install_db. Suppose that your current directory is the MySQL
7131    installation directory and that mysql_install_db is located in the
7132    bin directory and the data directory is named data. To rename the
7133    mysql database and re-run mysql_install_db, use these commands.
7134 shell> mv data/mysql data/mysql.old
7135 shell> scripts/mysql_install_db --user=mysql
7137    When you run mysql_install_db, you might encounter the following
7138    problems:
7140      * mysql_install_db fails to install the grant tables
7141        You may find that mysql_install_db fails to install the grant
7142        tables and terminates after displaying the following messages:
7143 Starting mysqld daemon with databases from XXXXXX
7144 mysqld ended
7145        In this case, you should examine the error log file very
7146        carefully. The log should be located in the directory XXXXXX
7147        named by the error message and should indicate why mysqld did
7148        not start. If you do not understand what happened, include the
7149        log when you post a bug report. See Section 1.7, "How to
7150        Report Bugs or Problems."
7152      * There is a mysqld process running
7153        This indicates that the server is running, in which case the
7154        grant tables have probably been created already. If so, there
7155        is no need to run mysql_install_db at all because it needs to
7156        be run only once (when you install MySQL the first time).
7158      * Installing a second mysqld server does not work when one
7159        server is running
7160        This can happen when you have an existing MySQL installation,
7161        but want to put a new installation in a different location.
7162        For example, you might have a production installation, but you
7163        want to create a second installation for testing purposes.
7164        Generally the problem that occurs when you try to run a second
7165        server is that it tries to use a network interface that is in
7166        use by the first server. In this case, you should see one of
7167        the following error messages:
7168 Can't start server: Bind on TCP/IP port:
7169 Address already in use
7170 Can't start server: Bind on unix socket...
7171        For instructions on setting up multiple servers, see Section
7172        5.3, "Running Multiple MySQL Instances on One Machine."
7174      * You do not have write access to the /tmp directory
7175        If you do not have write access to create temporary files or a
7176        Unix socket file in the default location (the /tmp directory)
7177        or the TMP_DIR environment variable, if it has been set, an
7178        error occurs when you run mysql_install_db or the mysqld
7179        server.
7180        You can specify different locations for the temporary
7181        directory and Unix socket file by executing these commands
7182        prior to starting mysql_install_db or mysqld, where
7183        some_tmp_dir is the full path name to some directory for which
7184        you have write permission:
7185 shell> TMPDIR=/some_tmp_dir/
7186 shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysql.sock
7187 shell> export TMPDIR MYSQL_UNIX_PORT
7188        Then you should be able to run mysql_install_db and start the
7189        server with these commands:
7190 shell> scripts/mysql_install_db --user=mysql
7191 shell> bin/mysqld_safe --user=mysql &
7192        If mysql_install_db is located in the bin directory, modify
7193        the first command to bin/mysql_install_db.
7194        See Section C.5.4.5, "How to Protect or Change the MySQL Unix
7195        Socket File," and Section 2.14, "Environment Variables."
7197    There are some alternatives to running the mysql_install_db script
7198    provided in the MySQL distribution:
7200      * If you want the initial privileges to be different from the
7201        standard defaults, you can modify mysql_install_db before you
7202        run it. However, it is preferable to use GRANT and REVOKE to
7203        change the privileges after the grant tables have been set up.
7204        In other words, you can run mysql_install_db, and then use
7205        mysql -u root mysql to connect to the server as the MySQL root
7206        user so that you can issue the necessary GRANT and REVOKE
7207        statements.
7208        If you want to install MySQL on several machines with the same
7209        privileges, you can put the GRANT and REVOKE statements in a
7210        file and execute the file as a script using mysql after
7211        running mysql_install_db. For example:
7212 shell> scripts/mysql_install_db --user=mysql
7213 shell> bin/mysql -u root < your_script_file
7214        By doing this, you can avoid having to issue the statements
7215        manually on each machine.
7217      * It is possible to re-create the grant tables completely after
7218        they have previously been created. You might want to do this
7219        if you are just learning how to use GRANT and REVOKE and have
7220        made so many modifications after running mysql_install_db that
7221        you want to wipe out the tables and start over.
7222        To re-create the grant tables, remove all the .frm, .MYI, and
7223        .MYD files in the mysql database directory. Then run the
7224        mysql_install_db script again.
7226      * You can start mysqld manually using the --skip-grant-tables
7227        option and add the privilege information yourself using mysql:
7228 shell> bin/mysqld_safe --user=mysql --skip-grant-tables &
7229 shell> bin/mysql mysql
7230        From mysql, manually execute the SQL commands contained in
7231        mysql_install_db. Make sure that you run mysqladmin
7232        flush-privileges or mysqladmin reload afterward to tell the
7233        server to reload the grant tables.
7234        Note that by not using mysql_install_db, you not only have to
7235        populate the grant tables manually, you also have to create
7236        them first.
7238 2.12.1.2. Starting and Stopping MySQL Automatically
7240    Generally, you start the mysqld server in one of these ways:
7242      * Invoke mysqld directly. This works on any platform.
7244      * Invoke mysqld_safe, which tries to determine the proper
7245        options for mysqld and then runs it with those options. This
7246        script is used on Unix and Unix-like systems. See Section
7247        4.3.2, "mysqld_safe --- MySQL Server Startup Script."
7249      * Invoke mysql.server. This script is used primarily at system
7250        startup and shutdown on systems that use System V-style run
7251        directories (that is, /etc/init.d and run-level specific
7252        directories), where it usually is installed under the name
7253        mysql. The mysql.server script starts the server by invoking
7254        mysqld_safe. See Section 4.3.3, "mysql.server --- MySQL Server
7255        Startup Script."
7257      * On Mac OS X, install a separate MySQL Startup Item package to
7258        enable the automatic startup of MySQL on system startup. The
7259        Startup Item starts the server by invoking mysql.server. See
7260        Section 2.4.3, "Installing the MySQL Startup Item," for
7261        details. A MySQL Preference Pane also provides control for
7262        starting and stopping MySQL through the System Preferences,
7263        see Section 2.4.4, "Installing and Using the MySQL Preference
7264        Pane."
7266      * Use the Solaris/OpenSolaris service management framework (SMF)
7267        system to initiate and control MySQL startup. For more
7268        information, see Section 2.6.2, "Installing MySQL on
7269        OpenSolaris Using IPS."
7271    The mysqld_safe and mysql.server scripts, Solaris/OpenSolaris SMF,
7272    and the Mac OS X Startup Item (or MySQL Preference Pane) can be
7273    used to start the server manually, or automatically at system
7274    startup time. mysql.server and the Startup Item also can be used
7275    to stop the server.
7277    To start or stop the server manually using the mysql.server
7278    script, invoke it with start or stop arguments:
7279 shell> mysql.server start
7280 shell> mysql.server stop
7282    Before mysql.server starts the server, it changes location to the
7283    MySQL installation directory, and then invokes mysqld_safe. If you
7284    want the server to run as some specific user, add an appropriate
7285    user option to the [mysqld] group of the /etc/my.cnf option file,
7286    as shown later in this section. (It is possible that you will need
7287    to edit mysql.server if you've installed a binary distribution of
7288    MySQL in a nonstandard location. Modify it to change location into
7289    the proper directory before it runs mysqld_safe. If you do this,
7290    your modified version of mysql.server may be overwritten if you
7291    upgrade MySQL in the future, so you should make a copy of your
7292    edited version that you can reinstall.)
7294    mysql.server stop stops the server by sending a signal to it. You
7295    can also stop the server manually by executing mysqladmin
7296    shutdown.
7298    To start and stop MySQL automatically on your server, you need to
7299    add start and stop commands to the appropriate places in your
7300    /etc/rc* files.
7302    If you use the Linux server RPM package
7303    (MySQL-server-VERSION.rpm), or a native Linux package
7304    installation, the mysql.server script may be installed in the
7305    /etc/init.d directory with the name mysql. See Section 2.5.1,
7306    "Installing MySQL on Linux Using RPM Packages," for more
7307    information on the Linux RPM packages.
7309    Some vendors provide RPM packages that install a startup script
7310    under a different name such as mysqld.
7312    If you install MySQL from a source distribution or using a binary
7313    distribution format that does not install mysql.server
7314    automatically, you can install it manually. The script can be
7315    found in the support-files directory under the MySQL installation
7316    directory or in a MySQL source tree.
7318    To install mysql.server manually, copy it to the /etc/init.d
7319    directory with the name mysql, and then make it executable. Do
7320    this by changing location into the appropriate directory where
7321    mysql.server is located and executing these commands:
7322 shell> cp mysql.server /etc/init.d/mysql
7323 shell> chmod +x /etc/init.d/mysql
7325    Note
7327    Older Red Hat systems use the /etc/rc.d/init.d directory rather
7328    than /etc/init.d. Adjust the preceding commands accordingly.
7329    Alternatively, first create /etc/init.d as a symbolic link that
7330    points to /etc/rc.d/init.d:
7331 shell> cd /etc
7332 shell> ln -s rc.d/init.d .
7334    After installing the script, the commands needed to activate it to
7335    run at system startup depend on your operating system. On Linux,
7336    you can use chkconfig:
7337 shell> chkconfig --add mysql
7339    On some Linux systems, the following command also seems to be
7340    necessary to fully enable the mysql script:
7341 shell> chkconfig --level 345 mysql on
7343    On FreeBSD, startup scripts generally should go in
7344    /usr/local/etc/rc.d/. The rc(8) manual page states that scripts in
7345    this directory are executed only if their basename matches the
7346    *.sh shell file name pattern. Any other files or directories
7347    present within the directory are silently ignored. In other words,
7348    on FreeBSD, you should install the mysql.server script as
7349    /usr/local/etc/rc.d/mysql.server.sh to enable automatic startup.
7351    As an alternative to the preceding setup, some operating systems
7352    also use /etc/rc.local or /etc/init.d/boot.local to start
7353    additional services on startup. To start up MySQL using this
7354    method, you could append a command like the one following to the
7355    appropriate startup file:
7356 /bin/sh -c 'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &'
7358    For other systems, consult your operating system documentation to
7359    see how to install startup scripts.
7361    You can add options for mysql.server in a global /etc/my.cnf file.
7362    A typical /etc/my.cnf file might look like this:
7363 [mysqld]
7364 datadir=/usr/local/mysql/var
7365 socket=/var/tmp/mysql.sock
7366 port=3306
7367 user=mysql
7369 [mysql.server]
7370 basedir=/usr/local/mysql
7372    The mysql.server script supports the following options: basedir,
7373    datadir, and pid-file. If specified, they must be placed in an
7374    option file, not on the command line. mysql.server supports only
7375    start and stop as command-line arguments.
7377    The following table shows which option groups the server and each
7378    startup script read from option files.
7380    Table 2.21. MySQL Startup scripts and supported server option
7381    groups
7382       Script                  Option Groups
7383    mysqld       [mysqld], [server], [mysqld-major_version]
7384    mysqld_safe  [mysqld], [server], [mysqld_safe]
7385    mysql.server [mysqld], [mysql.server], [server]
7387    [mysqld-major_version] means that groups with names like
7388    [mysqld-5.0] and [mysqld-5.1] are read by servers having versions
7389    5.0.x, 5.1.x, and so forth. This feature can be used to specify
7390    options that can be read only by servers within a given release
7391    series.
7393    For backward compatibility, mysql.server also reads the
7394    [mysql_server] group and mysqld_safe also reads the [safe_mysqld]
7395    group. However, you should update your option files to use the
7396    [mysql.server] and [mysqld_safe] groups instead when using MySQL
7397    5.1.
7399    For more information on MySQL configuration files and their
7400    structure and contents, see Section 4.2.3.3, "Using Option Files."
7402 2.12.1.3. Starting and Troubleshooting the MySQL Server
7404    This section provides troubleshooting suggestions for problems
7405    starting the server on Unix. If you are using Windows, see Section
7406    2.3.7, "Troubleshooting a Microsoft Windows MySQL Server
7407    Installation."
7409    If you have problems starting the server, here are some things to
7410    try:
7412      * Check the error log to see why the server does not start.
7414      * Specify any special options needed by the storage engines you
7415        are using.
7417      * Make sure that the server knows where to find the data
7418        directory.
7420      * Make sure that the server can access the data directory. The
7421        ownership and permissions of the data directory and its
7422        contents must be set such that the server can read and modify
7423        them.
7425      * Verify that the network interfaces the server wants to use are
7426        available.
7428    Some storage engines have options that control their behavior. You
7429    can create a my.cnf file and specify startup options for the
7430    engines that you plan to use. If you are going to use storage
7431    engines that support transactional tables (InnoDB, NDB), be sure
7432    that you have them configured the way you want before starting the
7433    server:
7435    If you are using InnoDB tables, see Section 14.6.1, "Configuring
7436    InnoDB."
7438    If you are using MySQL Cluster, see Section 17.3, "Configuration
7439    of MySQL Cluster NDB 6.1-7.1."
7441    Storage engines will use default option values if you specify
7442    none, but it is recommended that you review the available options
7443    and specify explicit values for those for which the defaults are
7444    not appropriate for your installation.
7446    When the mysqld server starts, it changes location to the data
7447    directory. This is where it expects to find databases and where it
7448    expects to write log files. The server also writes the pid
7449    (process ID) file in the data directory.
7451    The data directory location is hardwired in when the server is
7452    compiled. This is where the server looks for the data directory by
7453    default. If the data directory is located somewhere else on your
7454    system, the server will not work properly. You can determine what
7455    the default path settings are by invoking mysqld with the
7456    --verbose and --help options.
7458    If the default locations do not match the MySQL installation
7459    layout on your system, you can override them by specifying options
7460    to mysqld or mysqld_safe on the command line or in an option file.
7462    To specify the location of the data directory explicitly, use the
7463    --datadir option. However, normally you can tell mysqld the
7464    location of the base directory under which MySQL is installed and
7465    it looks for the data directory there. You can do this with the
7466    --basedir option.
7468    To check the effect of specifying path options, invoke mysqld with
7469    those options followed by the --verbose and --help options. For
7470    example, if you change location into the directory where mysqld is
7471    installed and then run the following command, it shows the effect
7472    of starting the server with a base directory of /usr/local:
7473 shell> ./mysqld --basedir=/usr/local --verbose --help
7475    You can specify other options such as --datadir as well, but
7476    --verbose and --help must be the last options.
7478    Once you determine the path settings you want, start the server
7479    without --verbose and --help.
7481    If mysqld is currently running, you can find out what path
7482    settings it is using by executing this command:
7483 shell> mysqladmin variables
7485    Or:
7486 shell> mysqladmin -h host_name variables
7488    host_name is the name of the MySQL server host.
7490    If you get Errcode 13 (which means Permission denied) when
7491    starting mysqld, this means that the privileges of the data
7492    directory or its contents do not permit server access. In this
7493    case, you change the permissions for the involved files and
7494    directories so that the server has the right to use them. You can
7495    also start the server as root, but this raises security issues and
7496    should be avoided.
7498    On Unix, change location into the data directory and check the
7499    ownership of the data directory and its contents to make sure the
7500    server has access. For example, if the data directory is
7501    /usr/local/mysql/var, use this command:
7502 shell> ls -la /usr/local/mysql/var
7504    If the data directory or its files or subdirectories are not owned
7505    by the login account that you use for running the server, change
7506    their ownership to that account. If the account is named mysql,
7507    use these commands:
7508 shell> chown -R mysql /usr/local/mysql/var
7509 shell> chgrp -R mysql /usr/local/mysql/var
7511    If it possible that even with correct ownership, MySQL may fail to
7512    start up if there is other security software running on your
7513    system that manages application access to various parts of the
7514    file system. In this case, you may need to reconfigure that
7515    software to enable mysqld to access the directories it uses during
7516    normal operation.
7518    If the server fails to start up correctly, check the error log.
7519    Log files are located in the data directory (typically C:\Program
7520    Files\MySQL\MySQL Server 5.1\data on Windows,
7521    /usr/local/mysql/data for a Unix binary distribution, and
7522    /usr/local/var for a Unix source distribution). Look in the data
7523    directory for files with names of the form host_name.err and
7524    host_name.log, where host_name is the name of your server host.
7525    Then examine the last few lines of these files. On Unix, you can
7526    use tail to display them:
7527 shell> tail host_name.err
7528 shell> tail host_name.log
7530    The error log should contain information that indicates why the
7531    server could not start.
7533    If either of the following errors occur, it means that some other
7534    program (perhaps another mysqld server) is using the TCP/IP port
7535    or Unix socket file that mysqld is trying to use:
7536 Can't start server: Bind on TCP/IP port: Address already in use
7537 Can't start server: Bind on unix socket...
7539    Use ps to determine whether you have another mysqld server
7540    running. If so, shut down the server before starting mysqld again.
7541    (If another server is running, and you really want to run multiple
7542    servers, you can find information about how to do so in Section
7543    5.3, "Running Multiple MySQL Instances on One Machine.")
7545    If no other server is running, try to execute the command telnet
7546    your_host_name tcp_ip_port_number. (The default MySQL port number
7547    is 3306.) Then press Enter a couple of times. If you do not get an
7548    error message like telnet: Unable to connect to remote host:
7549    Connection refused, some other program is using the TCP/IP port
7550    that mysqld is trying to use. You will need to track down what
7551    program this is and disable it, or else tell mysqld to listen to a
7552    different port with the --port option. In this case, you will also
7553    need to specify the port number for client programs when
7554    connecting to the server using TCP/IP.
7556    Another reason the port might be inaccessible is that you have a
7557    firewall running that blocks connections to it. If so, modify the
7558    firewall settings to permit access to the port.
7560    If the server starts but you cannot connect to it, you should make
7561    sure that you have an entry in /etc/hosts that looks like this:
7562 127.0.0.1       localhost
7564    If you cannot get mysqld to start, you can try to make a trace
7565    file to find the problem by using the --debug option. See Section
7566    22.4.3, "The DBUG Package."
7568 2.12.2. Securing the Initial MySQL Accounts
7570    Part of the MySQL installation process is to set up the mysql
7571    database that contains the grant tables:
7573      * Windows distributions contain preinitialized grant tables.
7575      * On Unix, the mysql_install_db program populates the grant
7576        tables. Some installation methods run this program for you.
7577        Others require that you execute it manually. For details, see
7578        Section 2.12.1, "Unix Postinstallation Procedures."
7580    The mysql.user grant table defines the initial MySQL user accounts
7581    and their access privileges:
7583      * Some accounts have the user name root. These are superuser
7584        accounts that have all privileges and can do anything. The
7585        initial root account passwords are empty, so anyone can
7586        connect to the MySQL server as root without a password and be
7587        granted all privileges.
7589           + On Windows, root accounts are created that permit
7590             connections from the local host only. Connections can be
7591             made by specifying the host name localhost or the IP
7592             address 127.0.0.1. If the user selects the Enable root
7593             access from remote machines option during installation,
7594             the Windows installer creates another root account that
7595             permits connections from any host.
7597           + On Unix, each root account permits connections from the
7598             local host. Connections can be made by specifying the
7599             host name localhost, the IP address 127.0.0.1, or the
7600             actual host name or IP address.
7601        An attempt to connect to the host 127.0.0.1 normally resolves
7602        to the localhost account. However, this fails if the server is
7603        run with the --skip-name-resolve option, so the 127.0.0.1
7604        account is useful in that case.
7606      * Some accounts are for anonymous users. These have an empty
7607        user name. The anonymous accounts have no password, so anyone
7608        can use them to connect to the MySQL server.
7610           + On Windows, there is one anonymous account that permits
7611             connections from the local host. Connections can be made
7612             by specifying a host name of localhost. The account has
7613             no global privileges. (Before MySQL 5.1.16, it has all
7614             global privileges, just like the root accounts.)
7616           + On Unix, each anonymous account permits connections from
7617             the local host. Connections can be made by specifying a
7618             host name of localhost for one of the accounts, or the
7619             actual host name or IP address for the other.
7621    To display which accounts exist in the mysql.user table and check
7622    whether their passwords are empty, use the following statement:
7623 mysql> SELECT User, Host, Password FROM mysql.user;
7624 +------+--------------------+----------+
7625 | User | Host               | Password |
7626 +------+--------------------+----------+
7627 | root | localhost          |          |
7628 | root | myhost.example.com |          |
7629 | root | 127.0.0.1          |          |
7630 |      | localhost          |          |
7631 |      | myhost.example.com |          |
7632 +------+--------------------+----------+
7634    This output indicates that there are several root and
7635    anonymous-user accounts, none of which have passwords. The output
7636    might differ on your system, but the presence of accounts with
7637    empty passwords means that your MySQL installation is unprotected
7638    until you do something about it:
7640      * You should assign a password to each MySQL root account.
7642      * If you want to prevent clients from connecting as anonymous
7643        users without a password, you should either assign a password
7644        to each anonymous account or else remove the accounts.
7646    In addition, the mysql.db table contains rows that permit all
7647    accounts to access the test database and other databases with
7648    names that start with test_. This is true even for accounts that
7649    otherwise have no special privileges such as the default anonymous
7650    accounts. This is convenient for testing but inadvisable on
7651    production servers. Administrators who want database access
7652    restricted only to accounts that have permissions granted
7653    explicitly for that purpose should remove these mysql.db table
7654    rows.
7656    The following instructions describe how to set up passwords for
7657    the initial MySQL accounts, first for the root accounts, then for
7658    the anonymous accounts. The instructions also cover how to remove
7659    the anonymous accounts, should you prefer not to permit anonymous
7660    access at all, and describe how to remove permissive access to
7661    test databases. Replace newpwd in the examples with the password
7662    that you want to use. Replace host_name with the name of the
7663    server host. You can determine this name from the output of the
7664    preceding SELECT statement. For the output shown, host_name is
7665    myhost.example.com.
7666    Note
7668    For additional information about setting passwords, see Section
7669    6.3.5, "Assigning Account Passwords." If you forget your root
7670    password after setting it, see Section C.5.4.1, "How to Reset the
7671    Root Password."
7673    You might want to defer setting the passwords until later, to
7674    avoid the need to specify them while you perform additional setup
7675    or testing. However, be sure to set them before using your
7676    installation for production purposes.
7678    To set up additional accounts, see Section 6.3.2, "Adding User
7679    Accounts."
7681 Assigning root Account Passwords
7683    The root account passwords can be set several ways. The following
7684    discussion demonstrates three methods:
7686      * Use the SET PASSWORD statement
7688      * Use the UPDATE statement
7690      * Use the mysqladmin command-line client program
7692    To assign passwords using SET PASSWORD, connect to the server as
7693    root and issue a SET PASSWORD statement for each root account
7694    listed in the mysql.user table. Be sure to encrypt the password
7695    using the PASSWORD() function.
7697    For Windows, do this:
7698 shell> mysql -u root
7699 mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
7700 mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd');
7701 mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd');
7703    The last statement is unnecessary if the mysql.user table has no
7704    root account with a host value of %.
7706    For Unix, do this:
7707 shell> mysql -u root
7708 mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
7709 mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd');
7710 mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');
7712    You can also use a single statement that assigns a password to all
7713    root accounts by using UPDATE to modify the mysql.user table
7714    directly. This method works on any platform:
7715 shell> mysql -u root
7716 mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
7717     ->     WHERE User = 'root';
7718 mysql> FLUSH PRIVILEGES;
7720    The FLUSH statement causes the server to reread the grant tables.
7721    Without it, the password change remains unnoticed by the server
7722    until you restart it.
7724    To assign passwords to the root accounts using mysqladmin, execute
7725    the following commands:
7726 shell> mysqladmin -u root password "newpwd"
7727 shell> mysqladmin -u root -h host_name password "newpwd"
7729    Those commands apply both to Windows and to Unix. The double
7730    quotation marks around the password are not always necessary, but
7731    you should use them if the password contains spaces or other
7732    characters that are special to your command interpreter.
7734    The mysqladmin method of setting the root account passwords does
7735    not work for the 'root'@'127.0.0.1' account. Use the SET PASSWORD
7736    method shown earlier.
7738    After the root passwords have been set, you must supply the
7739    appropriate password whenever you connect as root to the server.
7740    For example, to shut down the server with mysqladmin, use this
7741    command:
7742 shell> mysqladmin -u root -p shutdown
7743 Enter password: (enter root password here)
7745 Assigning Anonymous Account Passwords
7747    The mysql commands in the following instructions include a -p
7748    option based on the assumption that you have set the root account
7749    passwords using the preceding instructions and must specify that
7750    password when connecting to the server.
7752    To assign passwords to the anonymous accounts, connect to the
7753    server as root, then use either SET PASSWORD or UPDATE. Be sure to
7754    encrypt the password using the PASSWORD() function.
7756    To use SET PASSWORD on Windows, do this:
7757 shell> mysql -u root -p
7758 Enter password: (enter root password here)
7759 mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
7761    To use SET PASSWORD on Unix, do this:
7762 shell> mysql -u root -p
7763 Enter password: (enter root password here)
7764 mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
7765 mysql> SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd');
7767    To set the anonymous-user account passwords with a single UPDATE
7768    statement, do this (on any platform):
7769 shell> mysql -u root -p
7770 Enter password: (enter root password here)
7771 mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
7772     ->     WHERE User = '';
7773 mysql> FLUSH PRIVILEGES;
7775    The FLUSH statement causes the server to reread the grant tables.
7776    Without it, the password change remains unnoticed by the server
7777    until you restart it.
7779 Removing Anonymous Accounts
7781    If you prefer to remove any anonymous accounts rather than
7782    assigning them passwords, do so as follows on Windows:
7783 shell> mysql -u root -p
7784 Enter password: (enter root password here)
7785 mysql> DROP USER ''@'localhost';
7787    On Unix, remove the anonymous accounts like this:
7788 shell> mysql -u root -p
7789 Enter password: (enter root password here)
7790 mysql> DROP USER ''@'localhost';
7791 mysql> DROP USER ''@'host_name';
7793 Securing Test Databases
7795    By default, the mysql.db table contains rows that permit access by
7796    any user to the test database and other databases with names that
7797    start with test_. (These rows have an empty User column value,
7798    which for access-checking purposes matches any user name.) This
7799    means that such databases can be used even by accounts that
7800    otherwise possess no privileges. If you want to remove any-user
7801    access to test databases, do so as follows:
7802 shell> mysql -u root -p
7803 Enter password: (enter root password here)
7804 mysql> DELETE FROM mysql.db WHERE Db LIKE 'test%';
7805 mysql> FLUSH PRIVILEGES;
7807    The FLUSH statement causes the server to reread the grant tables.
7808    Without it, the privilege change remains unnoticed by the server
7809    until you restart it.
7811    With the preceding change, only users who have global database
7812    privileges or privileges granted explicitly for the test database
7813    can use it. However, if you do not want the database to exist at
7814    all, drop it:
7815 mysql> DROP DATABASE test;
7817    Note
7819    On Windows, you can also perform the process described in this
7820    section using the Configuration Wizard (see Section 2.3.5.11,
7821    "MySQL Server Instance Config Wizard: The Security Options
7822    Dialog"). On all platforms, the MySQL distribution includes
7823    mysql_secure_installation, a command-line utility that automates
7824    much of the process of securing a MySQL installation.
7826 2.13. Upgrading or Downgrading MySQL
7828 2.13.1. Upgrading MySQL
7830    As a general rule, to upgrade from one release series to another,
7831    go to the next series rather than skipping a series. To upgrade
7832    from a release series previous to MySQL 5.0, upgrade to each
7833    successive release series in turn until you have reached MySQL
7834    5.0, and then proceed with the upgrade to MySQL 5.1. For example,
7835    if you currently are running MySQL 4.1 and wish to upgrade to a
7836    newer series, upgrade to MySQL 5.0 first before upgrading to 5.1,
7837    and so forth. For information on upgrading to MySQL 5.0, see the
7838    MySQL 5.0 Reference Manual; for earlier releases, see the MySQL
7839    3.23, 4.0, 4.1 Reference Manual.
7841    If you perform a binary (in-place) upgrade without dumping and
7842    reloading tables, you cannot upgrade directly from MySQL 4.1 to
7843    5.1. This occurs due to an incompatible change in the MyISAM table
7844    index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
7845    repair all MyISAM tables (see Section 2.13.4, "Rebuilding or
7846    Repairing Tables or Indexes"). Then upgrade from MySQL 5.0 to 5.1
7847    and check and repair your tables.
7849    To upgrade from MySQL 5.0 to 5.1, use the items in the following
7850    checklist as a guide:
7852      * Before any upgrade, back up your databases, including the
7853        mysql database that contains the grant tables. See Section
7854        7.2, "Database Backup Methods."
7856      * Read all the notes in Section 2.13.1.1, "Upgrading from MySQL
7857        5.0 to 5.1." These notes enable you to identify upgrade issues
7858        that apply to your current MySQL installation. Some
7859        incompatibilities discussed in that section require your
7860        attention before upgrading. Others should be dealt with after
7861        upgrading.
7863      * Read the Release Notes
7864        (http://dev.mysql.com/doc/relnotes/mysql/5.1/en/) as well,
7865        which provide information about features that are new in MySQL
7866        5.1 or differ from those found in MySQL 5.0.
7868      * After upgrading to a new version of MySQL, run mysql_upgrade
7869        (see Section 4.4.8, "mysql_upgrade --- Check and Upgrade MySQL
7870        Tables"). This program checks your tables, and attempts to
7871        repair them if necessary. It also updates your grant tables to
7872        make sure that they have the current structure so that you can
7873        take advantage of any new capabilities. (Some releases of
7874        MySQL introduce changes to the structure of the grant tables
7875        to add new privileges or features.)
7876        mysql_upgrade does not upgrade the contents of the help
7877        tables. For upgrade instructions, see Section 5.1.9,
7878        "Server-Side Help."
7880      * If you run MySQL Server on Windows, see Section 2.3.8,
7881        "Upgrading MySQL Server on Microsoft Windows."
7883      * If you use replication, see Section 16.4.3, "Upgrading a
7884        Replication Setup," for information on upgrading your
7885        replication setup.
7887      * If you use InnoDB, consider setting innodb_fast_shutdown to 0
7888        before shutting down and upgrading your server. When you set
7889        innodb_fast_shutdown to 0, InnoDB does a slow shutdown, a full
7890        purge and an insert buffer merge before shutting down, which
7891        ensures that all data files are fully prepared in case the
7892        upgrade process modifies the file format.
7894      * If you upgrade an installation originally produced by
7895        installing multiple RPM packages, it is best to upgrade all
7896        the packages, not just some. For example, if you previously
7897        installed the server and client RPMs, do not upgrade just the
7898        server RPM.
7900      * As of MySQL 5.1.9, the mysqld-max server is included in binary
7901        distributions. There is no separate MySQL-Max distribution. As
7902        of MySQL 5.1.12, there is no mysqld-max server at all in
7903        binary distributions. They contain a server that includes the
7904        features previously included in mysqld-max.
7906      * If you have created a user-defined function (UDF) with a given
7907        name and upgrade MySQL to a version that implements a new
7908        built-in function with the same name, the UDF becomes
7909        inaccessible. To correct this, use DROP FUNCTION to drop the
7910        UDF, and then use CREATE FUNCTION to re-create the UDF with a
7911        different nonconflicting name. The same is true if the new
7912        version of MySQL implements a built-in function with the same
7913        name as an existing stored function. See Section 9.2.4,
7914        "Function Name Parsing and Resolution," for the rules
7915        describing how the server interprets references to different
7916        kinds of functions.
7918    For upgrades between versions of a MySQL release series that has
7919    reached General Availability status, you can move the MySQL format
7920    files and data files between different versions on systems with
7921    the same architecture. For upgrades to a version of a MySQL
7922    release series that is in development status, that is not
7923    necessarily true. Use of development releases is at your own risk.
7925    If you are cautious about using new versions, you can always
7926    rename your old mysqld before installing a newer one. For example,
7927    if you are using a version of MySQL 5.0 and want to upgrade to
7928    5.1, rename your current server from mysqld to mysqld-5.0. If your
7929    new mysqld then does something unexpected, you can simply shut it
7930    down and restart with your old mysqld.
7932    If problems occur, such as that the new mysqld server does not
7933    start or that you cannot connect without a password, verify that
7934    you do not have an old my.cnf file from your previous
7935    installation. You can check this with the --print-defaults option
7936    (for example, mysqld --print-defaults). If this command displays
7937    anything other than the program name, you have an active my.cnf
7938    file that affects server or client operation.
7940    If, after an upgrade, you experience problems with compiled client
7941    programs, such as Commands out of sync or unexpected core dumps,
7942    you probably have used old header or library files when compiling
7943    your programs. In this case, you should check the date for your
7944    mysql.h file and libmysqlclient.a library to verify that they are
7945    from the new MySQL distribution. If not, recompile your programs
7946    with the new headers and libraries. Recompilation might also be
7947    necessary for programs compiled against the shared client library
7948    if the library major version number has changed (for example from
7949    libmysqlclient.so.15 to libmysqlclient.so.16.
7951    If your MySQL installation contains a large amount of data that
7952    might take a long time to convert after an in-place upgrade, you
7953    might find it useful to create a "dummy" database instance for
7954    assessing what conversions might be needed and the work involved
7955    to perform them. Make a copy of your MySQL instance that contains
7956    a full copy of the mysql database, plus all other databases
7957    without data. Run your upgrade procedure on this dummy instance to
7958    see what actions might be needed so that you can better evaluate
7959    the work involved when performing actual data conversion on your
7960    original database instance.
7962    It is a good idea to rebuild and reinstall the Perl DBD::mysql
7963    module whenever you install a new release of MySQL. The same
7964    applies to other MySQL interfaces as well, such as PHP mysql
7965    extensions and the Python MySQLdb module.
7967 2.13.1.1. Upgrading from MySQL 5.0 to 5.1
7969    After upgrading a 5.0 installation to 5.0.10 or above, it is
7970    necessary to upgrade your grant tables. Otherwise, creating stored
7971    procedures and functions might not work. To perform this upgrade,
7972    run mysql_upgrade.
7973    Note
7975    It is good practice to back up your data before installing any new
7976    version of software. Although MySQL works very hard to ensure a
7977    high level of quality, you should protect your data by making a
7978    backup.
7980    To upgrade to 5.1 from any previous version, MySQL recommends that
7981    you dump your tables with mysqldump before upgrading and reload
7982    the dump file after upgrading. Use the --all-databases option to
7983    include all databases in the dump. If your databases include
7984    stored programs, use the --routines and --events options as well.
7986    If you perform a binary (in-place) upgrade without dumping and
7987    reloading tables, you cannot upgrade directly from MySQL 4.1 to
7988    5.1. This occurs due to an incompatible change in the MyISAM table
7989    index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
7990    repair all MyISAM tables (see Section 2.13.4, "Rebuilding or
7991    Repairing Tables or Indexes"). Then upgrade from MySQL 5.0 to 5.1
7992    and check and repair your tables.
7994    In general, you should do the following when upgrading from MySQL
7995    5.0 to 5.1:
7997      * Read all the items in these sections to see whether any of
7998        them might affect your applications:
8000           + Section 2.13.1, "Upgrading MySQL," has general update
8001             information.
8003           + The items in the change lists provided later in this
8004             section enable you to identify upgrade issues that apply
8005             to your current MySQL installation. Some
8006             incompatibilities discussed there require your attention
8007             before upgrading. Others should be dealt with after
8008             upgrading.
8010           + The MySQL 5.1 Release Notes
8011             (http://dev.mysql.com/doc/relnotes/mysql/5.1/en/)
8012             describe significant new features you can use in 5.1 or
8013             that differ from those found in MySQL 5.0. Some of these
8014             changes may result in incompatibilities.
8015        Note particularly any changes that are marked Known issue or
8016        Incompatible change. These incompatibilities with earlier
8017        versions of MySQL may require your attention before you
8018        upgrade. Our aim is to avoid these changes, but occasionally
8019        they are necessary to correct problems that would be worse
8020        than an incompatibility between releases. If any upgrade issue
8021        applicable to your installation involves an incompatibility
8022        that requires special handling, follow the instructions given
8023        in the incompatibility description. Sometimes this involves
8024        dumping and reloading tables, or use of a statement such as
8025        CHECK TABLE or REPAIR TABLE.
8026        For dump and reload instructions, see Section 2.13.4,
8027        "Rebuilding or Repairing Tables or Indexes." Any procedure
8028        that involves REPAIR TABLE with the USE_FRM option must be
8029        done before upgrading. Use of this statement with a version of
8030        MySQL different from the one used to create the table (that
8031        is, using it after upgrading) may damage the table. See
8032        Section 13.7.2.6, "REPAIR TABLE Syntax."
8034      * Before upgrading to a new version of MySQL, Section 2.13.3,
8035        "Checking Whether Tables or Indexes Must Be Rebuilt," to see
8036        whether changes to table formats or to character sets or
8037        collations were made between your current version of MySQL and
8038        the version to which you are upgrading. If so and these
8039        changes result in an incompatibility between MySQL versions,
8040        you will need to upgrade the affected tables using the
8041        instructions in Section 2.13.4, "Rebuilding or Repairing
8042        Tables or Indexes."
8044      * After upgrading to a new version of MySQL, run mysql_upgrade
8045        (see Section 4.4.8, "mysql_upgrade --- Check and Upgrade MySQL
8046        Tables"). This program checks your tables, and attempts to
8047        repair them if necessary. It also updates your grant tables to
8048        make sure that they have the current structure so that you can
8049        take advantage of any new capabilities. (Some releases of
8050        MySQL introduce changes to the structure of the grant tables
8051        to add new privileges or features.)
8052        mysql_upgrade does not upgrade the contents of the help
8053        tables. For upgrade instructions, see Section 5.1.9,
8054        "Server-Side Help."
8056      * If you run MySQL Server on Windows, see Section 2.3.8,
8057        "Upgrading MySQL Server on Microsoft Windows."
8059      * If you use replication, see Section 16.4.3, "Upgrading a
8060        Replication Setup," for information on upgrading your
8061        replication setup.
8063    If your MySQL installation contains a large amount of data that
8064    might take a long time to convert after an in-place upgrade, you
8065    might find it useful to create a "dummy" database instance for
8066    assessing what conversions might be needed and the work involved
8067    to perform them. Make a copy of your MySQL instance that contains
8068    a full copy of the mysql database, plus all other databases
8069    without data. Run your upgrade procedure on this dummy instance to
8070    see what actions might be needed so that you can better evaluate
8071    the work involved when performing actual data conversion on your
8072    original database instance.
8074    The following lists describe changes that may affect applications
8075    and that you should watch out for when upgrading from MySQL 5.0 to
8076    5.1.
8078 Configuration Changes
8081      * Before MySQL 5.1.11, to build MySQL from source with SSL
8082        support enabled, you would invoke configure with either the
8083        --with-openssl or --with-yassl option. In MySQL 5.1.11, those
8084        options both have been replaced by the --with-ssl option. By
8085        default, --with-ssl causes the bundled yaSSL library to be
8086        used. To select OpenSSL instead, give the option as
8087        --with-ssl=path, where path is the directory where the OpenSSL
8088        header files and libraries are located.
8090 Server Changes
8093      * Known issue: As of MySQL 5.1.70, for new installations, the
8094        url columns in the mysql datatbase help tables are now created
8095        as type TEXT to accommodate longer URLs. For upgrades,
8096        mysql_upgrade does not update the columns. Modify them
8097        manually using these statements:
8098 ALTER TABLE mysql.help_category MODIFY url TEXT NOT NULL;
8099 ALTER TABLE mysql.help_topic MODIFY url TEXT NOT NULL;
8101      * Known issue: mysql_upgrade attempts to to upgrade tables that
8102        are incompatible with the current version of MySQL. (It
8103        invokes mysqlcheck to check tables and, if necessary, repair
8104        them.) However this can fail for storage engines that do not
8105        support REPAIR TABLE, such as InnoDB, and leave tables in a
8106        nonupgradable state.
8107        To work around this problem, use ALTER TABLE tbl_name
8108        ENGINE=InnoDB to perform a "null" alter operation that
8109        rebuilds the table.
8111      * Known issue: After a binary upgrade to MySQL 5.1 from a MySQL
8112        5.0 installation that contains ARCHIVE tables:
8114           + Before MySQL 5.1.42, accessing those tables will cause
8115             the server to crash, even if you have run mysql_upgrade
8116             or CHECK TABLE ... FOR UPGRADE.
8118           + As of MySQL 5.1.42, the server will not open 5.0 ARCHIVE
8119             tables at all.
8120        In either case, the solution is to use mysqldump to dump all
8121        5.0 ARCHIVE tables before upgrading, and reload them into
8122        MySQL 5.1 after upgrading. This problem is fixed in MySQL
8123        5.6.4: The server can open ARCHIVE tables created in MySQL
8124        5.0. However, it remains the recommended upgrade procedure to
8125        dump 5.0 ARCHIVE tables before upgrading and reload them after
8126        upgrading.
8128      * Known issue: The fix for Bug #23491 introduced a problem with
8129        SHOW CREATE VIEW, which is used by mysqldump. This causes an
8130        incompatibility when upgrading from versions affected by that
8131        bug fix (MySQL 5.0.40 through 5.0.43, MySQL 5.1.18 through
8132        5.1.19): If you use mysqldump before upgrading from an
8133        affected version and reload the data after upgrading to a
8134        higher version, you must drop and recreate your views.
8136      * Known issue: Dumps performed by using mysqldump to generate a
8137        dump file before the upgrade and reloading the file after
8138        upgrading are subject to the following problem:
8139        Before MySQL 5.0.40, mysqldump displays SPATIAL index
8140        definitions using prefix lengths for the indexed columns.
8141        These prefix lengths are accepted in MySQL 5.0, but not as of
8142        MySQL 5.1. If you use mysqldump from versions of MySQL older
8143        than 5.0.40, any table containing SPATIAL indexes will cause
8144        an error when the dump file is reloaded into MySQL 5.1 or
8145        higher.
8146        For example, a table definition might look like this when
8147        dumped in MySQL 5.0:
8148 CREATE TABLE `t` (
8149  `g` geometry NOT NULL,
8150  SPATIAL KEY `g` (`g`(32))
8151 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
8152        The SPATIAL index definition will not be accepted in MySQL
8153        5.1. To work around this, edit the dump file to remove the
8154        prefix:
8155 CREATE TABLE `t` (
8156  `g` geometry NOT NULL,
8157  SPATIAL KEY `g` (`g`)
8158 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
8159        Dump files can be large, so it may be preferable to dump table
8160        definitions and data separately to make it easier to edit the
8161        definitions:
8162 shell> mysqldump --no-data other_args > definitions.sql
8163 shell> mysqldump --no-create-info other_args > data.sql
8164        Then edit definitions.sql before reloading definitions.sql and
8165        data.sql, in that order.
8166        If you upgrade to a version of MySQL 5.0 higher than 5.0.40
8167        before upgrading to MySQL 5.1, this problem does not occur.
8169      * Known issue: Before MySQL 5.1.30, the CHECK TABLE ... FOR
8170        UPGRADE statement did not check for incompatible collation
8171        changes made in MySQL 5.1.24. (This also affects mysqlcheck
8172        and mysql_upgrade, which cause that statement to be executed.)
8173        Prior to the fix made in 5.1.30, a binary upgrade (performed
8174        without dumping tables with mysqldump before the upgrade and
8175        reloading the dump file after the upgrade) would corrupt
8176        tables. After the fix, CHECK TABLE ... FOR UPGRADE properly
8177        detects the problem and warns about tables that need repair.
8178        However, the fix is not backward compatible and can result in
8179        a downgrading problem under these circumstances:
8181          1. Perform a binary upgrade to a version of MySQL that
8182             includes the fix.
8184          2. Run CHECK TABLE ... FOR UPGRADE (or mysqlcheck or
8185             mysql_upgrade) to upgrade tables.
8187          3. Perform a binary downgrade to a version of MySQL that
8188             does not include the fix.
8189        The solution is to dump tables with mysqldump before the
8190        downgrade and reload the dump file after the downgrade.
8191        Alternatively, drop and recreate affected indexes.
8193      * Known issue: MySQL introduces encoding for table names that
8194        have non-ASCII characters (see Section 9.2.3, "Mapping of
8195        Identifiers to File Names"). After a binary upgrade from MySQL
8196        5.0 to 5.1 or higher, the server recognizes names that have
8197        non-ASCII characters and adds a #mysql50# prefix to them.
8198        As of MySQL 5.1.31, mysql_upgrade encodes these names by
8199        executing the following command:
8200 mysqlcheck --all-databases --check-upgrade --fix-db-names --fix-table
8201 -names
8202        Prior to MySQL 5.1.31, mysql_upgrade does not execute this
8203        command, so you should execute it manually if you have
8204        database or table names that contain nonalphanumeric
8205        characters.
8206        Prior to MySQL 5.1.23, the mysqlcheck command does not perform
8207        the name encoding for views. To work around this problem, drop
8208        each affected view and recreate it.
8209        mysqlcheck cannot fix names that contain literal instances of
8210        the @ character that is used for encoding special characters.
8211        If you have databases or tables that contain this character,
8212        use mysqldump to dump them before upgrading to MySQL 5.1, and
8213        then reload the dump file after upgrading.
8215      * Known issue: When upgrading from MySQL 5.0 to versions of 5.1
8216        prior to 5.1.23, running mysqlcheck (or mysql_upgrade, which
8217        runs mysqlcheck) to upgrade tables fails for names that must
8218        be written as quoted identifiers. To work around this problem,
8219        rename each affected table to a name that does not require
8220        quoting:
8221 RENAME TABLE `tab``le_a` TO table_a;
8222 RENAME TABLE `table b` TO table_b;
8223        After renaming the tables, run the mysql_upgrade program. Then
8224        rename the tables back to their original names:
8225 RENAME TABLE table_a TO `tab``le_a`;
8226 RENAME TABLE table_b TO `table b`;
8228      * Known issue: In connection with view creation, the server
8229        created arc directories inside database directories and
8230        maintained useless copies of .frm files there. Creation and
8231        renaming procedures of those copies as well as creation of arc
8232        directories has been discontinued in MySQL 5.1.29.
8233        This change does cause a problem when downgrading to older
8234        server versions which manifests itself under these
8235        circumstances:
8237          1. Create a view v_orig in MySQL 5.1.29 or higher.
8239          2. Rename the view to v_new and then back to v_orig.
8241          3. Downgrade to an older 5.1.x server and run mysql_upgrade.
8243          4. Try to rename v_orig to v_new again. This operation
8244             fails.
8245        As a workaround to avoid this problem, use either of these
8246        approaches:
8248           + Dump your data using mysqldump before downgrading and
8249             reload the dump file after downgrading.
8251           + Instead of renaming a view after the downgrade, drop it
8252             and recreate it.
8254      * Incompatible change: Character set or collation changes may
8255        require table indexes to be rebuilt. In MySQL 5.1, these
8256        occurred in versions 5.1.21, 5.1.23, and 5.1.24. For details,
8257        see Section 2.13.3, "Checking Whether Tables or Indexes Must
8258        Be Rebuilt."
8260      * Incompatible change: As of MySQL 5.5.6, handling of CREATE
8261        TABLE IF NOT EXISTS ... SELECT statements has been changed for
8262        the case that the destination table already exists:
8264           + Previously, for CREATE TABLE IF NOT EXISTS ... SELECT,
8265             MySQL produced a warning that the table exists, but
8266             inserted the rows and wrote the statement to the binary
8267             log anyway. By contrast, CREATE TABLE ... SELECT (without
8268             IF NOT EXISTS) failed with an error, but MySQL inserted
8269             no rows and did not write the statement to the binary
8270             log.
8272           + MySQL now handles both statements the same way when the
8273             destination table exists, in that neither statement
8274             inserts rows or is written to the binary log. The
8275             difference between them is that MySQL produces a warning
8276             when IF NOT EXISTS is present and an error when it is
8277             not.
8278        This change in handling of IF NOT EXISTS results in an
8279        incompatibility for statement-based replication from a MySQL
8280        5.1 master with the original behavior and a MySQL 5.5 slave
8281        with the new behavior. Suppose that CREATE TABLE IF NOT EXISTS
8282        ... SELECT is executed on the master and the destination table
8283        exists. The result is that rows are inserted on the master but
8284        not on the slave. (Row-based replication does not have this
8285        problem.)
8286        To address this issue, statement-based binary logging for
8287        CREATE TABLE IF NOT EXISTS ... SELECT is changed in MySQL 5.1
8288        as of 5.1.51:
8290           + If the destination table does not exist, there is no
8291             change: The statement is logged as is.
8293           + If the destination table does exist, the statement is
8294             logged as the equivalent pair of CREATE TABLE IF NOT
8295             EXISTS and INSERT ... SELECT statements. (If the SELECT
8296             in the original statement is preceded by IGNORE or
8297             REPLACE, the INSERT becomes INSERT IGNORE or REPLACE,
8298             respectively.)
8299        This change provides forward compatibility for statement-based
8300        replication from MySQL 5.1 to 5.5 because when the destination
8301        table exists, the rows will be inserted on both the master and
8302        slave. To take advantage of this compatibility measure, the
8303        5.1 server must be at least 5.1.51 and the 5.5 server must be
8304        at least 5.5.6.
8305        To upgrade an existing 5.1-to-5.5 replication scenario,
8306        upgrade the master first to 5.1.51 or higher. Note that this
8307        differs from the usual replication upgrade advice of upgrading
8308        the slave first.
8309        A workaround for applications that wish to achieve the
8310        original effect (rows inserted regardless of whether the
8311        destination table exists) is to use CREATE TABLE IF NOT EXISTS
8312        and INSERT ... SELECT statements rather than CREATE TABLE IF
8313        NOT EXISTS ... SELECT statements.
8314        Along with the change just described, the following related
8315        change was made: Previously, if an existing view was named as
8316        the destination table for CREATE TABLE IF NOT EXISTS ...
8317        SELECT, rows were inserted into the underlying base table and
8318        the statement was written to the binary log. As of MySQL
8319        5.1.51 and 5.5.6, nothing is inserted or logged.
8321      * Incompatible change: Prior to MySQL 5.1.51, if you flushed the
8322        logs using FLUSH LOGS or mysqladmin flush-logs and mysqld was
8323        writing the error log to a file (for example, if it was
8324        started with the --log-error option), it renames the current
8325        log file with the suffix -old, then created a new empty log
8326        file. This had the problem that a second log-flushing
8327        operation thus caused the original error log file to be lost
8328        unless you saved it under a different name. For example, you
8329        could use the following commands to save the file:
8330 shell> mysqladmin flush-logs
8331 shell> mv host_name.err-old backup-directory
8332        To avoid the preceding file-loss problem, no renaming occurs
8333        as of MySQL 5.1.51; the server merely closes and reopens the
8334        log file. To rename the file, you can do so manually before
8335        flushing. Then flushing the logs reopens a new file with the
8336        original file name. For example, you can rename the file and
8337        create a new one using the following commands:
8338 shell> mv host_name.err host_name.err-old
8339 shell> mysqladmin flush-logs
8340 shell> mv host_name.err-old backup-directory
8342      * Incompatible change: MySQL 5.1 implements support for a plugin
8343        API that enables the loading and unloading of components at
8344        runtime, without restarting the server. Section 22.2, "The
8345        MySQL Plugin API." The plugin API requires the mysql.plugin
8346        table. After upgrading from an older version of MySQL, you
8347        should run the mysql_upgrade command to create this table. See
8348        Section 4.4.8, "mysql_upgrade --- Check and Upgrade MySQL
8349        Tables."
8350        Plugins are installed in the directory named by the plugin_dir
8351        system variable. This variable also controls the location from
8352        which the server loads user-defined functions (UDFs), which is
8353        a change from earlier versions of MySQL. That is, all UDF
8354        library files now must be installed in the plugin directory.
8355        When upgrading from an older version of MySQL, you must
8356        migrate your UDF files to the plugin directory.
8358      * Incompatible change: The table_cache system variable has been
8359        renamed to table_open_cache. Any scripts that refer to
8360        table_cache must be updated to use the new name.
8362      * Incompatible change: In MySQL 5.1.36, options for loading
8363        plugins such as pluggable storage engines were changed from
8364        boolean to tristate format. The implementations overlap, but
8365        if you previously used options of the form --plugin_name=0 or
8366        --plugin_name=1, you should instead use --plugin_name=OFF or
8367        --plugin_name=ON, respectively. For details, see Section
8368        5.1.8.1, "Installing and Uninstalling Plugins."
8370      * Incompatible change: From MySQL 5.1.24 to 5.1.31, the UPDATE
8371        statement was changed such that assigning NULL to a NOT NULL
8372        column caused an error even when strict SQL mode was not
8373        enabled. The original behavior before MySQL 5.1.24 was that
8374        such assignments caused an error only in strict SQL mode, and
8375        otherwise set the column to the implicit default value for the
8376        column data type and generated a warning. (For information
8377        about implicit default values, see Section 11.5, "Data Type
8378        Default Values.")
8379        The change caused compatibility problems for applications that
8380        relied on the original behavior. It also caused replication
8381        problems between servers that had the original behavior and
8382        those that did not, for applications that assigned NULL to NOT
8383        NULL columns in UPDATE statements without strict SQL mode
8384        enabled. The change was reverted in MySQL 5.1.32 so that
8385        UPDATE again had the original behavior. Problems can still
8386        occur if you replicate between servers that have the modified
8387        UPDATE behavior and those that do not.
8389      * Incompatible change: As of MySQL 5.1.29, the default binary
8390        logging mode has been changed from MIXED to STATEMENT for
8391        compatibility with MySQL 5.0.
8393      * Incompatible change: In MySQL 5.1.25, a change was made to the
8394        way that the server handles prepared statements. This affects
8395        prepared statements processed at the SQL level (using the
8396        PREPARE statement) and those processed using the binary
8397        client/server protocol (using the mysql_stmt_prepare() C API
8398        function).
8399        Previously, changes to metadata of tables or views referred to
8400        in a prepared statement could cause a server crash when the
8401        statement was next executed, or perhaps an error at execute
8402        time with a crash occurring later. For example, this could
8403        happen after dropping a table and recreating it with a
8404        different definition.
8405        Now metadata changes to tables or views referred to by
8406        prepared statements are detected and cause automatic
8407        repreparation of the statement when it is next executed.
8408        Metadata changes occur for DDL statements such as those that
8409        create, drop, alter, rename, or truncate tables, or that
8410        analyze, optimize, or repair tables. Repreparation also occurs
8411        after referenced tables or views are flushed from the table
8412        definition cache, either implicitly to make room for new
8413        entries in the cache, or explicitly due to FLUSH TABLES.
8414        Repreparation is automatic, but to the extent that it occurs,
8415        performance of prepared statements is diminished.
8416        Table content changes (for example, with INSERT or UPDATE) do
8417        not cause repreparation, nor do SELECT statements.
8418        An incompatibility with previous versions of MySQL is that a
8419        prepared statement may now return a different set of columns
8420        or different column types from one execution to the next. For
8421        example, if the prepared statement is SELECT * FROM t1,
8422        altering t1 to contain a different number of columns causes
8423        the next execution to return a number of columns different
8424        from the previous execution.
8425        Older versions of the client library cannot handle this change
8426        in behavior. For applications that use prepared statements
8427        with the new server, an upgrade to the new client library is
8428        strongly recommended.
8429        Along with this change to statement repreparation, the default
8430        value of the table_definition_cache system variable has been
8431        increased from 128 to 256. The purpose of this increase is to
8432        lessen the chance that prepared statements will need
8433        repreparation due to referred-to tables/views having been
8434        flushed from the cache to make room for new entries.
8435        A new status variable, Com_stmt_reprepare, has been introduced
8436        to track the number of repreparations.
8438      * Incompatible change: The -, *, and / operators and the
8439        functions POW() and EXP() could misbehave when used with
8440        floating-point numbers. Previously they might return +INF,
8441        -INF, or NaN in cases of numeric overflow (including that
8442        caused by division by zero) or when invalid arguments were
8443        used. As of MySQL 5.1.24, NULL is returned in all such cases.
8445      * Incompatible change: As of MySQL 5.1.23, within a stored
8446        routine, it is no longer permissible to declare a cursor for a
8447        SHOW or DESCRIBE statement. This happened to work in some
8448        instances, but is no longer supported. In many cases, a
8449        workaround for this change is to use the cursor with a SELECT
8450        query to read from an INFORMATION_SCHEMA table that produces
8451        the same information as the SHOW statement.
8453      * Incompatible change: SHOW CREATE VIEW displays view
8454        definitions using an AS alias_name clause for each column. If
8455        a column is created from an expression, the default alias is
8456        the expression text, which can be quite long. As of MySQL
8457        5.1.23, aliases for column names in CREATE VIEW statements are
8458        checked against the maximum column length of 64 characters
8459        (not the maximum alias length of 256 characters). As a result,
8460        views created from the output of SHOW CREATE VIEW fail if any
8461        column alias exceeds 64 characters. This can cause problems
8462        for replication or loading dump files. For additional
8463        information and workarounds, see Section E.4, "Restrictions on
8464        Views."
8466      * Incompatible change: Several issues were identified for stored
8467        programs (stored procedures and functions, triggers, and
8468        events) and views containing non-ASCII symbols. These issues
8469        involved conversion errors due to incomplete character set
8470        information when translating these objects to and from stored
8471        format.
8472        To address these problems, the representation for these
8473        objects was changed in MySQL 5.1.21. However, the fixes affect
8474        all stored programs and views. (For example, you will see
8475        warnings about "no creation context.") To avoid warnings from
8476        the server about the use of old definitions from any release
8477        prior to 5.1.21, you should dump stored programs and views
8478        with mysqldump after upgrading to 5.1.21 or higher, and then
8479        reload them to recreate them with new definitions. Invoke
8480        mysqldump with a --default-character-set option that names the
8481        non-ASCII character set that was used for the definitions when
8482        the objects were originally created, and the --routines,
8483        --events, and --triggers options to dump stored program
8484        definitions.
8485        Upgrading for triggers in particular must be handled
8486        carefully, for two reasons:
8488           + The output from mysqldump does not contain a DROP TRIGGER
8489             statement preceding each CREATE TRIGGER statement, so
8490             reloading the dump file will fail to re-create the
8491             triggers unless you manually drop them after generating
8492             the dump file and before reloading it.
8494           + If you are upgrading from a very old version of MySQL 5.0
8495             (before 5.0.10), the trigger upgrade procedure is
8496             different because triggers for those versions were
8497             created using a different namespace (trigger names had to
8498             be unique per table, rather than per schema as is true
8499             now). For instructions on upgrading triggers from old 5.0
8500             versions, see Upgrading from MySQL 4.1 to 5.0
8501             (http://dev.mysql.com/doc/refman/5.0/en/upgrading-from-pr
8502             evious-series.html).
8503        Assuming that you are upgrading from MySQL 5.0.10 to 5.1.20 to
8504        MySQL 5.1.21 or later, use the following procedure to upgrade
8505        your triggers:
8507           + Use mysqldump to generate a dump file that contains the
8508             trigger definitions:
8509 mysqldump --triggers --no-create-db --no-data
8510           --no-create-info --all-databases > triggers.sql
8511             You might need to add options to specify connection
8512             parameters, such as --user or --password. Also, if you
8513             are updating from a version of MySQL 5.1 older than
8514             5.1.21, you may need to include a --default-character-set
8515             option that specifies the non-ASCII character set that
8516             was used for the definitions when the triggers were
8517             originally created.
8518             Otherwise, invoke mysqldump with exactly the preceding
8519             options to avoid generating a dump file that will not
8520             have the intended effect when reloaded. For example, if
8521             you omit the --no-create-db option, your databases will
8522             be removed and recreated with no contents when you reload
8523             the dump file.
8525           + Drop existing triggers. To see which triggers exist, use
8526             this statement:
8527 SELECT TRIGGER_SCHEMA, EVENT_OBJECT_TABLE, TRIGGER_NAME
8528 FROM INFORMATION_SCHEMA.TRIGGERS;
8529             To generate DROP TRIGGERS statements for the triggers,
8530             use this statement:
8531 SELECT CONCAT('DROP TRIGGER ', TRIGGER_SCHEMA, '.', TRIGGER_NAME, ';'
8533 FROM INFORMATION_SCHEMA.TRIGGERS
8534 INTO OUTFILE '/tmp/drop_triggers.sql';
8535             The statement uses INTO OUTFILE, so you must have the
8536             FILE privilege. The file will be created on the server
8537             host. Use a different file name if you like. To be 100%
8538             safe, inspect the trigger definitions in the
8539             drop_triggers.sql file, and perhaps make a backup of the
8540             file. Then execute the statements in the file:
8541 mysql --force < /tmp/drop_triggers.sql
8543           + Recreate the triggers by reloading the dump file created
8544             earlier:
8545 mysql --force < triggers.sql
8547      * Incompatible change: As of MySQL 5.1.20, mysqld_safe supports
8548        error logging to syslog on systems that support the logger
8549        command. The new --syslog and --skip-syslog options can be
8550        used instead of the --log-error option to control logging
8551        behavior, as described in Section 4.3.2, "mysqld_safe ---
8552        MySQL Server Startup Script."
8553        In 5.1.21 and up, the default is --skip-syslog, which is
8554        compatible with the default behavior of writing an error log
8555        file for releases prior to 5.1.20.
8556        In 5.1.20 only, the following conditions apply: 1) The default
8557        is to use syslog, which is not compatible with releases prior
8558        to 5.1.20. 2) Logging to syslog may fail to operate correctly
8559        in some cases. For these reasons, avoid using MySQL 5.1.20.
8561      * Incompatible change: As of MySQL 5.1.18, the plugin interface
8562        and its handling of system variables was changed. Command-line
8563        options such as --skip-innodb now cause an error if InnoDB is
8564        not built-in or plugin-loaded. You should use
8565        --loose-skip-innodb if you do not want any error even if
8566        InnoDB is not available. The --loose prefix modifier should be
8567        used for all command-line options where you are uncertain
8568        whether the plugin exists and when you want the operation to
8569        proceed even if the option is necessarily ignored due to the
8570        absence of the plugin. (For a description of how --loose
8571        works, see Section 4.2.3.1, "Using Options on the Command
8572        Line.")
8574      * Incompatible change: As of MySQL 5.1.15, InnoDB rolls back
8575        only the last statement on a transaction timeout. A new
8576        option, --innodb_rollback_on_timeout, causes InnoDB to abort
8577        and roll back the entire transaction if a transaction timeout
8578        occurs (the same behavior as in MySQL 4.1).
8580      * Incompatible change: As of MySQL 5.1.15, the following
8581        conditions apply to enabling the read_only system variable:
8583           + If you attempt to enable read_only while you have any
8584             explicit locks (acquired with LOCK TABLES or have a
8585             pending transaction, an error will occur.
8587           + If other clients hold explicit table locks or have
8588             pending transactions, the attempt to enable read_only
8589             blocks until the locks are released and the transactions
8590             end. While the attempt to enable read_only is pending,
8591             requests by other clients for table locks or to begin
8592             transactions also block until read_only has been set.
8594           + read_only can be enabled while you hold a global read
8595             lock (acquired with FLUSH TABLES WITH READ LOCK) because
8596             that does not involve table locks.
8597        Previously, the attempt to enable read_only would return
8598        immediately even if explicit locks or transactions were
8599        pending, so some data changes could occur for statements
8600        executing in the server at the same time.
8602      * Incompatible change: The number of function names affected by
8603        IGNORE_SPACE was reduced significantly in MySQL 5.1.13, from
8604        about 200 to about 30. (For details about IGNORE_SPACE, see
8605        Section 9.2.4, "Function Name Parsing and Resolution.") This
8606        change improves the consistency of parser operation. However,
8607        it also introduces the possibility of incompatibility for old
8608        SQL code that relies on the following conditions:
8610           + IGNORE_SPACE is disabled.
8612           + The presence or absence of whitespace following a
8613             function name is used to distinguish between a built-in
8614             function and stored function that have the same name (for
8615             example, PI() versus PI ()).
8616        For functions that are no longer affected by IGNORE_SPACE as
8617        of MySQL 5.1.13, that strategy no longer works. Either of the
8618        following approaches can be used if you have code that is
8619        subject to the preceding incompatibility:
8621           + If a stored function has a name that conflicts with a
8622             built-in function, refer to the stored function with a
8623             schema name qualifier, regardless of whether whitespace
8624             is present. For example, write schema_name.PI() or
8625             schema_name.PI ().
8627           + Alternatively, rename the stored function to use a
8628             nonconflicting name and change invocations of the
8629             function to use the new name.
8631      * Incompatible change: For utf8 columns, the full-text parser
8632        incorrectly considered several nonword punctuation and
8633        whitespace characters as word characters, causing some
8634        searches to return incorrect results. The fix involves a
8635        change to the full-text parser in MySQL 5.1.12, so as of
8636        5.1.12, any tables that have FULLTEXT indexes on utf8 columns
8637        must be repaired with REPAIR TABLE:
8638 REPAIR TABLE tbl_name QUICK;
8640      * Incompatible change: Storage engines can be pluggable at
8641        runtime, so the distinction between disabled and invalid
8642        storage engines no longer applies. As of MySQL 5.1.12, this
8643        affects the NO_ENGINE_SUBSTITUTION SQL mode, as described in
8644        Section 5.1.7, "Server SQL Modes."
8646      * Incompatible change: The structure of FULLTEXT indexes has
8647        been changed in MySQL 5.1.6. After upgrading to MySQL 5.1.6 or
8648        greater, any tables that have FULLTEXT indexes must be
8649        repaired with REPAIR TABLE:
8650 REPAIR TABLE tbl_name QUICK;
8652      * Incompatible change: In MySQL 5.1.6, when log tables were
8653        implemented, the default log destination for the general query
8654        and slow query log was TABLE. As of MySQL 5.1.21, this default
8655        has been changed to FILE, which is compatible with MySQL 5.0,
8656        but incompatible with earlier releases of MySQL 5.1. If you
8657        are upgrading from MySQL 5.0 to 5.1.21 or higher, no logging
8658        option changes should be necessary. However, if you are
8659        upgrading from 5.1.6 through 5.1.20 to 5.1.21 or higher and
8660        were using TABLE logging, use the --log-output=TABLE option
8661        explicitly to preserve your server's table-logging behavior.
8663      * Incompatible change: In very old versions of MySQL (prior to
8664        4.1), the TIMESTAMP data type supported a display width, which
8665        was silently ignored beginning with MySQL 4.1. This is
8666        deprecated in MySQL 5.1, and removed altogether in MySQL 5.5.
8667        These changes in behavior can lead to two problem scenarios
8668        when trying to use TIMESTAMP(N) columns with a MySQL 5.5 or
8669        later server:
8671           + When importing a dump file (for example, one created
8672             using mysqldump) created in a MySQL 5.0 or earlier server
8673             into a server from a newer release series, a CREATE TABLE
8674             or ALTER TABLE statement containing TIMESTAMP(N) causes
8675             the import to fail with a syntax error.
8676             To fix this problem, edit the dump file in a text editor
8677             to replace any instances of TIMESTAMP(N) with TIMESTAMP
8678             prior to importing the file. Be sure to use a plain text
8679             editor for this, and not a word processor; otherwise, the
8680             result is almost certain to be unusable for importing
8681             into the MySQL server.
8683           + When trying replicate any CREATE TABLE or ALTER TABLE
8684             statement containing TIMESTAMP(N) from a master MySQL
8685             server that supports the TIMESTAMP(N) syntax to a MySQL
8686             5.5.3 or newer slave, the statement causes replication to
8687             fail. Similarly, when you try to restore from a binary
8688             log written by a server that supports TIMESTAMP(N) to a
8689             MySQL 5.5.3 or newer server, any CREATE TABLE or ALTER
8690             TABLE statement containing TIMESTAMP(N) causes the backup
8691             to fail. This holds true regardless of the logging
8692             format.
8693             It may be possible to fix such issues using a hex editor,
8694             by replacing any width arguments used with TIMESTAMP, and
8695             the parentheses containing them, with space characters
8696             (hexadecimal 20). Be sure to use a programmer's binary
8697             hex editor and not a regular text editor or word
8698             processor for this; otherwise, the result is almost
8699             certain to be a corrupted binary log file. To guard
8700             against accidental corruption of the binary log, you
8701             should always work on a copy of the file rather than the
8702             original.
8703        You should try to handle potential issues of these types
8704        proactively by updating with ALTER TABLE any TIMESTAMP(N)
8705        columns in your databases so that they use TIMESTAMP instead,
8706        before performing any upgrades.
8708      * Incompatible change: For ENUM columns that had enumeration
8709        values containing commas, the commas were mapped to 0xff
8710        internally. However, this rendered the commas
8711        indistinguishable from true 0xff characters in the values.
8712        This no longer occurs. However, the fix requires that you dump
8713        and reload any tables that have ENUM columns containing true
8714        0xff in their values: Dump the tables using mysqldump with the
8715        current server before upgrading from a version of MySQL 5.1
8716        older than 5.1.15 to version 5.1.15 or newer.
8718      * As of MySQL 5.1.12, the lc_time_names system variable
8719        specifies the locale that controls the language used to
8720        display day and month names and abbreviations. This variable
8721        affects the output from the DATE_FORMAT(), DAYNAME() and
8722        MONTHNAME() functions. See Section 10.7, "MySQL Server Locale
8723        Support."
8725      * As of MySQL 5.1.9, mysqld_safe no longer implicitly invokes
8726        mysqld-max if it exists. Instead, it invokes mysqld unless a
8727        --mysqld or --mysqld-version option is given to specify
8728        another server explicitly. If you previously relied on the
8729        implicit invocation of mysqld-max, you should use an
8730        appropriate option now. As of MySQL 5.1.12, there is no longer
8731        any separate mysqld-max server, so no change should be
8732        necessary.
8734 SQL Changes
8737      * Known issue: Prior to MySQL 5.1.17, the parser accepted
8738        invalid code in SQL condition handlers, leading to server
8739        crashes or unexpected execution behavior in stored programs.
8740        Specifically, the parser permitted a condition handler to
8741        refer to labels for blocks that enclose the handler
8742        declaration. This was incorrect because block label scope does
8743        not include the code for handlers declared within the labeled
8744        block.
8745        As of 5.1.17, the parser rejects this invalid construct, but
8746        if you perform a binary upgrade (without dumping and reloading
8747        your databases), existing handlers that contain the construct
8748        still are invalid and should be rewritten even if they appear
8749        to function as you expect.
8750        To find affected handlers, use mysqldump to dump all stored
8751        procedures and functions, triggers, and events. Then attempt
8752        to reload them into an upgraded server. Handlers that contain
8753        illegal label references will be rejected.
8754        For more information about condition handlers and writing them
8755        to avoid invalid jumps, see Section 13.6.7.2, "DECLARE ...
8756        HANDLER Syntax."
8758      * Incompatible change: The parser accepted statements that
8759        contained /* ... */ that were not properly closed with */,
8760        such as SELECT 1 /* + 2. As of MySQL 5.1.23, statements that
8761        contain unclosed /*-comments now are rejected with a syntax
8762        error.
8763        This fix has the potential to cause incompatibilities. Because
8764        of Bug #26302, which caused the trailing */ to be truncated
8765        from comments in views, stored routines, triggers, and events,
8766        it is possible that objects of those types may have been
8767        stored with definitions that now will be rejected as
8768        syntactically invalid. Such objects should be dropped and
8769        re-created so that their definitions do not contain truncated
8770        comments.
8772      * Incompatible change: Multiple-table DELETE statements
8773        containing ambiguous aliases could have unintended side
8774        effects such as deleting rows from the wrong table. Examples:
8775 DELETE FROM t1 AS a2 USING t1 AS a1 INNER JOIN t2 AS a2;
8776 DELETE t1 AS a2 FROM t1 AS a1 INNER JOIN t2 AS a2;
8777        To avoid ambiguity, declaration of aliases other than in the
8778        table_references part of the statement should be avoided:
8779 DELETE FROM t1 USING t1 AS a1 INNER JOIN t2 AS a2;
8780 DELETE t1 FROM t1 AS a1 INNER JOIN t2 AS a2;
8781        As of MySQL 5.1.23, alias declarations outside the
8782        table_references part of the statement are disallowed for the
8783        USING variant of multiple-table DELETE syntax. (In MySQL 5.5,
8784        alias declarations outside table_references are disallowed for
8785        all multiple-table DELETE statements.) Statements containing
8786        aliases that are no longer permitted must be rewritten.
8788      * Incompatible change: As of MySQL 5.1.8, TYPE = engine_name is
8789        still accepted as a synonym for the ENGINE = engine_name table
8790        option but generates a warning. You should note that this
8791        option is not available in MySQL 5.1.7, and is removed
8792        altogether in MySQL 5.5 and produces a syntax error.
8793        TYPE has been deprecated since MySQL 4.0.
8795      * Incompatible change: MySQL 5.1.6 introduces the TRIGGER
8796        privilege. Previously, the SUPER privilege was needed to
8797        create or drop triggers. Now those operations require the
8798        TRIGGER privilege. This is a security improvement because you
8799        no longer need to grant users the SUPER privilege to enable
8800        them to create triggers. However, the requirement that the
8801        account named in a trigger's DEFINER clause must have the
8802        SUPER privilege has changed to a requirement for the TRIGGER
8803        privilege. When upgrading from a previous version of MySQL 5.0
8804        or 5.1 to MySQL 5.1.6 or newer, be sure to update your grant
8805        tables by running mysql_upgrade. This will assign the TRIGGER
8806        privilege to all accounts that had the SUPER privilege. If you
8807        fail to update the grant tables, triggers may fail when
8808        activated. After updating the grant tables, you can revoke the
8809        SUPER privilege from those accounts that no longer otherwise
8810        require it.
8812      * Some keywords may be reserved in MySQL 5.1 that were not
8813        reserved in MySQL 5.0. See Section 9.3, "Reserved Words."
8815      * The BACKUP TABLE, and RESTORE TABLE statements are deprecated.
8816        mysqldump or mysqlhotcopy can be used as alternatives.
8818      * The LOAD DATA FROM MASTER and LOAD TABLE FROM MASTER
8819        statements are deprecated. See Section 13.4.2.2, "LOAD DATA
8820        FROM MASTER Syntax," for recommended alternatives.
8822      * The INSTALL PLUGIN and UNINSTALL PLUGIN statements that are
8823        used for the plugin API are new. So is the WITH PARSER clause
8824        for FULLTEXT index creation that associates a parser plugin
8825        with a full-text index. Section 22.2, "The MySQL Plugin API."
8827 C API Changes
8830      * Incompatible change: As of MySQL 5.1.7, the
8831        mysql_stmt_attr_get() C API function returns a boolean rather
8832        than an unsigned int for STMT_ATTR_UPDATE_MAX_LENGTH. (Bug
8833        #16144)
8835 2.13.2. Downgrading MySQL
8837    This section describes what you should do to downgrade to an older
8838    MySQL version in the unlikely case that the previous version
8839    worked better than the new one.
8841    It is always a good idea to make a backup beforehand, in case a
8842    downgrade fails and leaves the instance in an unusable state.
8844    To downgrade between General Availability (GA) status versions
8845    within the same release series, typically you just install the new
8846    binaries on top of the old ones and do not make any changes to the
8847    databases.
8849    Downgrades between pre-GA development releases (or from a GA
8850    release to a development release) within the same release series
8851    are not supported and you may encounter issues.
8853    The following items form a checklist of things you should do
8854    whenever you perform a downgrade:
8856      * Read the upgrading section for the release series from which
8857        you are downgrading to be sure that it does not have any
8858        features you really need. See Section 2.13.1, "Upgrading
8859        MySQL."
8861      * If there is a downgrading section for that version, you should
8862        read that as well.
8864      * To see which new features were added between the version to
8865        which you are downgrading and your current version, see the
8866        Release Notes
8867        (http://dev.mysql.com/doc/relnotes/mysql/5.1/en/).
8869      * Check Section 2.13.3, "Checking Whether Tables or Indexes Must
8870        Be Rebuilt," to see whether changes to table formats or to
8871        character sets or collations were made between your current
8872        version of MySQL and the version to which you are downgrading.
8873        If so and these changes result in an incompatibility between
8874        MySQL versions, you will need to downgrade the affected tables
8875        using the instructions in Section 2.13.4, "Rebuilding or
8876        Repairing Tables or Indexes."
8878    In most cases, you can move the MySQL format files and data files
8879    between different GA versions on the same architecture as long as
8880    you stay within versions for the same release series of MySQL.
8882    If you downgrade from one release series to another, there may be
8883    incompatibilities in table storage formats. In this case, use
8884    mysqldump to dump your tables before downgrading. After
8885    downgrading, reload the dump file using mysql or mysqlimport to
8886    re-create your tables. For examples, see Section 2.13.5, "Copying
8887    MySQL Databases to Another Machine."
8889    A typical symptom of a downward-incompatible table format change
8890    when you downgrade is that you cannot open tables. In that case,
8891    use the following procedure:
8893     1. Stop the older MySQL server that you are downgrading to.
8895     2. Restart the newer MySQL server you are downgrading from.
8897     3. Dump any tables that were inaccessible to the older server by
8898        using mysqldump to create a dump file.
8900     4. Stop the newer MySQL server and restart the older one.
8902     5. Reload the dump file into the older server. Your tables should
8903        be accessible.
8905    It might also be the case that system tables in the mysql database
8906    have changed and that downgrading introduces some loss of
8907    functionality or requires some adjustments. Here are some
8908    examples:
8910      * Trigger creation requires the TRIGGER privilege as of MySQL
8911        5.1. In MySQL 5.0, there is no TRIGGER privilege and SUPER is
8912        required instead. If you downgrade from MySQL 5.1 to 5.0, you
8913        will need to give the SUPER privilege to those accounts that
8914        had the TRIGGER privilege in 5.1.
8916      * Triggers were added in MySQL 5.0, so if you downgrade from 5.0
8917        to 4.1, you cannot use triggers at all.
8919      * The mysql.proc.comment column definition changed between MySQL
8920        5.1 and 5.5. After a downgrade from 5.5 to 5.1, this table is
8921        seen as corrupt and in need of repair. To workaround this
8922        problem, execute mysql_upgrade from the version of MySQL to
8923        which you downgraded.
8925 2.13.2.1. Downgrading to MySQL 5.0
8927    When downgrading to MySQL 5.0 from MySQL 5.1, you should keep in
8928    mind the following issues relating to features found in MySQL 5.1,
8929    but not in MySQL 5.0:
8931      * Partitioning.  MySQL 5.0 does not support user-defined
8932        partitioning. If a table was created as a partitioned table in
8933        5.1 (or if an table created in a previous version of MySQL was
8934        altered to include partitions after an upgrade to 5.1), the
8935        table is accessible after downgrade only if you do one of the
8936        following:
8938           + Export the table using mysqldump and then drop it in
8939             MySQL 5.1; import the table again following the downgrade
8940             to MySQL 5.0.
8942           + Prior to the downgrade, remove the table's partitioning
8943             using ALTER TABLE table_name REMOVE PARTITIONING.
8945      * Event Scheduler.  MySQL 5.0 does not support scheduled events.
8946        If your databases contain scheduled event definitions, you
8947        should prevent them from being dumped when you use mysqldump
8948        by using the --skip-events option. (See Section 4.5.4,
8949        "mysqldump --- A Database Backup Program.")
8951      * Stored routines.  MySQL 5.1.21 added a number of new columns
8952        to the mysql.proc table in which stored routine definitions
8953        are stored. If you are downgrading from MySQL 5.1.21 or later
8954        to MySQL 5.0, you cannot import the MySQL 5.1 routine
8955        definitions into MySQL 5.0.46 or earlier using the dump of
8956        mysql.proc created by mysqldump (such as when using the
8957        --all-databases option). Instead, you should run mysqldump
8958        --routines prior to performing the downgrade and run the
8959        stored routines DDL statements following the downgrade.
8960        See Bug #11986, Bug #30029, and Bug #30660, for more
8961        information.
8963      * Triggers.  Trigger creation requires the TRIGGER privilege as
8964        of MySQL 5.1. In MySQL 5.0, there is no TRIGGER privilege and
8965        SUPER is required instead. If you downgrade from MySQL 5.1 to
8966        5.0, you will need to give the SUPER privilege to those
8967        accounts that had the TRIGGER privilege in 5.1.
8969 2.13.2.2. Downgrading from MySQL Enterprise Edition to MySQL
8970 Community Server
8972    This section describes the steps required to downgrade from MySQL
8973    Enterprise Edition to MySQL Community Edition. This can be done at
8974    any time, and is required at the expiration of a MySQL Enterprise
8975    Edition subscription if you wish to continue using MySQL Server.
8977    When you perform such a downgrade, all commercially licensed
8978    components of the MySQL Enterprise Edition subscription must be
8979    uninstalled. These components and related considerations are
8980    described in the rest of this section.
8981    Note
8983    The issues described in this section are in addition to any that
8984    may be encountered as a result of any upgrade or downgrade of the
8985    MySQL Server version (such as between MySQL 5.1 and 5.0).
8986    Information about upgrading and downgrading between MySQL release
8987    series can be found elsewhere in this chapter; see Section 2.13.1,
8988    "Upgrading MySQL," and Section 2.13.2, "Downgrading MySQL."
8990    MySQL Enterprise Database Server.  All commercial versions of
8991    MySQL Database Server must be uninstalled.
8993    Commercially licensed extensions.  All commercially licensed MySQL
8994    Enterprise Database Server extensions must be uninstalled,
8995    including the MySQL High Availability extension. Following
8996    uninstallation of this extension, automated failover is no longer
8997    available.
8999    MySQL Enterprise Backup.  MySQL Enterprise Backup must be
9000    uninstalled. Uninstalling this application has the effects listed
9001    here:
9003      * Automated backup scripts no longer work.
9005      * Existing backup images taken with MySQL Enterprise Backup can
9006        no longer be used for recovery.
9008      * Third-party integration with multimedia systems such as
9009        NetBackup, Tivoli, and Oracle Secure Backup no longer works.
9011    MySQL Enterprise Monitor, MySQL Query Analyzer, agents.  MySQL
9012    Enterprise Monitor, MySQL Query Analyzer, and all server-side
9013    agents must be uninstalled. Uninstalling these applications and
9014    agents has the following effects:
9016      * Automated SNMP and SMTP alerts no longer work.
9018      * All historical MySQL, OS monitoring, query, and performance
9019        metrics as well as all trending data are lost.
9021      * All environment-specific monitoring templates, custom
9022        advisors, graphs and scripts are also lost.
9024 2.13.3. Checking Whether Tables or Indexes Must Be Rebuilt
9026    A binary upgrade or downgrade is one that installs one version of
9027    MySQL "in place" over an existing version, without dumping and
9028    reloading tables:
9030     1. Stop the server for the existing version if it is running.
9032     2. Install a different version of MySQL. This is an upgrade if
9033        the new version is higher than the original version, a
9034        downgrade if the version is lower.
9036     3. Start the server for the new version.
9038    In many cases, the tables from the previous version of MySQL can
9039    be used without problem by the new version. However, sometimes
9040    changes occur that require tables or table indexes to be rebuilt,
9041    as described in this section. If you have tables that are affected
9042    by any of the issues described here, rebuild the tables or indexes
9043    as necessary using the instructions given in Section 2.13.4,
9044    "Rebuilding or Repairing Tables or Indexes."
9046 Table Incompatibilities
9048    After a binary upgrade to MySQL 5.1 from a MySQL 5.0 installation
9049    that contains ARCHIVE tables:
9051      * Before MySQL 5.1.42, accessing those tables will cause the
9052        server to crash, even if you have run mysql_upgrade or CHECK
9053        TABLE ... FOR UPGRADE.
9055      * As of MySQL 5.1.42, the server will not open 5.0 ARCHIVE
9056        tables at all.
9058    In either case, the solution is to use mysqldump to dump all 5.0
9059    ARCHIVE tables before upgrading, and reload them into MySQL 5.1
9060    after upgrading. This problem is fixed in MySQL 5.6.4: The server
9061    can open ARCHIVE tables created in MySQL 5.0. However, it remains
9062    the recommended upgrade procedure to dump 5.0 ARCHIVE tables
9063    before upgrading and reload them after upgrading.
9065 Index Incompatibilities
9067    If you perform a binary upgrade without dumping and reloading
9068    tables, you cannot upgrade directly from MySQL 4.1 to 5.1 or
9069    higher. This occurs due to an incompatible change in the MyISAM
9070    table index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
9071    repair all MyISAM tables. Then upgrade from MySQL 5.0 to 5.1 and
9072    check and repair your tables.
9074    Modifications to the handling of character sets or collations
9075    might change the character sort order, which causes the ordering
9076    of entries in any index that uses an affected character set or
9077    collation to be incorrect. Such changes result in several possible
9078    problems:
9080      * Comparison results that differ from previous results
9082      * Inability to find some index values due to misordered index
9083        entries
9085      * Misordered ORDER BY results
9087      * Tables that CHECK TABLE reports as being in need of repair
9089    The solution to these problems is to rebuild any indexes that use
9090    an affected character set or collation, either by dropping and
9091    re-creating the indexes, or by dumping and reloading the entire
9092    table. In some cases, it is possible to alter affected columns to
9093    use a different collation. For information about rebuilding
9094    indexes, see Section 2.13.4, "Rebuilding or Repairing Tables or
9095    Indexes."
9097    To check whether a table has indexes that must be rebuilt, consult
9098    the following list. It indicates which versions of MySQL
9099    introduced character set or collation changes that require indexes
9100    to be rebuilt. Each entry indicates the version in which the
9101    change occurred and the character sets or collations that the
9102    change affects. If the change is associated with a particular bug
9103    report, the bug number is given.
9105    The list applies both for binary upgrades and downgrades. For
9106    example, Bug #27877 was fixed in MySQL 5.1.24, so it applies to
9107    upgrades from versions older than 5.1.24 to 5.1.24 or newer, and
9108    to downgrades from 5.1.24 or newer to versions older than 5.1.24.
9110    In many cases, you can use CHECK TABLE ... FOR UPGRADE to identify
9111    tables for which index rebuilding is required. It will report this
9112    message:
9113 Table upgrade required.
9114 Please do "REPAIR TABLE `tbl_name`" or dump/reload to fix it!
9116    In these cases, you can also use mysqlcheck --check-upgrade or
9117    mysql_upgrade, which execute CHECK TABLE. However, the use of
9118    CHECK TABLE applies only after upgrades, not downgrades. Also,
9119    CHECK TABLE is not applicable to all storage engines. For details
9120    about which storage engines CHECK TABLE supports, see Section
9121    13.7.2.3, "CHECK TABLE Syntax."
9123    These changes cause index rebuilding to be necessary:
9125      * MySQL 5.1.24 (Bug #27877)
9126        Affects indexes that use the utf8_general_ci or
9127        ucs2_general_ci collation for columns that contain 'ß' LATIN
9128        SMALL LETTER SHARP S (German). The bug fix corrected an error
9129        in the original collations but introduced an incompatibility
9130        such that 'ß' compares equal to characters with which it
9131        previously compared different.
9132        Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
9133        as of MySQL 5.1.30 (see Bug #40053).
9134        A workaround for this issue is implemented as of MySQL 5.1.62,
9135        5.5.21, and 5.6.5. The workaround involves altering affected
9136        columns to use the utf8_general_mysql500_ci and
9137        ucs2_general_mysql500_ci collations, which preserve the
9138        original pre-5.1.24 ordering of utf8_general_ci and
9139        ucs2_general_ci.
9141      * MySQL 5.0.48, 5.1.23 (Bug #27562)
9142        Affects indexes that use the ascii_general_ci collation for
9143        columns that contain any of these characters: '`' GRAVE
9144        ACCENT, '[' LEFT SQUARE BRACKET, '\' REVERSE SOLIDUS, ']'
9145        RIGHT SQUARE BRACKET, '~' TILDE
9146        Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
9147        as of MySQL 5.1.29 (see Bug #39585).
9149      * MySQL 5.0.48, 5.1.21 (Bug #29461)
9150        Affects indexes for columns that use any of these character
9151        sets: eucjpms, euc_kr, gb2312, latin7, macce, ujis
9152        Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
9153        as of MySQL 5.1.29 (see Bug #39585).
9155 2.13.4. Rebuilding or Repairing Tables or Indexes
9157    This section describes how to rebuild a table. This can be
9158    necessitated by changes to MySQL such as how data types are
9159    handled or changes to character set handling. For example, an
9160    error in a collation might have been corrected, necessitating a
9161    table rebuild to update the indexes for character columns that use
9162    the collation. (For examples, see Section 2.13.3, "Checking
9163    Whether Tables or Indexes Must Be Rebuilt.") It might also be that
9164    a table repair or upgrade should be done as indicated by a table
9165    check operation such as that performed by CHECK TABLE, mysqlcheck,
9166    or mysql_upgrade.
9168    Methods for rebuilding a table include dumping and reloading it,
9169    or using ALTER TABLE or REPAIR TABLE.
9170    Note
9172    If you are rebuilding tables because a different version of MySQL
9173    will not handle them after a binary (in-place) upgrade or
9174    downgrade, you must use the dump-and-reload method. Dump the
9175    tables before upgrading or downgrading using your original version
9176    of MySQL. Then reload the tables after upgrading or downgrading.
9178    If you use the dump-and-reload method of rebuilding tables only
9179    for the purpose of rebuilding indexes, you can perform the dump
9180    either before or after upgrading or downgrading. Reloading still
9181    must be done afterward.
9183    To rebuild a table by dumping and reloading it, use mysqldump to
9184    create a dump file and mysql to reload the file:
9185 shell> mysqldump db_name t1 > dump.sql
9186 shell> mysql db_name < dump.sql
9188    To rebuild all the tables in a single database, specify the
9189    database name without any following table name:
9190 shell> mysqldump db_name > dump.sql
9191 shell> mysql db_name < dump.sql
9193    To rebuild all tables in all databases, use the --all-databases
9194    option:
9195 shell> mysqldump --all-databases > dump.sql
9196 shell> mysql < dump.sql
9198    To rebuild a table with ALTER TABLE, use a "null" alteration; that
9199    is, an ALTER TABLE statement that "changes" the table to use the
9200    storage engine that it already has. For example, if t1 is a MyISAM
9201    table, use this statement:
9202 mysql> ALTER TABLE t1 ENGINE = MyISAM;
9204    If you are not sure which storage engine to specify in the ALTER
9205    TABLE statement, use SHOW CREATE TABLE to display the table
9206    definition.
9208    If you must rebuild a table because a table checking operation
9209    indicates that the table is corrupt or needs an upgrade, you can
9210    use REPAIR TABLE if that statement supports the table's storage
9211    engine. For example, to repair a MyISAM table, use this statement:
9212 mysql> REPAIR TABLE t1;
9214    For storage engines such as InnoDB that REPAIR TABLE does not
9215    support, use mysqldump to create a dump file and mysql to reload
9216    the file, as described earlier.
9218    For specifics about which storage engines REPAIR TABLE supports,
9219    see Section 13.7.2.6, "REPAIR TABLE Syntax."
9221    mysqlcheck --repair provides command-line access to the REPAIR
9222    TABLE statement. This can be a more convenient means of repairing
9223    tables because you can use the --databases or --all-databases
9224    option to repair all tables in specific databases or all
9225    databases, respectively:
9226 shell> mysqlcheck --repair --databases db_name ...
9227 shell> mysqlcheck --repair --all-databases
9229    For incompatibilities introduced in MySQL 5.1.24 by the fix for
9230    Bug #27877 that corrected the utf8_general_ci and ucs2_general_ci
9231    collations, a workaround is implemented as of MySQL 5.1.62,
9232    5.5.21, and 5.6.5. Upgrade to one of those versions, then convert
9233    each affected table using one of the following methods. In each
9234    case, the workaround altering affected columns to use the
9235    utf8_general_mysql500_ci and ucs2_general_mysql500_ci collations,
9236    which preserve the original pre-5.1.24 ordering of utf8_general_ci
9237    and ucs2_general_ci.
9239      * To convert an affected table after a binary upgrade that
9240        leaves the table files in place, alter the table to use the
9241        new collation. Suppose that the table t1 contains one or more
9242        problematic utf8 columns. To convert the table at the table
9243        level, use a statement like this:
9244 ALTER TABLE t1
9245 CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci;
9246        To apply the change on a column-specific basis, use a
9247        statement like this (be sure to repeat the column definition
9248        as originally specified except for the COLLATE clause):
9249 ALTER TABLE t1
9250 MODIFY c1 CHAR(N) CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci
9253      * To upgrade the table using a dump and reload procedure, dump
9254        the table using mysqldump, modify the CREATE TABLE statement
9255        in the dump file to use the new collation, and reload the
9256        table.
9258    After making the appropriate changes, CHECK TABLE should report no
9259    error.
9261 2.13.5. Copying MySQL Databases to Another Machine
9263    You can copy the .frm, .MYI, and .MYD files for MyISAM tables
9264    between different architectures that support the same
9265    floating-point format. (MySQL takes care of any byte-swapping
9266    issues.) See Section 14.5, "The MyISAM Storage Engine."
9268    In cases where you need to transfer databases between different
9269    architectures, you can use mysqldump to create a file containing
9270    SQL statements. You can then transfer the file to the other
9271    machine and feed it as input to the mysql client.
9273    Use mysqldump --help to see what options are available.
9275    The easiest (although not the fastest) way to move a database
9276    between two machines is to run the following commands on the
9277    machine on which the database is located:
9278 shell> mysqladmin -h 'other_hostname' create db_name
9279 shell> mysqldump db_name | mysql -h 'other_hostname' db_name
9281    If you want to copy a database from a remote machine over a slow
9282    network, you can use these commands:
9283 shell> mysqladmin create db_name
9284 shell> mysqldump -h 'other_hostname' --compress db_name | mysql db_na
9287    You can also store the dump in a file, transfer the file to the
9288    target machine, and then load the file into the database there.
9289    For example, you can dump a database to a compressed file on the
9290    source machine like this:
9291 shell> mysqldump --quick db_name | gzip > db_name.gz
9293    Transfer the file containing the database contents to the target
9294    machine and run these commands there:
9295 shell> mysqladmin create db_name
9296 shell> gunzip < db_name.gz | mysql db_name
9298    You can also use mysqldump and mysqlimport to transfer the
9299    database. For large tables, this is much faster than simply using
9300    mysqldump. In the following commands, DUMPDIR represents the full
9301    path name of the directory you use to store the output from
9302    mysqldump.
9304    First, create the directory for the output files and dump the
9305    database:
9306 shell> mkdir DUMPDIR
9307 shell> mysqldump --tab=DUMPDIR db_name
9309    Then transfer the files in the DUMPDIR directory to some
9310    corresponding directory on the target machine and load the files
9311    into MySQL there:
9312 shell> mysqladmin create db_name           # create database
9313 shell> cat DUMPDIR/*.sql | mysql db_name   # create tables in databas
9315 shell> mysqlimport db_name DUMPDIR/*.txt   # load data into tables
9317    Do not forget to copy the mysql database because that is where the
9318    grant tables are stored. You might have to run commands as the
9319    MySQL root user on the new machine until you have the mysql
9320    database in place.
9322    After you import the mysql database on the new machine, execute
9323    mysqladmin flush-privileges so that the server reloads the grant
9324    table information.
9326 2.14. Environment Variables
9328    This section lists all the environment variables that are used
9329    directly or indirectly by MySQL. Most of these can also be found
9330    in other places in this manual.
9332    Note that any options on the command line take precedence over
9333    values specified in option files and environment variables, and
9334    values in option files take precedence over values in environment
9335    variables.
9337    In many cases, it is preferable to use an option file instead of
9338    environment variables to modify the behavior of MySQL. See Section
9339    4.2.3.3, "Using Option Files."
9341    To set an environment variable within sh, ksh, bash, or zsh shells
9342    you can use the following commands:
9343 shell> ENVVAR=value
9344 shell> export ENVVAR
9346    The export is required if you want other sub-commands to inherit
9347    that value during execution. On more recent shells you can combine
9348    the export and setting processes, like this:
9349 shell> export set ENVVAR=value
9351    For the csh, or tcsh shells, use the setenv command:
9352 shell> setenv ENVVAR value
9354    Within the Windows Command Prompt use the set command to specify
9355    the value of a variable:
9356 shell> set ENVVAR=value
9358    On Unix, Linux, Mac OS X, and Windows, the set command without
9359    parameters will display the list of currently set variables.
9361    Table 2.22. MySQL Related Environment Variables
9362    Variable Description
9363    CXX The name of your C++ compiler (for running configure).
9364    CC The name of your C compiler (for running configure).
9365    CFLAGS Flags for your C compiler (for running configure).
9366    CXXFLAGS Flags for your C++ compiler (for running configure).
9367    DBI_USER The default user name for Perl DBI.
9368    DBI_TRACE Trace options for Perl DBI.
9369    HOME The default path for the mysql history file is
9370    $HOME/.mysql_history.
9371    LD_RUN_PATH Used to specify the location of libmysqlclient.so.
9372    MYSQL_DEBUG Debug trace options when debugging.
9373    MYSQL_GROUP_SUFFIX Option group suffix value (like specifying
9374    --defaults-group-suffix).
9375    MYSQL_HISTFILE The path to the mysql history file. If this
9376    variable is set, its value overrides the default for
9377    $HOME/.mysql_history.
9378    MYSQL_HOME The path to the directory in which the server-specific
9379    my.cnf file resides.
9380    MYSQL_HOST The default host name used by the mysql command-line
9381    client.
9382    MYSQL_PS1 The command prompt to use in the mysql command-line
9383    client.
9384    MYSQL_PWD The default password when connecting to mysqld. Note
9385    that using this is insecure. See Section 6.1.2.1, "End-User
9386    Guidelines for Password Security."
9387    MYSQL_TCP_PORT The default TCP/IP port number.
9388    MYSQL_UNIX_PORT The default Unix socket file name; used for
9389    connections to localhost.
9390    PATH Used by the shell to find MySQL programs.
9391    TMPDIR The directory where temporary files are created.
9392    TZ This should be set to your local time zone. See Section
9393    C.5.4.6, "Time Zone Problems."
9394    UMASK The user-file creation mode when creating files. See note
9395    following table.
9396    UMASK_DIR The user-directory creation mode when creating
9397    directories. See note following table.
9398    USER The default user name on Windows and NetWare when connecting
9399    to mysqld.
9401    For information about the mysql history file, see Section 4.5.1.3,
9402    "mysql Logging."
9404    The UMASK and UMASK_DIR variables, despite their names, are used
9405    as modes, not masks:
9407      * If UMASK is set, mysqld uses ($UMASK | 0600) as the mode for
9408        file creation, so that newly created files have a mode in the
9409        range from 0600 to 0666 (all values octal).
9411      * If UMASK_DIR is set, mysqld uses ($UMASK_DIR | 0700) as the
9412        base mode for directory creation, which then is AND-ed with
9413        ~(~$UMASK & 0666), so that newly created directories have a
9414        mode in the range from 0700 to 0777 (all values octal). The
9415        AND operation may remove read and write permissions from the
9416        directory mode, but not execute permissions.
9418    MySQL assumes that the value for UMASK or UMASK_DIR is in octal if
9419    it starts with a zero.
9421 2.15. Perl Installation Notes
9423    The Perl DBI module provides a generic interface for database
9424    access. You can write a DBI script that works with many different
9425    database engines without change. To use DBI, you must install the
9426    DBI module, as well as a DataBase Driver (DBD) module for each
9427    type of database server you want to access. For MySQL, this driver
9428    is the DBD::mysql module.
9430    Perl, and the DBD::MySQL module for DBI must be installed if you
9431    want to run the MySQL benchmark scripts; see Section 8.1.3, "The
9432    MySQL Benchmark Suite." They are also required for the MySQL
9433    Cluster ndb_size.pl utility; see Section 17.4.23, "ndb_size.pl ---
9434    NDBCLUSTER Size Requirement Estimator."
9435    Note
9437    Perl support is not included with MySQL distributions. You can
9438    obtain the necessary modules from http://search.cpan.org for Unix,
9439    or by using the ActiveState ppm program on Windows. The following
9440    sections describe how to do this.
9442    The DBI/DBD interface requires Perl 5.6.0, and 5.6.1 or later is
9443    preferred. DBI does not work if you have an older version of Perl.
9444    You should use DBD::mysql 4.009 or higher. Although earlier
9445    versions are available, they do not support the full functionality
9446    of MySQL 5.1.
9448 2.15.1. Installing Perl on Unix
9450    MySQL Perl support requires that you have installed MySQL client
9451    programming support (libraries and header files). Most
9452    installation methods install the necessary files. If you install
9453    MySQL from RPM files on Linux, be sure to install the developer
9454    RPM as well. The client programs are in the client RPM, but client
9455    programming support is in the developer RPM.
9457    The files you need for Perl support can be obtained from the CPAN
9458    (Comprehensive Perl Archive Network) at http://search.cpan.org.
9460    The easiest way to install Perl modules on Unix is to use the CPAN
9461    module. For example:
9462 shell> perl -MCPAN -e shell
9463 cpan> install DBI
9464 cpan> install DBD::mysql
9466    The DBD::mysql installation runs a number of tests. These tests
9467    attempt to connect to the local MySQL server using the default
9468    user name and password. (The default user name is your login name
9469    on Unix, and ODBC on Windows. The default password is "no
9470    password.") If you cannot connect to the server with those values
9471    (for example, if your account has a password), the tests fail. You
9472    can use force install DBD::mysql to ignore the failed tests.
9474    DBI requires the Data::Dumper module. It may be installed; if not,
9475    you should install it before installing DBI.
9477    It is also possible to download the module distributions in the
9478    form of compressed tar archives and build the modules manually.
9479    For example, to unpack and build a DBI distribution, use a
9480    procedure such as this:
9482     1. Unpack the distribution into the current directory:
9483 shell> gunzip < DBI-VERSION.tar.gz | tar xvf -
9484        This command creates a directory named DBI-VERSION.
9486     2. Change location into the top-level directory of the unpacked
9487        distribution:
9488 shell> cd DBI-VERSION
9490     3. Build the distribution and compile everything:
9491 shell> perl Makefile.PL
9492 shell> make
9493 shell> make test
9494 shell> make install
9496    The make test command is important because it verifies that the
9497    module is working. Note that when you run that command during the
9498    DBD::mysql installation to exercise the interface code, the MySQL
9499    server must be running or the test fails.
9501    It is a good idea to rebuild and reinstall the DBD::mysql
9502    distribution whenever you install a new release of MySQL. This
9503    ensures that the latest versions of the MySQL client libraries are
9504    installed correctly.
9506    If you do not have access rights to install Perl modules in the
9507    system directory or if you want to install local Perl modules, the
9508    following reference may be useful:
9509    http://servers.digitaldaze.com/extensions/perl/modules.html#module
9510    s
9512    Look under the heading "Installing New Modules that Require
9513    Locally Installed Modules."
9515 2.15.2. Installing ActiveState Perl on Windows
9517    On Windows, you should do the following to install the MySQL DBD
9518    module with ActiveState Perl:
9520     1. Get ActiveState Perl from
9521        http://www.activestate.com/Products/ActivePerl/ and install
9522        it.
9524     2. Open a console window.
9526     3. If necessary, set the HTTP_proxy variable. For example, you
9527        might try a setting like this:
9528 C:\> set HTTP_proxy=my.proxy.com:3128
9530     4. Start the PPM program:
9531 C:\> C:\perl\bin\ppm.pl
9533     5. If you have not previously done so, install DBI:
9534 ppm> install DBI
9536     6. If this succeeds, run the following command:
9537 ppm> install DBD-mysql
9539    This procedure should work with ActiveState Perl 5.6 or newer.
9541    If you cannot get the procedure to work, you should install the
9542    ODBC driver instead and connect to the MySQL server through ODBC:
9543 use DBI;
9544 $dbh= DBI->connect("DBI:ODBC:$dsn",$user,$password) ||
9545   die "Got error $DBI::errstr when connecting to $dsn\n";
9547 2.15.3. Problems Using the Perl DBI/DBD Interface
9549    If Perl reports that it cannot find the ../mysql/mysql.so module,
9550    the problem is probably that Perl cannot locate the
9551    libmysqlclient.so shared library. You should be able to fix this
9552    problem by one of the following methods:
9554      * Copy libmysqlclient.so to the directory where your other
9555        shared libraries are located (probably /usr/lib or /lib).
9557      * Modify the -L options used to compile DBD::mysql to reflect
9558        the actual location of libmysqlclient.so.
9560      * On Linux, you can add the path name of the directory where
9561        libmysqlclient.so is located to the /etc/ld.so.conf file.
9563      * Add the path name of the directory where libmysqlclient.so is
9564        located to the LD_RUN_PATH environment variable. Some systems
9565        use LD_LIBRARY_PATH instead.
9567    Note that you may also need to modify the -L options if there are
9568    other libraries that the linker fails to find. For example, if the
9569    linker cannot find libc because it is in /lib and the link command
9570    specifies -L/usr/lib, change the -L option to -L/lib or add -L/lib
9571    to the existing link command.
9573    If you get the following errors from DBD::mysql, you are probably
9574    using gcc (or using an old binary compiled with gcc):
9575 /usr/bin/perl: can't resolve symbol '__moddi3'
9576 /usr/bin/perl: can't resolve symbol '__divdi3'
9578    Add -L/usr/lib/gcc-lib/... -lgcc to the link command when the
9579    mysql.so library gets built (check the output from make for
9580    mysql.so when you compile the Perl client). The -L option should
9581    specify the path name of the directory where libgcc.a is located
9582    on your system.
9584    Another cause of this problem may be that Perl and MySQL are not
9585    both compiled with gcc. In this case, you can solve the mismatch
9586    by compiling both with gcc.
9588    You may see the following error from DBD::mysql when you run the
9589    tests:
9590 t/00base............install_driver(mysql) failed:
9591 Can't load '../blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mys
9593 ../blib/arch/auto/DBD/mysql/mysql.so: undefined symbol:
9594 uncompress at /usr/lib/perl5/5.00503/i586-linux/DynaLoader.pm line 16
9597    This means that you need to include the -lz compression library on
9598    the link line. That can be done by changing the following line in
9599    the file lib/DBD/mysql/Install.pm:
9600 $sysliblist .= " -lm";
9602    Change that line to:
9603 $sysliblist .= " -lm -lz";
9605    After this, you must run make realclean and then proceed with the
9606    installation from the beginning.
9608    Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights
9609    reserved. Legal Notices