~ubuntu-branches/ubuntu/lucid/mysql-dfsg-5.1/lucid-security

« back to all changes in this revision

Viewing changes to INSTALL-SOURCE

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 22:33:55 UTC
  • mto: (1.2.1) (37.1.1 lucid-security)
  • mto: This revision was merged to the branch mainline in revision 36.
  • Revision ID: package-import@ubuntu.com-20120222223355-ku1tb4r70osci6v2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
   of the procedure follows and later sections provide the details.
6
6
   If you plan to upgrade an existing version of MySQL to a newer
7
7
   version rather than install MySQL for the first time, see Section
8
 
   2.4.1, "Upgrading MySQL," for information about upgrade procedures
9
 
   and about issues that you should consider before upgrading.
 
8
   2.13.1, "Upgrading MySQL," for information about upgrade
 
9
   procedures and about issues that you should consider before
 
10
   upgrading.
10
11
 
11
12
   If you are interested in migrating to MySQL from another database
12
 
   system, you may wish to read Section A.8, "MySQL 5.1 FAQ ---
 
13
   system, you may wish to read Section B.8, "MySQL 5.1 FAQ:
13
14
   Migration," which contains answers to some common questions
14
15
   concerning migration issues.
15
16
 
17
18
       platform.
18
19
       Please note that not all platforms are equally suitable for
19
20
       running MySQL, and that not all platforms on which MySQL is
20
 
       known to run are officially supported by Sun Microsystems,
21
 
       Inc.:
 
21
       known to run are officially supported by Oracle Corporation:
22
22
 
23
23
    2. Choose which distribution to install.
24
24
       Several versions of MySQL are available, and most are
43
43
       Binaries on Unix/Linux."
44
44
       To install MySQL from a source distribution or from the
45
45
       current development source tree, use the instructions in
46
 
       Section 2.3, "MySQL Installation Using a Source Distribution."
 
46
       Section 2.11, "Installing MySQL from Source."
47
47
 
48
 
    5. Perform any necessary post-installation setup.
49
 
       After installing MySQL, read Section 2.13, "Post-Installation
 
48
    5. Perform any necessary postinstallation setup.
 
49
       After installing MySQL, read Section 2.12, "Postinstallation
50
50
       Setup and Testing." This section contains important
51
51
       information about making sure the MySQL server is working
52
52
       properly. It also describes how to secure the initial MySQL
58
58
       for MySQL must be available. See Section 2.15, "Perl
59
59
       Installation Notes."
60
60
 
 
61
   Instructions for installing MySQL on different platforms and
 
62
   environments is available on a platform by platform basis:
 
63
 
 
64
     * Unix, Linux, FreeBSD
 
65
       For instructions on installing MySQL on most Linux and Unix
 
66
       platforms using a generic binary (for example, a .tar.gz
 
67
       package), see Section 2.2, "Installing MySQL from Generic
 
68
       Binaries on Unix/Linux."
 
69
       For information on building MySQL entirely from the source
 
70
       code distributions or the source code repositories, see
 
71
       Section 2.11, "Installing MySQL from Source"
 
72
       For specific platform help on installation, configuration, and
 
73
       building from source see the corresponding platform section:
 
74
 
 
75
          + Linux, including notes on distribution specific methods,
 
76
            see Section 2.5, "Installing MySQL on Linux."
 
77
 
 
78
          + Solaris and OpenSolaris, including PKG and IPS formats,
 
79
            see Section 2.6, "Installing MySQL on Solaris and
 
80
            OpenSolaris."
 
81
 
 
82
          + IBM AIX, see Section 2.6, "Installing MySQL on Solaris
 
83
            and OpenSolaris."
 
84
 
 
85
          + Hewlett-Packard HP-UX, including the DEPOT package
 
86
            format, see Section 2.8, "Installing MySQL on HP-UX."
 
87
 
 
88
          + FreeBSD, see Section 2.9, "Installing MySQL on FreeBSD."
 
89
 
 
90
     * Microsoft Windows
 
91
       For instructions on installing MySQL on Microsoft Windows,
 
92
       using either a Zipped binary or an MSI package, see Section
 
93
       2.3, "Installing MySQL on Microsoft Windows."
 
94
       For information on using the MySQL Server Instance Config
 
95
       Wizard, see Section 2.3.4, "Using the MySQL Server Instance
 
96
       Config Wizard."
 
97
       For details and instructions on building MySQL from source
 
98
       code using Microsoft Visual Studio, see Section 2.11.7,
 
99
       "Installing MySQL from Source on Windows."
 
100
 
 
101
     * Mac OS X
 
102
       For installation on Mac OS X, including using both the binary
 
103
       package and native PKG formats, see Section 2.4, "Installing
 
104
       MySQL on Mac OS X."
 
105
       For information on making use of the MySQL Startup Item to
 
106
       automatically start and stop MySQL, see Section 2.4.3,
 
107
       "Installing the MySQL Startup Item."
 
108
       For information on the MySQL Preference Pane, see Section
 
109
       2.4.4, "Installing and Using the MySQL Preference Pane."
 
110
 
 
111
     * IBM i5/OS
 
112
       For instructions on installing, starting, and stopping MySQL
 
113
       on i5/OS, see Section 2.10, "Installing MySQL on i5/OS."
 
114
 
61
115
2.1. General Installation Guidance
62
116
 
63
117
   The immediately following sections contain the information
67
121
   distributions, see the instructions at Section 2.2, "Installing
68
122
   MySQL from Generic Binaries on Unix/Linux" or the corresponding
69
123
   section for your platform if available. To build MySQL from
70
 
   source, use the instructions in Section 2.3, "MySQL Installation
71
 
   Using a Source Distribution."
 
124
   source, use the instructions in Section 2.11, "Installing MySQL
 
125
   from Source."
72
126
 
73
127
2.1.1. Operating Systems Supported by MySQL Community Server
74
128
 
75
129
   This section lists the operating systems on which MySQL Community
76
130
   Server is known to run.
77
 
 
78
 
Important
79
 
 
80
 
   Sun Microsystems, Inc. does not necessarily provide official
81
 
   support for all the platforms listed in this section. For
82
 
   information about those platforms that are officially supported,
83
 
   see MySQL Server Supported Platforms
84
 
   (http://www.mysql.com/support/supportedplatforms.html) on the
85
 
   MySQL Web site.
 
131
   Important
 
132
 
 
133
   Oracle Corporation does not necessarily provide official support
 
134
   for all the platforms listed in this section. For information
 
135
   about those platforms that are officially supported, see
 
136
   http://www.mysql.com/support/supportedplatforms.html on the MySQL
 
137
   Web site.
86
138
 
87
139
   We use GNU Autoconf, so it is possible to port MySQL to all modern
88
140
   systems that have a C++ compiler and a working implementation of
93
145
   MySQL has been reported to compile successfully on the following
94
146
   combinations of operating system and thread package.
95
147
 
96
 
     * AIX 4.x, 5.x with native threads. See Section 2.12,
97
 
       "Installing MySQL on AIX." AIX 5.3 should be upgraded to
98
 
       technology level 7 (5300-07).
 
148
     * AIX 4.x, 5.x with native threads. See Section 2.7, "Installing
 
149
       MySQL on IBM AIX." AIX 5.3 should be upgraded to technology
 
150
       level 7 (5300-07).
99
151
 
100
 
     * FreeBSD 5.x and up with native threads. See Section 2.10,
 
152
     * FreeBSD 5.x and up with native threads. See Section 2.9,
101
153
       "Installing MySQL on FreeBSD."
102
154
 
103
 
     * HP-UX 11.x with the native threads. See Section 2.11,
 
155
     * HP-UX 11.x with the native threads. See Section 2.8,
104
156
       "Installing MySQL on HP-UX."
105
157
 
106
 
     * Linux, builds on all fairly recent Linux distributions with
107
 
       glibc 2.3. See Section 2.6, "Installing MySQL on Linux."
 
158
     * Linux. Builds on all recent Linux distributions based on the
 
159
       2.6 kernel. See Section 2.5, "Installing MySQL on Linux."
108
160
 
109
 
     * Mac OS X. See Section 2.7, "Installing MySQL on Mac OS X."
 
161
     * Mac OS X. See Section 2.4, "Installing MySQL on Mac OS X."
110
162
 
111
163
     * Solaris 2.8 on SPARC and x86, including support for native
112
 
       threads. See Section 2.8.1, "Solaris Notes."
 
164
       threads. See Section 2.6, "Installing MySQL on Solaris and
 
165
       OpenSolaris."
113
166
 
114
167
     * Windows 2000, Windows XP, Windows Vista, Windows Server 2003,
115
 
       and Windows Server 2008. See Section 2.5, "Installing MySQL on
116
 
       Windows."
 
168
       and Windows Server 2008. See Section 2.3, "Installing MySQL on
 
169
       Microsoft Windows."
117
170
 
118
171
   MySQL has also been known to run on other systems in the past. See
119
172
   Section 2.1, "General Installation Guidance." Some porting effort
148
201
       by the ability of the file system to deal with large files and
149
202
       dealing with them efficiently.
150
203
 
151
 
     * Our level of expertise here at Sun Microsystems, Inc. with the
 
204
     * Our level of expertise here at Oracle Corporation with the
152
205
       platform. If we know a platform well, we enable
153
206
       platform-specific optimizations and fixes at compile time. We
154
207
       can also provide advice on configuring your system optimally
175
228
   The first decision to make is whether you want to use a production
176
229
   (stable) release or a development release. In the MySQL
177
230
   development process, multiple release series co-exist, each at a
178
 
   different stage of maturity:
179
 
 
180
 
     * MySQL 5.5 is the current development release series.
181
 
 
182
 
     * MySQL 5.1 is the current General Availability (Production)
183
 
       release series. New releases are issued for bugfixes only; no
184
 
       new features are being added that could affect stability.
185
 
 
186
 
     * MySQL 5.0 is the previous stable (production-quality) release
187
 
       series.
188
 
 
189
 
     * MySQL 4.1, 4.0, and 3.23 are old stable (production-quality)
190
 
       release series. MySQL 4.1 is now at the end of the product
191
 
       lifecycle. Active development and support for these versions
192
 
       has ended.
193
 
       Extended support for MySQL 4.1 remains available. According to
194
 
       the MySQL Lifecycle Policy
195
 
       (http://www.mysql.com/about/legal/lifecycle/), only Security
196
 
       and Severity Level 1 issues are still being fixed for MySQL
197
 
       4.1.
198
 
 
199
 
   We do not believe in a complete code freeze because this prevents
200
 
   us from making bugfixes and other fixes that must be done. By
201
 
   "somewhat frozen" we mean that we may add small things that should
202
 
   not affect anything that currently works in a production release.
203
 
   Naturally, relevant bugfixes from an earlier series propagate to
204
 
   later series.
 
231
   different stage of maturity.
 
232
 
 
233
Production Releases
 
234
 
 
235
 
 
236
     * MySQL 5.5: Latest General Availability (Production) release
 
237
 
 
238
     * MySQL 5.1: Previous stable (production-quality) release
 
239
 
 
240
     * MySQL 5.0: Older stable release nearing the end of the product
 
241
       lifecycle
 
242
 
 
243
Development Release
 
244
 
 
245
 
 
246
     * MySQL 5.6: Current release under development (pre-Production)
 
247
 
 
248
   MySQL 4.1, 4.0, and 3.23 are old releases that are no longer
 
249
   supported.
 
250
 
 
251
   See http://www.mysql.com/about/legal/lifecycle/ for information
 
252
   about support policies and schedules.
205
253
 
206
254
   Normally, if you are beginning to use MySQL for the first time or
207
255
   trying to port it to some system for which there is no binary
208
 
   distribution, go with the General Availability release series.
209
 
   Currently, this is MySQL 5.1. All MySQL releases, even those from
210
 
   development series, are checked with the MySQL benchmarks and an
211
 
   extensive test suite before being issued.
 
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.
212
260
 
213
261
   If you are running an older system and want to upgrade, but do not
214
262
   want to take the chance of having a nonseamless upgrade, you
219
267
 
220
268
   If you want to use new features not present in the production
221
269
   release series, you can use a version from a development series.
222
 
   Note that development releases are not as stable as production
 
270
   Be aware that development releases are not as stable as production
223
271
   releases.
224
272
 
 
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.
 
278
 
225
279
   If you want to use the very latest sources containing all current
226
 
   patches and bugfixes, you can use one of our Bazaar repositories.
227
 
   These are not "releases" as such, but are available as previews of
228
 
   the code on which future releases are to be based.
 
280
   patches and bugfixes, you can use one of our source code
 
281
   repositories (see Section 2.11.3, "Installing MySQL from 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.
229
285
 
230
 
   The MySQL naming scheme uses release names that consist of three
231
 
   numbers and a suffix; for example, mysql-5.0.12-beta. The numbers
232
 
   within the release name are interpreted as follows:
 
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:
233
289
 
234
290
     * The first number (5) is the major version and describes the
235
291
       file format. All MySQL 5 releases have the same file format.
236
292
 
237
 
     * The second number (0) is the release level. Taken together,
 
293
     * The second number (1) is the release level. Taken together,
238
294
       the major version and release level constitute the release
239
295
       series number.
240
296
 
241
 
     * The third number (12) is the version number within the release
 
297
     * The third number (29) is the version number within the release
242
298
       series. This is incremented for each new release. Usually you
243
299
       want the latest version for the series you have chosen.
244
300
 
255
311
 
256
312
     * alpha indicates that the release is for preview purposes only.
257
313
       Known bugs should be documented in the News section (see
258
 
       Appendix C, "MySQL Change History"). Most alpha releases
 
314
       Appendix D, "MySQL Change History"). Most alpha releases
259
315
       implement new commands and extensions. Active development that
260
316
       may involve major code changes can occur in an alpha release.
261
317
       However, we do conduct testing before issuing a release.
283
339
       serious bugs, and suitable for use in production systems. Only
284
340
       critical bugfixes are applied to the release.
285
341
 
286
 
   MySQL uses a naming scheme that is slightly different from most
287
 
   other products. In general, it is usually safe to use any version
288
 
   that has been out for a couple of weeks without being replaced by
289
 
   a new version within the same release series.
290
 
 
291
342
   All releases of MySQL are run through our standard tests and
292
343
   benchmarks to ensure that they are relatively safe to use. Because
293
344
   the standard tests are extended over time to check for all
295
346
 
296
347
   All releases have been tested at least with these tools:
297
348
 
298
 
     * An internal test suite
299
 
       The mysql-test directory contains an extensive set of test
300
 
       cases. We run these tests for every server binary. See Section
301
 
       22.1.2, "MySQL Test Suite," for more information about this
302
 
       test suite.
303
 
 
304
 
     * The MySQL benchmark suite
305
 
       This suite runs a range of common queries. It is also a test
306
 
       to determine whether the latest batch of optimizations
307
 
       actually made the code faster. See Section 7.1.3, "The MySQL
308
 
       Benchmark Suite."
309
 
 
310
 
     * The crash-me test
311
 
       This test tries to determine what features the database
312
 
       supports and what its capabilities and limitations are. See
 
349
     * An internal test suite.  The mysql-test directory contains an
 
350
       extensive set of test cases. We run these tests for every
 
351
       server binary. See Section 21.1.2, "The MySQL Test Suite," for
 
352
       more information about this test suite.
 
353
 
 
354
     * The MySQL benchmark suite.  This suite runs a range of common
 
355
       queries. It is also a test to determine whether the latest
 
356
       batch of optimizations actually made the code faster. See
313
357
       Section 7.1.3, "The MySQL Benchmark Suite."
314
358
 
315
 
   We also test the newest MySQL version in our internal production
316
 
   environment, on at least one machine. We have more than 100GB of
317
 
   data to work with.
 
359
   We also perform additional integration and nonfunctional testing
 
360
   of the latest MySQL version in our internal production
 
361
   environment. Integration testing is done with different
 
362
   connectors, storage engines, replication modes, backup,
 
363
   partitioning, stored programs, and so forth in various
 
364
   combinations. Additional nonfunctional testing is done in areas of
 
365
   performance, concurrency, stress, high volume, upgrade and
 
366
   downgrade.
318
367
 
319
368
2.1.2.2. Choosing a Distribution Format
320
369
 
368
417
       recompile it with support for only the character sets you
369
418
       need.
370
419
 
371
 
     * You have a special compiler (such as pgcc) or want to use
372
 
       compiler options that are better optimized for your processor.
373
 
       Binary distributions are compiled with options that should
374
 
       work on a variety of processors from the same processor
375
 
       family.
376
 
 
377
420
     * You want to use the latest sources from one of the Bazaar
378
421
       repositories to have access to all current bugfixes. For
379
422
       example, if you have found a bug and reported it to the MySQL
402
445
 
403
446
   No one is required to download a new release. The News section
404
447
   helps you determine whether the new release has something you
405
 
   really want. See Appendix C, "MySQL Change History."
 
448
   really want. See Appendix D, "MySQL Change History."
406
449
 
407
450
   We use the following policy when updating MySQL:
408
451
 
409
452
     * Enterprise Server releases are meant to appear every 18
410
453
       months, supplemented by quarterly service packs and monthly
411
 
       rapid updates. Community Server releases are meant to appear
412
 
       2-3 times per year.
 
454
       rapid updates. Community Server releases are meant to appear 2
 
455
       to 3 times per year.
413
456
 
414
457
     * Releases are issued within each series. For each release, the
415
458
       last number in the version is one more than the previous
438
481
   can also find information there about becoming a MySQL mirror site
439
482
   and how to report a bad or out-of-date mirror.
440
483
 
441
 
   Our main mirror is located at http://mirrors.sunsite.dk/mysql/.
 
484
   To obtain the latest development source, see Section 2.11.3,
 
485
   "Installing MySQL from a Development Source Tree."
442
486
 
443
487
2.1.4. Verifying Package Integrity Using MD5 Checksums or GnuPG
444
488
 
475
519
shell> md5sum package_name
476
520
 
477
521
   Example:
478
 
shell> md5sum mysql-standard-5.1.41-linux-i686.tar.gz
479
 
aaab65abbec64d5e907dcd41b8699945  mysql-standard-5.1.41-linux-i686.ta
 
522
shell> md5sum mysql-standard-5.1.62-linux-i686.tar.gz
 
523
aaab65abbec64d5e907dcd41b8699945  mysql-standard-5.1.62-linux-i686.ta
480
524
r.gz
481
525
 
482
526
   You should verify that the resulting checksum (the string of
483
527
   hexadecimal digits) matches the one displayed on the download page
484
528
   immediately below the respective package.
485
 
 
486
 
Note
 
529
   Note
487
530
 
488
531
   Make sure to verify the checksum of the archive file (for example,
489
532
   the .zip or .tar.gz file) and not of the files that are contained
516
559
 
517
560
   To verify the signature for a specific package, you first need to
518
561
   obtain a copy of our public GPG build key, which you can download
519
 
   from http://keyserver.pgp.com/. The key that you want to obtain is
520
 
   named build@mysql.com. Alternatively, you can cut and paste the
521
 
   key directly from the following text:
 
562
   from http://pgp.mit.com/. The key that you want to obtain is named
 
563
   mysql-build@oss.oracle.com. Alternatively, you can cut and paste
 
564
   the key directly from the following text:
522
565
-----BEGIN PGP PUBLIC KEY BLOCK-----
523
 
Version: GnuPG v1.0.6 (GNU/Linux)
524
 
Comment: For info see http://www.gnupg.org
 
566
Version: PGP Universal 2.9.1 (Build 347)
525
567
 
526
568
mQGiBD4+owwRBAC14GIfUfCyEDSIePvEW3SAFUdJBtoQHH/nJKZyQT7h9bPlUWC3
527
569
RODjQReyCITRrdwyrKUGku2FmeVGwn2u2WmDMNABLnpprWPkBdCk96+OmSLN9brZ
531
573
K2HtkrPbP72vwsEKMYhhr0eKCbtLGfls9krjJ6sBgACyP/Vb7hiPwxh6rDZ7ITnE
532
574
kYpXBACmWpP8NJTkamEnPCia2ZoOHODANwpUkP43I7jsDmgtobZX9qnrAXw+uNDI
533
575
QJEXM6FSbi0LLtZciNlYsafwAPEOMDKpMqAK6IyisNtPvaLd8lH0bPAnWqcyefep
534
 
rv0sxxqUEMcM3o7wwgfN83POkDasDbs3pjwPhxvhz6//62zQJ7Q7TXlTUUwgUGFj
535
 
a2FnZSBzaWduaW5nIGtleSAod3d3Lm15c3FsLmNvbSkgPGJ1aWxkQG15c3FsLmNv
536
 
bT6IXQQTEQIAHQUCR6yUtAUJDTBYqAULBwoDBAMVAwIDFgIBAheAAAoJEIxxjTtQ
537
 
cuH1rpIAn38+BlBI815Dou9VXMIAsQEk4G3tAJ9+Cz69Y/Xwm611lzteJrCAA32+
538
 
aYhMBBMRAgAMBQI+PqPRBYMJZgC7AAoJEElQ4SqycpHyJOEAn1mxHijft00bKXvu
539
 
cSo/pECUmppiAJ41M9MRVj5VcdH/KN/KjRtW6tHFPYhMBBMRAgAMBQI+QoIDBYMJ
540
 
YiKJAAoJELb1zU3GuiQ/lpEAoIhpp6BozKI8p6eaabzF5MlJH58pAKCu/ROofK8J
541
 
Eg2aLos+5zEYrB/LsohGBBARAgAGBQI/rOOvAAoJEK/FI0h4g3QP9pYAoNtSISDD
542
 
AAU2HafyAYlLD/yUC4hKAJ0czMsBLbo0M/xPaJ6Ox9Q5Hmw2uIhGBBARAgAGBQI/
543
 
tEN3AAoJEIWWr6swc05mxsMAnRag9X61Ygu1kbfBiqDku4czTd9pAJ4q5W8KZ0+2
544
 
ujTrEPN55NdWtnXj4YhGBBARAgAGBQJDW7PqAAoJEIvYLm8wuUtcf3QAnRCyqF0C
545
 
pMCTdIGc7bDO5I7CIMhTAJ0UTGx0O1d/VwvdDiKWj45N2tNbYIhGBBMRAgAGBQJE
546
 
8TMmAAoJEPZJxPRgk1MMCnEAoIm2pP0sIcVh9Yo0YYGAqORrTOL3AJwIbcy+e8HM
547
 
NSoNV5u51RnrVKie34hMBBARAgAMBQJBgcsBBYMGItmLAAoJEBhZ0B9ne6HsQo0A
548
 
nA/LCTQ3P5kvJvDhg1DsfVTFnJxpAJ49WFjg/kIcaN5iP1JfaBAITZI3H4hMBBAR
549
 
AgAMBQJBgcs0BYMGItlYAAoJEIHC9+viE7aSIiMAnRVTVVAfMXvJhV6D5uHfWeeD
550
 
046TAJ4kjwP2bHyd6DjCymq+BdEDz63axohMBBARAgAMBQJBgctiBYMGItkqAAoJ
551
 
EGtw7Nldw/RzCaoAmwWM6+Rj1zl4D/PIys5nW48Hql3hAJ0bLOBthv96g+7oUy9U
552
 
j09Uh41lF4hMBBARAgAMBQJB0JMkBYMF1BFoAAoJEH0lygrBKafCYlUAoIb1r5D6
553
 
qMLMPMO1krHk3MNbX5b5AJ4vryx5fw6iJctC5GWJ+Y8ytXab34hMBBARAgAMBQJC
554
 
K1u6BYMFeUjSAAoJEOYbpIkV67mr8xMAoJMy+UJC0sqXMPSxh3BUsdcmtFS+AJ9+
555
 
Z15LpoOnAidTT/K9iODXGViK6ohMBBIRAgAMBQJAKlk6BYMHektSAAoJEDyhHzSU
556
 
+vhhJlwAnA/gOdwOThjO8O+dFtdbpKuImfXJAJ0TL53QKp92EzscZSz49lD2YkoE
557
 
qohMBBIRAgAMBQJAPfq6BYMHZqnSAAoJEPLXXGPjnGWcst8AoLQ3MJWqttMNHDbl
558
 
xSyzXhFGhRU8AJ4ukRzfNJqElQHQ00ZM2WnCVNzOUIhMBBIRAgAMBQJBDgqEBYMG
559
 
lpoIAAoJEDnKK/Q9aopf/N0AniE2fcCKO1wDIwusuGVlC+JvnnWbAKDDoUSEYuNn
560
 
5qzRbrzWW5zBno/Nb4hMBBIRAgAMBQJCgKU0BYMFI/9YAAoJEAQNwIV8g5+o4yQA
561
 
nA9QOFLV5POCddyUMqB/fnctuO9eAJ4sJbLKP/Z3SAiTpKrNo+XZRxauqIhMBBMR
562
 
AgAMBQI+TU2EBYMJV1cIAAoJEC27dr+t1MkzBQwAoJU+RuTVSn+TI+uWxUpT82/d
563
 
s5NkAJ9bnNodffyMMK7GyMiv/TzifiTD+4hMBBMRAgAMBQJB14B2BYMFzSQWAAoJ
564
 
EGbv28jNgv0+P7wAn13uu8YkhwfNMJJhWdpK2/qM/4AQAJ40drnKW2qJ5EEIJwtx
565
 
pwapgrzWiYhMBBMRAgAMBQJCGIEOBYMFjCN+AAoJEHbBAxyiMW6hoO4An0Ith3Kx
566
 
5/sixbjZR9aEjoePGTNKAJ94SldLiESaYaJx2lGIlD9bbVoHQYhdBBMRAgAdBQJH
567
 
rJTPBQkNMFioBQsHCgMEAxUDAgMWAgECF4AACgkQjHGNO1By4fV0KgCgsLpG2wP0
568
 
rc3s07Fync9g7MfairMAoIUefSNKrGTsTxvLeyH4DLzJW/QFiHsEMBECADsFAkJ3
569
 
NfU0HQBPb3BzLi4uIHNob3VsZCBoYXZlIGJlZW4gbG9jYWwhIEknbSAqc28qIHN0
570
 
dXBpZC4uLgAKCRA5yiv0PWqKX+9HAJ0WjTx/rqgouK4QCrOV/2IOU+jMQQCfYSC8
571
 
JgsIIeN8aiyuStTdYrk0VWCIjwQwEQIATwUCRW8Av0gdAFNob3VsZCBoYXZlIGJl
572
 
ZW4gYSBsb2NhbCBzaWduYXR1cmUsIG9yIHNvbWV0aGluZyAtIFdURiB3YXMgSSB0
573
 
aGlua2luZz8ACgkQOcor9D1qil+g+wCfcFWoo5qUl4XTE9K8tH3Q+xGWeYYAnjii
574
 
KxjtOXc0ls+BlqXxbfZ9uqBsiQIiBBABAgAMBQJBgcuFBYMGItkHAAoJEKrj5s5m
575
 
oURoqC8QAIISudocbJRhrTAROOPoMsReyp46Jdp3iL1oFDGcPfkZSBwWh8L+cJjh
576
 
dycIwwSeZ1D2h9S5Tc4EnoE0khsS6wBpuAuih5s//coRqIIiLKEdhTmNqulkCH5m
577
 
imCzc5zXWZDW0hpLr2InGsZMuh2QCwAkB4RTBM+r18cUXMLV4YHKyjIVaDhsiPP/
578
 
MKUj6rJNsUDmDq1GiJdOjySjtCFjYADlQYSD7zcd1vpqQLThnZBESvEoCqumEfOP
579
 
xemNU6xAB0CL+pUpB40pE6Un6Krr5h6yZxYZ/N5vzt0Y3B5UUMkgYDSpjbulNvaU
580
 
TFiOxEU3gJvXc1+h0BsxM7FwBZnuMA8LEA+UdQb76YcyuFBcROhmcEUTiducLu84
581
 
E2BZ2NSBdymRQKSinhvXsEWlH6Txm1gtJLynYsvPi4B4JxKbb+awnFPusL8W+gfz
582
 
jbygeKdyqzYgKj3M79R3geaY7Q75Kxl1UogiOKcbI5VZvg47OQCWeeERnejqEAdx
583
 
EQiwGA/ARhVOP/1l0LQA7jg2P1xTtrBqqC2ufDB+v+jhXaCXxstKSW1lTbv/b0d6
584
 
454UaOUV7RisN39pE2zFvJvY7bwfiwbUJVmYLm4rWJAEOJLIDtDRtt2h8JahDObm
585
 
3CWkpadjw57S5v1c/mn+xV9yTgVx5YUfC/788L1HNKXfeVDq8zbAiQIiBBMBAgAM
586
 
BQJCnwocBYMFBZpwAAoJENjCCglaJFfPIT4P/25zvPp8ixqV85igs3rRqMBtBsj+
587
 
5EoEW6DJnlGhoi26yf1nasC2frVasWG7i4JIm0U3WfLZERGDjR/nqlOCEqsP5gS3
588
 
43N7r4UpDkBsYh0WxH/ZtST5llFK3zd7XgtxvqKL98l/OSgijH2W2SJ9DGpjtO+T
589
 
iegq7igtJzw7Vax9z/LQH2xhRQKZR9yernwMSYaJ72i9SyWbK3k0+e95fGnlR5pF
590
 
zlGq320rYHgD7v9yoQ2t1klsAxK6e3b7Z+RiJG6cAU8o8F0kGxjWzF4v8D1op7S+
591
 
IoRdB0Bap01ko0KLyt3+g4/33/2UxsW50BtfqcvYNJvU4bZns1YSqAgDOOanBhg8
592
 
Ip5XPlDxH6J/3997n5JNj/nk5ojfd8nYfe/5TjflWNiput6tZ7frEki1wl6pTNbv
593
 
V9C1eLUJMSXfDZyHtUXmiP9DKNpsucCUeBKWRKLqnsHLkLYydsIeUJ8+ciKc+EWh
594
 
FxEY+Ml72cXAaz5BuW9L8KHNzZZfez/ZJabiARQpFfjOwAnmhzJ9r++TEKRLEr96
595
 
taUI9/8nVPvT6LnBpcM38Td6dJ639YvuH3ilAqmPPw50YvglIEe4BUYD5r52Seqc
596
 
8XQowouGOuBX4vs7zgWFuYA/s9ebfGaIw+uJd/56Xl9ll6q5CghqB/yt1EceFEnF
597
 
CAjQc2SeRo6qzx22uQINBD4+ox0QCADv4Yl/Fsx1jjCyU+eMf2sXg3ap9awQ3+XF
598
 
pmglhzdrozTZYKceXpqFPb+0ErbDVAjhgW15HjuAK+2Bvo7Ukd986jYd8uZENGJG
599
 
N3UNMIep7JfsIeFyCGP901GVbZnSXlAURyZX1TRWGndoV9YLhSN+zctT6GQBbMTv
600
 
NoPlwf0nvK//rG5lXDjXXHSHhSqxNxYy7SIzUHMQupfUNjsvCg8Rv871GRt/h+Yt
601
 
7XUTMhoJrg+oBFdBlzh2FKKcy3ordfgGtGwpN+jMG7vgXjsPwiVt/m9Jgdu4Tmn/
602
 
WggPOeSD+nyRb7cXG5avJxyKoVNw3PbXnLJff0tcWeUvMpRv8XkbAAMFB/4vCqpr
603
 
wIatF+w4AnGKbrcId+3LmZRzmtRKdOyUZgQg4JHUF5Bq7I9ls8OwMP0xnVlpJp9q
604
 
cW/AUbouXH3GRTu3Or68ouhaSbi7nF/e+fnlWOdJ3VpD15CdRxeIvhycEahNs5Yj
605
 
f0RzLOCyXMF0L74w+NxBNwDunolRWw/qgAHcVBaDni25SjQRzxuwzxvcS/jYua5B
606
 
Pk10ocbAexdM+2XSSWThtCTg5qMeyLLUExqGlPbuNaMmUyIlz4hYnSaCGQoe33bq
607
 
z/KZ91/keR1DVzK+zPm2vJUjcXHvxd5Jh9C+67CqnYfXf2lcYSSDSfop1Q5611la
608
 
F7vRgY0/DXKNYlPUiEwEGBECAAwFAkeslPwFCQ0wWN8ACgkQjHGNO1By4fWlzgCf
609
 
Qj3rkfcljYZOuLOn50J7PFuF7FoAnjwWGhwVi9+Fm2B5RZvpo++BBkdP
610
 
=Xquv
 
576
rv0sxxqUEMcM3o7wwgfN83POkDasDbs3pjwPhxvhz6//62zQJ7Q2TXlTUUwgUmVs
 
577
ZWFzZSBFbmdpbmVlcmluZyA8bXlzcWwtYnVpbGRAb3NzLm9yYWNsZS5jb20+iGYE
 
578
ExECACYCGyMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAUCTnc+KgUJE/sCFQAKCRCM
 
579
cY07UHLh9SbMAJ4l1+qBz2BZNSGCZwwA6YbhGPC7FwCgp8z5TzIw4YQuL5NGJ/sy
 
580
0oSazqmJASIEEAECAAwFAk53QS4FAwASdQAACgkQlxC4m8pXrXwJ8Qf/be/UO9mq
 
581
foc2sMyhwMpN4/fdBWwfLkA12FXQDOQMvwH9HsmEjnfUgYKXschZRi+DuHXe1P7l
 
582
8G2aQLubhBsQf9ejKvRFTzuWMQkdIq+6Koulxv6ofkCcv3d1xtO2W7nb5yxcpVBP
 
583
rRfGFGebJvZa58DymCNgyGtAU6AOz4veavNmI2+GIDQsY66+tYDvZ+CxwzdYu+HD
 
584
V9HmrJfc6deM0mnBn7SRjqzxJPgoTQhihTav6q/R5/2p5NvQ/H84OgS6GjosfGc2
 
585
duUDzCP/kheMRKfzuyKCOHQPtJuIj8++gfpHtEU7IDUX1So3c9n0PdpeBvclsDbp
 
586
RnCNxQWU4mBot7kCDQQ+PqMdEAgA7+GJfxbMdY4wslPnjH9rF4N2qfWsEN/lxaZo
 
587
JYc3a6M02WCnHl6ahT2/tBK2w1QI4YFteR47gCvtgb6O1JHffOo2HfLmRDRiRjd1
 
588
DTCHqeyX7CHhcghj/dNRlW2Z0l5QFEcmV9U0Vhp3aFfWC4Ujfs3LU+hkAWzE7zaD
 
589
5cH9J7yv/6xuZVw411x0h4UqsTcWMu0iM1BzELqX1DY7LwoPEb/O9Rkbf4fmLe11
 
590
EzIaCa4PqARXQZc4dhSinMt6K3X4BrRsKTfozBu74F47D8Ilbf5vSYHbuE5p/1oI
 
591
Dznkg/p8kW+3FxuWrycciqFTcNz215yyX39LXFnlLzKUb/F5GwADBQf+Lwqqa8CG
 
592
rRfsOAJxim63CHfty5mUc5rUSnTslGYEIOCR1BeQauyPZbPDsDD9MZ1ZaSafanFv
 
593
wFG6Llx9xkU7tzq+vKLoWkm4u5xf3vn55VjnSd1aQ9eQnUcXiL4cnBGoTbOWI39E
 
594
cyzgslzBdC++MPjcQTcA7p6JUVsP6oAB3FQWg54tuUo0Ec8bsM8b3Ev42LmuQT5N
 
595
dKHGwHsXTPtl0klk4bQk4OajHsiy1BMahpT27jWjJlMiJc+IWJ0mghkKHt926s/y
 
596
mfdf5HkdQ1cyvsz5tryVI3Fx78XeSYfQvuuwqp2H139pXGEkg0n6KdUOetdZWhe7
 
597
0YGNPw1yjWJT1IhUBBgRAgAMBQJOdz3tBQkT+wG4ABIHZUdQRwABAQkQjHGNO1By
 
598
4fUUmwCbBYr2+bBEn/L2BOcnw9Z/QFWuhRMAoKVgCFm5fadQ3Afi+UQlAcOphrnJ
 
599
=Eto8
611
600
-----END PGP PUBLIC KEY BLOCK-----
612
601
 
613
602
   To import the build key into your personal public GPG keyring, use
614
603
   gpg --import. For example, if you have saved the key in a file
615
604
   named mysql_pubkey.asc, the import command looks like this:
616
605
shell> gpg --import mysql_pubkey.asc
617
 
gpg: key 5072E1F5: public key "MySQL Package signing key (www.mysql.c
618
 
om) <build@mysql.com>" imported
 
606
gpg: key 5072E1F5: public key "MySQL Release Engineering
 
607
<mysql-build@oss.oracle.com>" imported
619
608
gpg: Total number processed: 1
620
609
gpg:               imported: 1
621
610
gpg: no ultimately trusted keys found
623
612
   You can also download the key from the public keyserver using the
624
613
   public key id, 5072E1F5:
625
614
shell> gpg --recv-keys 5072E1F5
626
 
gpg: requesting key 5072E1F5 from hkp server subkeys.pgp.net
627
 
gpg: key 5072E1F5: "MySQL Package signing key (www.mysql.com) <build@
628
 
mysql.com>" 2 new signatures
 
615
gpg: requesting key 5072E1F5 from hkp server keys.gnupg.net
 
616
gpg: key 5072E1F5: "MySQL Release Engineering <mysql-build@oss.oracle
 
617
.com>"
 
618
1 new user ID
 
619
gpg: key 5072E1F5: "MySQL Release Engineering <mysql-build@oss.oracle
 
620
.com>"
 
621
53 new signatures
629
622
gpg: no ultimately trusted keys found
630
623
gpg: Total number processed: 1
631
 
gpg:         new signatures: 2
 
624
gpg:           new user IDs: 1
 
625
gpg:         new signatures: 53
632
626
 
633
627
   If you want to import the key into your RPM configuration to
634
628
   validate RPM install packages, you should be able to import the
650
644
   signature, which also is available from the download page. The
651
645
   signature file has the same name as the distribution file with an
652
646
   .asc extension, as shown by the examples in the following table.
653
 
   Distribution file mysql-standard-5.1.41-linux-i686.tar.gz
654
 
   Signature file    mysql-standard-5.1.41-linux-i686.tar.gz.asc
 
647
 
 
648
   Table 2.1. MySQL Package and Signature Files
 
649
       File Type                      File Name
 
650
   Distribution file mysql-standard-5.1.62-linux-i686.tar.gz
 
651
   Signature file    mysql-standard-5.1.62-linux-i686.tar.gz.asc
655
652
 
656
653
   Make sure that both files are stored in the same directory and
657
654
   then run the following command to verify the signature for the
659
656
shell> gpg --verify package_name.asc
660
657
 
661
658
   Example:
662
 
shell> gpg --verify mysql-standard-5.1.41-linux-i686.tar.gz.asc
663
 
gpg: Signature made Tue 12 Jul 2005 23:35:41 EST using DSA key ID 507
664
 
2E1F5
665
 
gpg: Good signature from "MySQL Package signing key (www.mysql.com) <
666
 
build@mysql.com>"
 
659
shell> gpg --verify mysql-standard-5.1.62-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>"
667
664
 
668
665
   The Good signature message indicates that everything is all right.
669
666
   You can ignore any insecure memory warning you might obtain.
679
676
shell> rpm --checksig package_name.rpm
680
677
 
681
678
   Example:
682
 
shell> rpm --checksig MySQL-server-5.1.41-0.glibc23.i386.rpm
683
 
MySQL-server-5.1.41-0.glibc23.i386.rpm: md5 gpg OK
 
679
shell> rpm --checksig MySQL-server-5.1.62-0.glibc23.i386.rpm
 
680
MySQL-server-5.1.62-0.glibc23.i386.rpm: md5 gpg OK
684
681
 
685
 
Note
 
682
   Note
686
683
 
687
684
   If you are using RPM 4.1 and it complains about (GPG) NOT OK
688
685
   (MISSING KEYS: GPG#5072e1f5), even though you have imported the
689
686
   MySQL public build key into your own GPG keyring, you need to
690
687
   import the key into the RPM keyring first. RPM 4.1 no longer uses
691
 
   your personal GPG keyring (or GPG itself). Rather, it maintains
692
 
   its own keyring because it is a system-wide application and a
 
688
   your personal GPG keyring (or GPG itself). Rather, RPM maintains a
 
689
   separate keyring because it is a system-wide application and a
693
690
   user's GPG public keyring is a user-specific file. To import the
694
691
   MySQL public key into the RPM keyring, first obtain the key as
695
692
   described in Section 2.1.4.2, "Signature Checking Using GnuPG."
703
700
 
704
701
2.1.5. Installation Layouts
705
702
 
706
 
   This section describes the default layout of the directories
707
 
   created by installing binary or source distributions provided by
708
 
   Sun Microsystems, Inc. A distribution provided by another vendor
709
 
   might use a layout different from those shown here.
710
 
 
711
 
   Installations created from our Linux RPM distributions result in
712
 
   files under the following system directories.
713
 
   Directory            Contents of Directory
714
 
   /usr/bin             Client programs and scripts
715
 
   /usr/sbin            The mysqld server
716
 
   /var/lib/mysql       Log files, databases
717
 
   /usr/share/info      Manual in Info format
718
 
   /usr/share/man       Unix manual pages
719
 
   /usr/include/mysql   Include (header) files
720
 
   /usr/lib/mysql       Libraries
721
 
   /usr/share/mysql     Error message and character set files
722
 
   /usr/share/sql-bench Benchmarks
723
 
 
724
 
   On Unix, a tar file binary distribution is installed by unpacking
725
 
   it at the installation location you choose (typically
726
 
   /usr/local/mysql) and creates the following directories in that
727
 
   location.
728
 
   Directory   Contents of Directory
729
 
   bin         Client programs and the mysqld server
730
 
   data        Log files, databases
731
 
   docs        Manual in Info format
732
 
   man         Unix manual pages
733
 
   include     Include (header) files
734
 
   lib         Libraries
735
 
   scripts     mysql_install_db
736
 
   share/mysql Error message files
737
 
   sql-bench   Benchmarks
738
 
 
739
 
   A source distribution is installed after you configure and compile
740
 
   it. By default, the installation step installs files under
741
 
   /usr/local, in the following subdirectories.
742
 
   Directory     Contents of Directory
743
 
   bin           Client programs and scripts
744
 
   include/mysql Include (header) files
745
 
   Docs          Manual in Info, CHM formats
746
 
   man           Unix manual pages
747
 
   lib/mysql     Libraries
748
 
   libexec       The mysqld server
749
 
   share/mysql   Error message files
750
 
   sql-bench     Benchmarks and crash-me test
751
 
   var           Databases and log files
752
 
 
753
 
   Within its installation directory, the layout of a source
754
 
   installation differs from that of a binary installation in the
755
 
   following ways:
756
 
 
757
 
     * The mysqld server is installed in the libexec directory rather
758
 
       than in the bin directory.
759
 
 
760
 
     * The data directory is var rather than data.
761
 
 
762
 
     * mysql_install_db is installed in the bin directory rather than
763
 
       in the scripts directory.
764
 
 
765
 
     * The header file and library directories are include/mysql and
766
 
       lib/mysql rather than include and lib.
767
 
 
768
 
   You can create your own binary installation from a compiled source
769
 
   distribution by executing the scripts/make_binary_distribution
770
 
   script from the top directory of the source distribution.
 
703
   The installation layout differs for different installation types
 
704
   (for example, native packages, binary tarballs, and source
 
705
   tarballs), which can lead to confusion when managing different
 
706
   systems or using different installation sources. The individual
 
707
   layouts are given in the corresponding installation type or
 
708
   platform chapter, as described following. Note that the layout of
 
709
   installations from vendors other than Oracle may differ from these
 
710
   layouts.
 
711
 
 
712
     * Section 2.3.1, "MySQL Installation Layout on Microsoft
 
713
       Windows"
 
714
 
 
715
     * Section 2.11.1, "MySQL Layout for Source Installation"
 
716
 
 
717
     * Section 2.2, "MySQL Installation Layout for Generic Unix/Linux
 
718
       Binary Package"
 
719
 
 
720
     * Section 2.5.1, "MySQL Installation Layout for Linux RPM"
 
721
 
 
722
     * Section 2.4.2, "MySQL Installation Layout on Mac OS X"
 
723
 
 
724
2.1.6. Compiler-Specific Build Characteristics
 
725
 
 
726
   In some cases, the compiler used to build MySQL affects the
 
727
   features available for use. The notes in this section apply for
 
728
   binary distributions provided by Oracle Corporation or that you
 
729
   compile yourself from source.
 
730
 
 
731
   icc (Intel C++ Compiler) Builds
 
732
 
 
733
   A server built with icc has these characteristics:
 
734
 
 
735
     * SSL support is not included.
 
736
 
 
737
     * InnoDB Plugin is not included.
771
738
 
772
739
2.2. Installing MySQL from Generic Binaries on Unix/Linux
773
740
 
774
 
   This section covers the installation of MySQL binary distributions
775
 
   that are provided for various platforms in the form of compressed
776
 
   tar files (files with a .tar.gz extension). See Section 2.2,
777
 
   "Installing MySQL from Generic Binaries on Unix/Linux," for a
778
 
   detailed list.
 
741
   Oracle provides a set of binary distributions of MySQL. These
 
742
   include binary distributions in the form of compressed tar files
 
743
   (files with a .tar.gz extension) for a number of platforms, as
 
744
   well as binaries in platform-specific package formats for selected
 
745
   platforms.
 
746
 
 
747
   This section covers the installation of MySQL from a compressed
 
748
   tar file binary distribution. For other platform-specific package
 
749
   formats, see the other platform-specific sections. For example,
 
750
   for Windows distributions, see Section 2.3, "Installing MySQL on
 
751
   Microsoft Windows."
779
752
 
780
753
   To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
781
754
 
782
 
   Sun Microsystems, Inc. provides a set of binary distributions of
783
 
   MySQL. In addition to binaries provided in platform-specific
784
 
   package formats, we offer binary distributions for a number of
785
 
   platforms in the form of compressed tar files (.tar.gz files). For
786
 
   Windows distributions, see Section 2.5, "Installing MySQL on
787
 
   Windows."
788
 
 
789
 
   If you want to compile a debug version of MySQL from a source
790
 
   distribution, you should add --with-debug or --with-debug=full to
791
 
   the configure command used to configure the distribution and
792
 
   remove any -fomit-frame-pointer options.
793
 
 
794
 
   MySQL tar file binary distributions have names of the form
795
 
   mysql-VERSION-OS.tar.gz, where VERSION is a number (for example,
796
 
   5.1.41), and OS indicates the type of operating system for which
797
 
   the distribution is intended (for example, pc-linux-i686).
798
 
 
799
 
   In addition to these generic packages, we also offer binaries in
800
 
   platform-specific package formats for selected platforms. See the
801
 
   platform specific sections for more information, for more
802
 
   information on how to install these.
803
 
 
804
 
   You need the following tools to install a MySQL tar file binary
805
 
   distribution:
806
 
 
807
 
     * GNU gunzip to uncompress the distribution.
808
 
 
809
 
     * A reasonable tar to unpack the distribution. GNU tar is known
810
 
       to work. Some operating systems come with a preinstalled
811
 
       version of tar that is known to have problems. For example,
812
 
       the tar provided with early versions of Mac OS X, SunOS 4.x,
813
 
       Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX
814
 
       are known to have problems with long file names. On Mac OS X,
815
 
       you can use the preinstalled gnutar program. On Solaris 10 and
816
 
       OpenSolaris you can use the preinstalled gtar. On other
817
 
       systems with a deficient tar, you should install GNU tar
818
 
       first.
819
 
 
820
 
   If you run into problems and need to file a bug report, please use
821
 
   the instructions in Section 1.6, "How to Report Bugs or Problems."
822
 
 
823
 
   The basic commands that you must execute to install and use a
824
 
   MySQL binary distribution are:
825
 
shell> groupadd mysql
826
 
shell> useradd -g mysql mysql
827
 
shell> cd /usr/local
828
 
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
829
 
shell> ln -s full-path-to-mysql-VERSION-OS mysql
830
 
shell> cd mysql
831
 
shell> chown -R mysql .
832
 
shell> chgrp -R mysql .
833
 
shell> scripts/mysql_install_db --user=mysql
834
 
shell> chown -R root .
835
 
shell> chown -R mysql data
836
 
shell> bin/mysqld_safe --user=mysql &
837
 
 
838
 
Note
839
 
 
840
 
   This procedure does not set up any passwords for MySQL accounts.
841
 
   After following the procedure, proceed to Section 2.13,
842
 
   "Post-Installation Setup and Testing."
843
 
 
844
 
   A more detailed version of the preceding description for
845
 
   installing a binary distribution follows:
846
 
 
847
 
    1. Add a login user and group for mysqld to run as:
848
 
shell> groupadd mysql
849
 
shell> useradd -g mysql mysql
850
 
       These commands add the mysql group and the mysql user. The
851
 
       syntax for useradd and groupadd may differ slightly on
852
 
       different versions of Unix, or they may have different names
853
 
       such as adduser and addgroup.
854
 
       You might want to call the user and group something else
855
 
       instead of mysql. If so, substitute the appropriate name in
856
 
       the following steps.
857
 
 
858
 
    2. Pick the directory under which you want to unpack the
859
 
       distribution and change location into it. In the following
860
 
       example, we unpack the distribution under /usr/local. (The
861
 
       instructions, therefore, assume that you have permission to
862
 
       create files and directories in /usr/local. If that directory
863
 
       is protected, you must perform the installation as root.)
864
 
shell> cd /usr/local
865
 
 
866
 
    3. Obtain a distribution file using the instructions in Section
867
 
       2.1.3, "How to Get MySQL." For a given release, binary
868
 
       distributions for all platforms are built from the same MySQL
869
 
       source distribution.
870
 
 
871
 
    4. Unpack the distribution, which creates the installation
872
 
       directory. Then create a symbolic link to that directory:
873
 
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
874
 
shell> ln -s full-path-to-mysql-VERSION-OS mysql
875
 
       The tar command creates a directory named mysql-VERSION-OS.
876
 
       The ln command makes a symbolic link to that directory. This
877
 
       lets you refer more easily to the installation directory as
878
 
       /usr/local/mysql.
879
 
       With GNU tar, no separate invocation of gunzip is necessary.
880
 
       You can replace the first line with the following alternative
881
 
       command to uncompress and extract the distribution:
882
 
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
883
 
 
884
 
    5. Change location into the installation directory:
885
 
shell> cd mysql
886
 
       You will find several files and subdirectories in the mysql
887
 
       directory. The most important for installation purposes are
888
 
       the bin and scripts subdirectories:
889
 
 
890
 
          + The bin directory contains client programs and the
891
 
            server. You should add the full path name of this
892
 
            directory to your PATH environment variable so that your
893
 
            shell finds the MySQL programs properly. See Section
894
 
            2.14, "Environment Variables."
895
 
 
896
 
          + The scripts directory contains the mysql_install_db
897
 
            script used to initialize the mysql database containing
898
 
            the grant tables that store the server access
899
 
            permissions.
900
 
 
901
 
    6. Ensure that the distribution contents are accessible to mysql.
902
 
       If you unpacked the distribution as mysql, no further action
903
 
       is required. If you unpacked the distribution as root, its
904
 
       contents will be owned by root. Change its ownership to mysql
905
 
       by executing the following commands as root in the
906
 
       installation directory:
907
 
shell> chown -R mysql .
908
 
shell> chgrp -R mysql .
909
 
       The first command changes the owner attribute of the files to
910
 
       the mysql user. The second changes the group attribute to the
911
 
       mysql group.
912
 
 
913
 
    7. If you have not installed MySQL before, you must create the
914
 
       MySQL data directory and initialize the grant tables:
915
 
shell> scripts/mysql_install_db --user=mysql
916
 
       If you run the command as root, include the --user option as
917
 
       shown. If you run the command while logged in as that user,
918
 
       you can omit the --user option.
919
 
       The command should create the data directory and its contents
920
 
       with mysql as the owner.
921
 
       After creating or updating the grant tables, you need to
922
 
       restart the server manually.
923
 
 
924
 
    8. Most of the MySQL installation can be owned by root if you
925
 
       like. The exception is that the data directory must be owned
926
 
       by mysql. To accomplish this, run the following commands as
927
 
       root in the installation directory:
928
 
shell> chown -R root .
929
 
shell> chown -R mysql data
930
 
 
931
 
    9. If you want MySQL to start automatically when you boot your
932
 
       machine, you can copy support-files/mysql.server to the
933
 
       location where your system has its startup files. More
934
 
       information can be found in the support-files/mysql.server
935
 
       script itself and in Section 2.13.1.2, "Starting and Stopping
936
 
       MySQL Automatically."
937
 
   10. You can set up new accounts using the bin/mysql_setpermission
938
 
       script if you install the DBI and DBD::mysql Perl modules. See
939
 
       Section 4.6.14, "mysql_setpermission --- Interactively Set
940
 
       Permissions in Grant Tables." For Perl module installation
941
 
       instructions, see Section 2.15, "Perl Installation Notes."
942
 
   11. If you would like to use mysqlaccess and have the MySQL
943
 
       distribution in some nonstandard location, you must change the
944
 
       location where mysqlaccess expects to find the mysql client.
945
 
       Edit the bin/mysqlaccess script at approximately line 18.
946
 
       Search for a line that looks like this:
947
 
$MYSQL     = '/usr/local/bin/mysql';    # path to mysql executable
948
 
       Change the path to reflect the location where mysql actually
949
 
       is stored on your system. If you do not do this, a Broken pipe
950
 
       error will occur when you run mysqlaccess.
951
 
 
952
 
   After everything has been unpacked and installed, you should test
953
 
   your distribution. To start the MySQL server, use the following
954
 
   command:
955
 
shell> bin/mysqld_safe --user=mysql &
956
 
 
957
 
   If you run the command as root, you must use the --user option as
958
 
   shown. The value of the option is the name of the login account
959
 
   that you created in the first step to use for running the server.
960
 
   If you run the command while logged in as mysql, you can omit the
961
 
   --user option.
962
 
 
963
 
   If the command fails immediately and prints mysqld ended, you can
964
 
   find some information in the host_name.err file in the data
965
 
   directory.
966
 
 
967
 
   More information about mysqld_safe is given in Section 4.3.2,
968
 
   "mysqld_safe --- MySQL Server Startup Script."
969
 
 
970
 
Note
971
 
 
972
 
   The accounts that are listed in the MySQL grant tables initially
973
 
   have no passwords. After starting the server, you should set up
974
 
   passwords for them using the instructions in Section 2.13,
975
 
   "Post-Installation Setup and Testing."
976
 
 
977
 
2.3. MySQL Installation Using a Source Distribution
978
 
 
979
 
   Before you proceed with an installation from source, first check
980
 
   whether our binary is available for your platform and whether it
981
 
   works for you. We put a great deal of effort into ensuring that
982
 
   our binaries are built with the best possible options.
983
 
 
984
 
   To obtain a source distribution for MySQL, Section 2.1.3, "How to
985
 
   Get MySQL." If you want to build MySQL from source on Windows, see
986
 
   Section 2.5.10, "Installing MySQL from Source on Windows."
987
 
 
988
 
   MySQL source distributions are provided as compressed tar archives
989
 
   and have names of the form mysql-VERSION.tar.gz, where VERSION is
990
 
   a number like 5.1.41.
991
 
 
992
 
   You need the following tools to build and install MySQL from
993
 
   source:
994
 
 
995
 
     * GNU gunzip to uncompress the distribution.
996
 
 
997
 
     * A reasonable tar to unpack the distribution. GNU tar is known
998
 
       to work. Some operating systems come with a preinstalled
999
 
       version of tar that is known to have problems. For example,
1000
 
       the tar provided with early versions of Mac OS X, SunOS 4.x,
1001
 
       Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX
1002
 
       are known to have problems with long file names. On Mac OS X,
1003
 
       you can use the preinstalled gnutar program. On Solaris 10 and
1004
 
       OpenSolaris you can use the preinstalled gtar. On other
1005
 
       systems with a deficient tar, you should install GNU tar
1006
 
       first.
1007
 
 
1008
 
     * A working ANSI C++ compiler. gcc 2.95.2 or later, SGI C++, and
1009
 
       SunPro C++ are some of the compilers that are known to work.
1010
 
       libg++ is not needed when using gcc. gcc 2.7.x has a bug that
1011
 
       makes it impossible to compile some perfectly legal C++ files,
1012
 
       such as sql/sql_base.cc. If you have only gcc 2.7.x, you must
1013
 
       upgrade your gcc to be able to compile MySQL. gcc 2.8.1 is
1014
 
       also known to have problems on some platforms, so it should be
1015
 
       avoided if a newer compiler exists for the platform. gcc
1016
 
       2.95.2 or later is recommended.
1017
 
 
1018
 
     * A good make program. GNU make is always recommended and is
1019
 
       sometimes required. (BSD make fails, and vendor-provided make
1020
 
       implementations may fail as well.) If you have problems, use
1021
 
       GNU make 3.75 or newer.
1022
 
 
1023
 
     * libtool 1.5.24 or later is also recommended.
1024
 
 
1025
 
   If you are using a version of gcc recent enough to understand the
1026
 
   -fno-exceptions option, it is very important that you use this
1027
 
   option. Otherwise, you may compile a binary that crashes randomly.
1028
 
   Also use -felide-constructors and -fno-rtti along with
1029
 
   -fno-exceptions. When in doubt, do the following:
1030
 
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
1031
 
       -fno-exceptions -fno-rtti" ./configure \
1032
 
       --prefix=/usr/local/mysql --enable-assembler \
1033
 
       --with-mysqld-ldflags=-all-static
1034
 
 
1035
 
   On most systems, this gives you a fast and stable binary.
1036
 
 
1037
 
   If you run into problems and need to file a bug report, please use
1038
 
   the instructions in Section 1.6, "How to Report Bugs or Problems."
1039
 
 
1040
 
2.3.1. Source Installation Overview
1041
 
 
1042
 
   The basic commands that you must execute to install a MySQL source
1043
 
   distribution are:
1044
 
shell> groupadd mysql
1045
 
shell> useradd -g mysql mysql
1046
 
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
1047
 
shell> cd mysql-VERSION
1048
 
shell> ./configure --prefix=/usr/local/mysql
1049
 
shell> make
1050
 
shell> make install
1051
 
shell> cp support-files/my-medium.cnf /etc/my.cnf
1052
 
shell> cd /usr/local/mysql
1053
 
shell> chown -R mysql .
1054
 
shell> chgrp -R mysql .
1055
 
shell> bin/mysql_install_db --user=mysql
1056
 
shell> chown -R root .
1057
 
shell> chown -R mysql var
1058
 
shell> bin/mysqld_safe --user=mysql &
1059
 
 
1060
 
   If you start from a source RPM, do the following:
1061
 
shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm
1062
 
 
1063
 
   This makes a binary RPM that you can install. For older versions
1064
 
   of RPM, you may have to replace the command rpmbuild with rpm
1065
 
   instead.
1066
 
 
1067
 
Note
1068
 
 
1069
 
   This procedure does not set up any passwords for MySQL accounts.
1070
 
   After following the procedure, proceed to Section 2.13,
1071
 
   "Post-Installation Setup and Testing," for post-installation setup
1072
 
   and testing.
1073
 
 
1074
 
   A more detailed version of the preceding description for
1075
 
   installing MySQL from a source distribution follows:
1076
 
 
1077
 
    1. Add a login user and group for mysqld to run as:
1078
 
shell> groupadd mysql
1079
 
shell> useradd -g mysql mysql
1080
 
       These commands add the mysql group and the mysql user. The
1081
 
       syntax for useradd and groupadd may differ slightly on
1082
 
       different versions of Unix, or they may have different names
1083
 
       such as adduser and addgroup.
1084
 
       You might want to call the user and group something else
1085
 
       instead of mysql. If so, substitute the appropriate name in
1086
 
       the following steps.
1087
 
 
1088
 
    2. Perform the following steps as the mysql user, except as
1089
 
       noted.
1090
 
 
1091
 
    3. Pick the directory under which you want to unpack the
1092
 
       distribution and change location into it.
1093
 
 
1094
 
    4. Obtain a distribution file using the instructions in Section
1095
 
       2.1.3, "How to Get MySQL."
1096
 
 
1097
 
    5. Unpack the distribution into the current directory:
1098
 
shell> gunzip < /path/to/mysql-VERSION.tar.gz | tar xvf -
1099
 
       This command creates a directory named mysql-VERSION.
1100
 
       With GNU tar, no separate invocation of gunzip is necessary.
1101
 
       You can use the following alternative command to uncompress
1102
 
       and extract the distribution:
1103
 
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
1104
 
 
1105
 
    6. Change location into the top-level directory of the unpacked
1106
 
       distribution:
1107
 
shell> cd mysql-VERSION
1108
 
       Note that currently you must configure and build MySQL from
1109
 
       this top-level directory. You cannot build it in a different
1110
 
       directory.
1111
 
 
1112
 
    7. Configure the release and compile everything:
1113
 
shell> ./configure --prefix=/usr/local/mysql
1114
 
shell> make
1115
 
       When you run configure, you might want to specify other
1116
 
       options. Run ./configure --help for a list of options. Section
1117
 
       2.3.2, "Typical configure Options," discusses some of the more
1118
 
       useful options.
1119
 
       If configure fails and you are going to send mail to a MySQL
1120
 
       mailing list to ask for assistance, please include any lines
1121
 
       from config.log that you think can help solve the problem.
1122
 
       Also include the last couple of lines of output from
1123
 
       configure. To file a bug report, please use the instructions
1124
 
       in Section 1.6, "How to Report Bugs or Problems."
1125
 
       If the compile fails, see Section 2.3.4, "Dealing with
1126
 
       Problems Compiling MySQL," for help.
1127
 
 
1128
 
    8. Install the distribution:
1129
 
shell> make install
1130
 
       You might need to run this command as root.
1131
 
       If you want to set up an option file, use one of those present
1132
 
       in the support-files directory as a template. For example:
1133
 
shell> cp support-files/my-medium.cnf /etc/my.cnf
1134
 
       You might need to run this command as root.
1135
 
       If you want to configure support for InnoDB tables, you should
1136
 
       edit the /etc/my.cnf file, remove the # character before the
1137
 
       option lines that start with innodb_..., and modify the option
1138
 
       values to be what you want. See Section 4.2.3.3, "Using Option
1139
 
       Files," and Section 13.6.2, "InnoDB Configuration."
1140
 
 
1141
 
    9. Change location into the installation directory:
1142
 
shell> cd /usr/local/mysql
1143
 
   10. If you ran the make install command as root, the installed
1144
 
       files will be owned by root. Ensure that the installation is
1145
 
       accessible to mysql by executing the following commands as
1146
 
       root in the installation directory:
1147
 
shell> chown -R mysql .
1148
 
shell> chgrp -R mysql .
1149
 
       The first command changes the owner attribute of the files to
1150
 
       the mysql user. The second changes the group attribute to the
1151
 
       mysql group.
1152
 
   11. If you have not installed MySQL before, you must create the
1153
 
       MySQL data directory and initialize the grant tables:
1154
 
shell> bin/mysql_install_db --user=mysql
1155
 
       If you run the command as root, include the --user option as
1156
 
       shown. If you run the command while logged in as mysql, you
1157
 
       can omit the --user option.
1158
 
       The command should create the data directory and its contents
1159
 
       with mysql as the owner.
1160
 
       After using mysql_install_db to create the grant tables for
1161
 
       MySQL, you must restart the server manually. The mysqld_safe
1162
 
       command to do this is shown in a later step.
1163
 
   12. Most of the MySQL installation can be owned by root if you
1164
 
       like. The exception is that the data directory must be owned
1165
 
       by mysql. To accomplish this, run the following commands as
1166
 
       root in the installation directory:
1167
 
shell> chown -R root .
1168
 
shell> chown -R mysql var
1169
 
   13. If you want MySQL to start automatically when you boot your
1170
 
       machine, you can copy support-files/mysql.server to the
1171
 
       location where your system has its startup files. More
1172
 
       information can be found in the support-files/mysql.server
1173
 
       script itself; see also Section 2.13.1.2, "Starting and
1174
 
       Stopping MySQL Automatically."
1175
 
   14. You can set up new accounts using the bin/mysql_setpermission
1176
 
       script if you install the DBI and DBD::mysql Perl modules. See
1177
 
       Section 4.6.14, "mysql_setpermission --- Interactively Set
1178
 
       Permissions in Grant Tables." For Perl module installation
1179
 
       instructions, see Section 2.15, "Perl Installation Notes."
1180
 
 
1181
 
   After everything has been installed, you should test your
1182
 
   distribution. To start the MySQL server, use the following
1183
 
   command:
1184
 
shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &
1185
 
 
1186
 
   If you run the command as root, you should use the --user option
1187
 
   as shown. The value of the option is the name of the login account
1188
 
   that you created in the first step to use for running the server.
1189
 
   If you run the command while logged in as that user, you can omit
1190
 
   the --user option.
1191
 
 
1192
 
   If the command fails immediately and prints mysqld ended, you can
1193
 
   find some information in the host_name.err file in the data
1194
 
   directory.
1195
 
 
1196
 
   More information about mysqld_safe is given in Section 4.3.2,
1197
 
   "mysqld_safe --- MySQL Server Startup Script."
1198
 
 
1199
 
Note
1200
 
 
1201
 
   The accounts that are listed in the MySQL grant tables initially
1202
 
   have no passwords. After starting the server, you should set up
1203
 
   passwords for them using the instructions in Section 2.13,
1204
 
   "Post-Installation Setup and Testing."
1205
 
 
1206
 
2.3.2. Typical configure Options
1207
 
 
1208
 
   The configure script gives you a great deal of control over how
1209
 
   you configure a MySQL source distribution. Typically you do this
1210
 
   using options on the configure command line. You can also affect
1211
 
   configure using certain environment variables. See Section 2.14,
1212
 
   "Environment Variables." For a full list of options supported by
1213
 
   configure, run this command:
1214
 
shell> ./configure --help
1215
 
 
1216
 
   A list of the available configure options is provided in the table
1217
 
   below.
1218
 
 
1219
 
   Table 2.1. Build (configure) Reference
1220
 
   Formats Description Default Introduced Removed
1221
 
   --bindir=DIR User executables EPREFIX/bin
1222
 
   --build=BUILD Configure for building on BUILD guessed
1223
 
   --cache-file=FILE Cache test results in FILE disabled
1224
 
   -C Alias for `--cache-file=config.cache'
1225
 
   --config-cache
1226
 
   --datadir=DIR Read-only architecture-independent data PREFIX/share
1227
 
 
1228
 
   --disable-FEATURE Do not include FEATURE
1229
 
   --disable-dependency-tracking Disable dependency tracking
1230
 
   --disable-grant-options Disable GRANT options
1231
 
   --disable-largefile Omit support for large files
1232
 
   --disable-libtool-lock Disable libtool lock
1233
 
   --disable-thread-safe-client Compile the client without threads
1234
 
   5.1.7
1235
 
   --enable-FEATURE Enable FEATURE
1236
 
   --enable-assembler Use assembler versions of some string functions
1237
 
   if available
1238
 
   --enable-debug-sync Compile in Debug Sync facility   5.1.41
1239
 
   --enable-dependency-tracking Do not reject slow dependency
1240
 
   extractors
1241
 
   --enable-fast-install Optimize for fast installation yes
1242
 
   --enable-local-infile Enable LOAD DATA LOCAL INFILE disabled
1243
 
   --enable-shared Build shared libraries yes
1244
 
   --enable-static Build static libraries yes
1245
 
   --enable-thread-safe-client Compile the client with threads
1246
 
   --exec-prefix=EPREFIX Install architecture-dependent files in
1247
 
   EPREFIX
1248
 
   -h Display this help and exit
1249
 
   --help
1250
 
   --help=short Display options specific to this package
1251
 
   --help=recursive Display the short help of all the included
1252
 
   packages
1253
 
   --host=HOST Cross-compile to build programs to run on HOST
1254
 
   --includedir=DIR C header files PREFIX/include
1255
 
   --infodir=DIR Info documentation PREFIX/info
1256
 
   --libdir=DIR Object code libraries EPREFIX/lib
1257
 
   --libexecdir=DIR Program executables EPREFIX/libexec
1258
 
   --localstatedir=DIR Modifiable single-machine data PREFIX/var
1259
 
   --mandir=DIR man documentation PREFIX/man
1260
 
   -n Do not create output files
1261
 
   --no-create
1262
 
   --oldincludedir=DIR C header files for non-gcc /usr/include
1263
 
   --prefix=PREFIX Install architecture-independent files in PREFIX
1264
 
 
1265
 
   --program-prefix=PREFIX Prepend PREFIX to installed program names
1266
 
 
1267
 
   --program-suffix=SUFFIX Append SUFFIX to installed program names
1268
 
 
1269
 
   --program-transform-name=PROGRAM run sed PROGRAM on installed
1270
 
   program names
1271
 
   -q Do not print `checking...' messages
1272
 
   --quiet
1273
 
   --sbindir=DIR System admin executables EPREFIX/sbin
1274
 
   --sharedstatedir=DIR Modifiable architecture-independent data
1275
 
   PREFIX/com
1276
 
   --srcdir=DIR Find the sources in DIR configure directory or ..
1277
 
   --sysconfdir=DIR Read-only single-machine data PREFIX/etc
1278
 
   --target=TARGET Configure for building compilers for TARGET
1279
 
   -V Display version information and exit
1280
 
   --version
1281
 
   --with-PACKAGE Use PACKAGE
1282
 
   --with-archive-storage-engine Enable the Archive Storage Engine no
1283
 
 
1284
 
   --with-atomic-ops Implement atomic operations using pthread
1285
 
   rwlocks or atomic CPU instructions for multi-processor   5.1.12
1286
 
   --with-berkeley-db Use BerkeleyDB located in DIR no
1287
 
   --with-berkeley-db-includes Find Berkeley DB headers in DIR
1288
 
   --with-berkeley-db-libs Find Berkeley DB libraries in DIR
1289
 
   --with-big-tables Support tables with more than 4 G rows even on
1290
 
   32 bit platforms
1291
 
   --with-blackhole-storage-engine Enable the Blackhole Storage
1292
 
   Engine no
1293
 
   --with-charset Default character set
1294
 
   --with-client-ldflags Extra linking arguments for clients
1295
 
   --with-collation Default collation
1296
 
   --with-comment Comment about compilation environment
1297
 
   --with-csv-storage-engine Enable the CSV Storage Engine yes
1298
 
   --with-darwin-mwcc Use Metrowerks CodeWarrior wrappers on OS
1299
 
   X/Darwin
1300
 
   --with-debug Add debug code   5.1.7
1301
 
   --with-debug=full Add debug code (adds memory checker, very slow)
1302
 
 
1303
 
   --with-embedded-privilege-control Build parts to check user's
1304
 
   privileges (only affects embedded library)
1305
 
   --with-embedded-server Build the embedded server
1306
 
   --with-error-inject Enable error injection in MySQL Server
1307
 
   5.1.11
1308
 
   --with-example-storage-engine Enable the Example Storage Engine no
1309
 
 
1310
 
   --with-extra-charsets Use charsets in addition to default
1311
 
   --with-fast-mutexes Compile with fast mutexes enabled 5.1.5
1312
 
   --with-federated-storage-engine Enable federated storage engine no
1313
 
   5.1.3 5.1.9
1314
 
   --with-gnu-ld Assume the C compiler uses GNU ld no
1315
 
   --with-innodb Enable innobase storage engine no 5.1.3 5.1.9
1316
 
   --with-lib-ccflags Extra CC options for libraries
1317
 
   --with-libwrap=DIR Compile in libwrap (tcp_wrappers) support
1318
 
   --with-low-memory Try to use less memory to compile to avoid
1319
 
   memory limitations
1320
 
   --with-machine-type Set the machine type, like "powerpc"
1321
 
   --with-max-indexes=N Sets the maximum number of indexes per table
1322
 
   64
1323
 
   --with-mysqld-ldflags Extra linking arguments for mysqld
1324
 
   --with-mysqld-libs Extra libraries to link with for mysqld
1325
 
   --with-mysqld-user What user the mysqld daemon shall be run as
1326
 
 
1327
 
   --with-mysqlmanager Build the mysqlmanager binary Build if server
1328
 
   is built
1329
 
   --with-named-curses-libs Use specified curses libraries
1330
 
   --with-named-thread-libs Use specified thread libraries
1331
 
   --with-ndb-ccflags Extra CC options for ndb compile
1332
 
   --with-ndb-docs Include the NDB Cluster ndbapi and mgmapi
1333
 
   documentation
1334
 
   --with-ndb-port Port for NDB Cluster management server
1335
 
   --with-ndb-port-base Port for NDB Cluster management server
1336
 
   --with-ndb-sci=DIR Provide MySQL with a custom location of sci
1337
 
   library
1338
 
   --with-ndb-test Include the NDB Cluster ndbapi test programs
1339
 
   --with-ndbcluster Include the NDB Cluster table handler no
1340
 
   --with-openssl=DIR Include the OpenSSL support
1341
 
   --with-openssl-includes Find OpenSSL headers in DIR
1342
 
   --with-openssl-libs Find OpenSSL libraries in DIR
1343
 
   --with-other-libc=DIR Link against libc and other standard
1344
 
   libraries installed in the specified nonstandard location
1345
 
   --with-pic Try to use only PIC/non-PIC objects Use both
1346
 
   --with-plugin-PLUGIN Forces the named plugin to be linked into
1347
 
   mysqld statically   5.1.11
1348
 
   --with-plugins Plugins to include in mysqld none 5.1.11
1349
 
   --with-pstack Use the pstack backtrace library
1350
 
   --with-pthread Force use of pthread library
1351
 
   --with-row-based-replication Include row-based replication   5.1.5
1352
 
   5.1.6
1353
 
   --with-server-suffix Append value to the version string
1354
 
   --with-ssl=DIR Include SSL support   5.1.11
1355
 
   --with-system-type Set the system type, like "sun-solaris10"
1356
 
   --with-tags Include additional configurations automatic
1357
 
   --with-tcp-port Which port to use for MySQL services 3306
1358
 
   --with-unix-socket-path Where to put the unix-domain socket
1359
 
   --with-yassl Include the yaSSL support
1360
 
   --with-zlib-dir=no|bundled|DIR Provide MySQL with a custom
1361
 
   location of compression library
1362
 
   --without-PACKAGE Do not use PACKAGE
1363
 
   --without-bench Skip building of the benchmark suite
1364
 
   --without-debug Build a production version without debugging code
1365
 
 
1366
 
   --without-docs Skip building of the documentation
1367
 
   --without-extra-tools Skip building utilities in the tools
1368
 
   directory
1369
 
   --without-geometry Do not build geometry-related parts
1370
 
   --without-libedit Use system libedit instead of bundled copy
1371
 
   --without-man Skip building of the man pages
1372
 
   --without-ndb-binlog Disable ndb binlog   5.1.6
1373
 
   --without-ndb-debug Disable special ndb debug features
1374
 
   --without-plugin-PLUGIN Exclude PLUGIN   5.1.11
1375
 
   --without-query-cache Do not build query cache
1376
 
   --without-readline Use system readline instead of bundled copy
1377
 
 
1378
 
   --without-row-based-replication Don't include row-based
1379
 
   replication   5.1.7 5.1.14
1380
 
   --without-server Only build the client
1381
 
   --without-uca Skip building of the national Unicode collations
1382
 
 
1383
 
   Some of the configure options available are described here. For
1384
 
   options that may be of use if you have difficulties building
1385
 
   MySQL, see Section 2.3.4, "Dealing with Problems Compiling MySQL."
1386
 
 
1387
 
     * To compile just the MySQL client libraries and client programs
1388
 
       and not the server, use the --without-server option:
1389
 
shell> ./configure --without-server
1390
 
       If you have no C++ compiler, some client programs such as
1391
 
       mysql cannot be compiled because they require C++.. In this
1392
 
       case, you can remove the code in configure that tests for the
1393
 
       C++ compiler and then run ./configure with the
1394
 
       --without-server option. The compile step should still try to
1395
 
       build all clients, but you can ignore any warnings about files
1396
 
       such as mysql.cc. (If make stops, try make -k to tell it to
1397
 
       continue with the rest of the build even if errors occur.)
1398
 
 
1399
 
     * If you want to build the embedded MySQL library (libmysqld.a),
1400
 
       use the --with-embedded-server option.
1401
 
 
1402
 
     * If you don't want your log files and database directories
1403
 
       located under /usr/local/var, use a configure command
1404
 
       something like one of these:
1405
 
shell> ./configure --prefix=/usr/local/mysql
1406
 
shell> ./configure --prefix=/usr/local \
1407
 
           --localstatedir=/usr/local/mysql/data
1408
 
       The first command changes the installation prefix so that
1409
 
       everything is installed under /usr/local/mysql rather than the
1410
 
       default of /usr/local. The second command preserves the
1411
 
       default installation prefix, but overrides the default
1412
 
       location for database directories (normally /usr/local/var)
1413
 
       and changes it to /usr/local/mysql/data.
1414
 
       You can also specify the installation directory and data
1415
 
       directory locations at server startup time by using the
1416
 
       --basedir and --datadir options. These can be given on the
1417
 
       command line or in an MySQL option file, although it is more
1418
 
       common to use an option file. See Section 4.2.3.3, "Using
1419
 
       Option Files."
1420
 
 
1421
 
     * This option specifies the port number on which the server
1422
 
       listens for TCP/IP connections. The default is port 3306. To
1423
 
       listen on a different port, use a configure command like this:
1424
 
shell> ./configure --with-tcp-port=3307
1425
 
 
1426
 
     * If you are using Unix and you want the MySQL socket file
1427
 
       location to be somewhere other than the default location
1428
 
       (normally in the directory /tmp or /var/run), use a configure
1429
 
       command like this:
1430
 
shell> ./configure \
1431
 
           --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
1432
 
       The socket file name must be an absolute path name. You can
1433
 
       also change the location of mysql.sock at server startup by
1434
 
       using a MySQL option file. See Section B.5.4.5, "How to
1435
 
       Protect or Change the MySQL Unix Socket File."
1436
 
 
1437
 
     * If you want to compile statically linked programs (for
1438
 
       example, to make a binary distribution, to get better
1439
 
       performance, or to work around problems with some Red Hat
1440
 
       Linux distributions), run configure like this:
1441
 
shell> ./configure --with-client-ldflags=-all-static \
1442
 
           --with-mysqld-ldflags=-all-static
1443
 
 
1444
 
     * If you are using gcc and don't have libg++ or libstdc++
1445
 
       installed, you can tell configure to use gcc as your C++
1446
 
       compiler:
1447
 
shell> CC=gcc CXX=gcc ./configure
1448
 
       When you use gcc as your C++ compiler, it does not attempt to
1449
 
       link in libg++ or libstdc++. This may be a good thing to do
1450
 
       even if you have those libraries installed. Some versions of
1451
 
       them have caused strange problems for MySQL users in the past.
1452
 
       The following list indicates some compilers and environment
1453
 
       variable settings that are commonly used with each one.
1454
 
 
1455
 
          + gcc 2.7.2:
1456
 
CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors"
1457
 
 
1458
 
          + gcc 2.95.2:
1459
 
CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
1460
 
-felide-constructors -fno-exceptions -fno-rtti"
1461
 
 
1462
 
          + pgcc 2.90.29 or newer:
1463
 
CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \
1464
 
CXXFLAGS="-O3 -mpentiumpro -mstack-align-double \
1465
 
-felide-constructors -fno-exceptions -fno-rtti"
1466
 
       In most cases, you can get a reasonably optimized MySQL binary
1467
 
       by using the options from the preceding list and adding the
1468
 
       following options to the configure line:
1469
 
--prefix=/usr/local/mysql --enable-assembler \
1470
 
--with-mysqld-ldflags=-all-static
1471
 
       The full configure line would, in other words, be something
1472
 
       like the following for all recent gcc versions:
1473
 
CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
1474
 
-felide-constructors -fno-exceptions -fno-rtti" ./configure \
1475
 
--prefix=/usr/local/mysql --enable-assembler \
1476
 
--with-mysqld-ldflags=-all-static
1477
 
       The binaries we provide on the MySQL Web site at
1478
 
       http://dev.mysql.com/downloads/ are all compiled with full
1479
 
       optimization and should be perfect for most users. See Section
1480
 
       2.2, "Installing MySQL from Generic Binaries on Unix/Linux."
1481
 
       There are some configuration settings you can tweak to build
1482
 
       an even faster binary, but these are only for advanced users.
1483
 
       See Section 7.5.1, "How Compiling and Linking Affects the
1484
 
       Speed of MySQL."
1485
 
       If the build fails and produces errors about your compiler or
1486
 
       linker not being able to create the shared library
1487
 
       libmysqlclient.so.N (where N is a version number), you can
1488
 
       work around this problem by giving the --disable-shared option
1489
 
       to configure. In this case, configure does not build a shared
1490
 
       libmysqlclient.so.N library.
1491
 
 
1492
 
     * By default, MySQL uses the latin1 (cp1252 West European)
1493
 
       character set. To change the default set, use the
1494
 
       --with-charset option:
1495
 
shell> ./configure --with-charset=CHARSET
1496
 
       CHARSET may be one of binary, armscii8, ascii, big5, cp1250,
1497
 
       cp1251, cp1256, cp1257, cp850, cp852, cp866, cp932, dec8,
1498
 
       eucjpms, euckr, gb2312, gbk, geostd8, greek, hebrew, hp8,
1499
 
       keybcs2, koi8r, koi8u, latin1, latin2, latin5, latin7, macce,
1500
 
       macroman, sjis, swe7, tis620, ucs2, ujis, utf8. See Section
1501
 
       9.2, "The Character Set Used for Data and Sorting."
1502
 
       (Additional character sets might be available. Check the
1503
 
       output from ./configure --help for the current list.)
1504
 
       The default collation may also be specified. MySQL uses the
1505
 
       latin1_swedish_ci collation by default. To change this, use
1506
 
       the --with-collation option:
1507
 
shell> ./configure --with-collation=COLLATION
1508
 
       To change both the character set and the collation, use both
1509
 
       the --with-charset and --with-collation options. The collation
1510
 
       must be a legal collation for the character set. (Use the SHOW
1511
 
       COLLATION statement to determine which collations are
1512
 
       available for each character set.)
1513
 
       With the configure option --with-extra-charsets=LIST, you can
1514
 
       define which additional character sets should be compiled into
1515
 
       the server. LIST is one of the following:
1516
 
 
1517
 
          + A list of character set names separated by spaces
1518
 
 
1519
 
          + complex to include all character sets that can't be
1520
 
            dynamically loaded
1521
 
 
1522
 
          + all to include all character sets into the binaries
1523
 
       Clients that want to convert characters between the server and
1524
 
       the client should use the SET NAMES statement. See Section
1525
 
       5.1.5, "Session System Variables," and Section 9.1.4,
1526
 
       "Connection Character Sets and Collations."
1527
 
 
1528
 
     * To configure MySQL with debugging code, use the --with-debug
1529
 
       option:
1530
 
shell> ./configure --with-debug
1531
 
       This causes a safe memory allocator to be included that can
1532
 
       find some errors and that provides output about what is
1533
 
       happening. See MySQL Internals: Porting
1534
 
       (http://forge.mysql.com/wiki/MySQL_Internals_Porting).
1535
 
       As of MySQL 5.1.12, using --with-debug to configure MySQL with
1536
 
       debugging support enables you to use the
1537
 
       --debug="d,parser_debug" option when you start the server.
1538
 
       This causes the Bison parser that is used to process SQL
1539
 
       statements to dump a parser trace to the server's standard
1540
 
       error output. Typically, this output is written to the error
1541
 
       log.
1542
 
 
1543
 
     * To cause the Debug Sync facility to be compiled into the
1544
 
       server, use the --enable-debug-sync option. This facility is
1545
 
       used for testing and debugging. When compiled in, Debug Sync
1546
 
       is disabled by default. To enable it, start mysqld with the
1547
 
       --debug-sync-timeout=N option, where N is a timeout value
1548
 
       greater than 0. (The default value is 0, which disables Debug
1549
 
       Sync.) N becomes the default timeout for individual
1550
 
       synchronization points.
1551
 
       Debug Sync is also compiled in if you configure with the
1552
 
       --with-debug option (which implies --enable-debug-sync),
1553
 
       unless you also use the --disable-debug-sync option.
1554
 
       For a description of the Debug Sync facility and how to use
1555
 
       synchronization points, see MySQL Internals: Test
1556
 
       Synchronization
1557
 
       (http://forge.mysql.com/wiki/MySQL_Internals_Test_Synchronizat
1558
 
       ion).
1559
 
       The --enable-debug-sync and --disable-debug-sync options were
1560
 
       added in MySQL 5.1.41.
1561
 
 
1562
 
     * If your client programs are using threads, you must compile a
1563
 
       thread-safe version of the MySQL client library with the
1564
 
       --enable-thread-safe-client configure option. This creates a
1565
 
       libmysqlclient_r library with which you should link your
1566
 
       threaded applications. See Section 21.9.16.2, "How to Make a
1567
 
       Threaded Client."
1568
 
 
1569
 
     * Some features require that the server be built with
1570
 
       compression library support, such as the COMPRESS() and
1571
 
       UNCOMPRESS() functions, and compression of the client/server
1572
 
       protocol. The --with-zlib-dir=no|bundled|DIR option provides
1573
 
       control over compression library support. The value no
1574
 
       explicitly disables compression support. bundled causes the
1575
 
       zlib library bundled in the MySQL sources to be used. A DIR
1576
 
       path name specifies the directory in which to find the
1577
 
       compression library sources.
1578
 
 
1579
 
     * It is possible to build MySQL with large table support using
1580
 
       the --with-big-tables option.
1581
 
       This option causes the variables that store table row counts
1582
 
       to be declared as unsigned long long rather than unsigned
1583
 
       long. This enables tables to hold up to approximately
1584
 
       1.844E+19 ((2^32)^2) rows rather than 2^32 (~4.295E+09) rows.
1585
 
       Previously it was necessary to pass -DBIG_TABLES to the
1586
 
       compiler manually in order to enable this feature.
1587
 
 
1588
 
     * Run configure with the --disable-grant-options option to cause
1589
 
       the --bootstrap, --skip-grant-tables, and --init-file options
1590
 
       for mysqld to be disabled. For Windows, the configure.js
1591
 
       script recognizes the DISABLE_GRANT_OPTIONS flag, which has
1592
 
       the same effect. The capability is available as of MySQL
1593
 
       5.1.15.
1594
 
 
1595
 
     * This option allows MySQL Community Server features to be
1596
 
       enabled. Additional options may be required for individual
1597
 
       features, such as --enable-profiling to enable statement
1598
 
       profiling. This option was added in MySQL 5.1.24. It is
1599
 
       enabled by default as of MySQL 5.1.28; to disable it, use
1600
 
       --disable-community-features.
1601
 
 
1602
 
     * When given with --enable-community-features, the
1603
 
       --enable-profiling option enables the statement profiling
1604
 
       capability exposed by the SHOW PROFILE and SHOW PROFILES
1605
 
       statements. (See Section 12.5.5.33, "SHOW PROFILES Syntax.")
1606
 
       This option was added in MySQL 5.1.24. It is enabled by
1607
 
       default as of MySQL 5.1.28; to disable it, use
1608
 
       --disable-profiling.
1609
 
 
1610
 
     * See Section 2.1, "General Installation Guidance," for options
1611
 
       that pertain to particular operating systems.
1612
 
 
1613
 
     * See Section 5.5.7.2, "Using SSL Connections," for options that
1614
 
       pertain to configuring MySQL to support secure (encrypted)
1615
 
       connections.
1616
 
 
1617
 
     * Several configure options apply to plugin selection and
1618
 
       building:
1619
 
--with-plugins=PLUGIN[,PLUGIN]...
1620
 
--with-plugins=GROUP
1621
 
--with-plugin-PLUGIN
1622
 
--without-plugin-PLUGIN
1623
 
       PLUGIN is an individual plugin name such as csv or archive.
1624
 
       As shorthand, GROUP is a configuration group name such as none
1625
 
       (select no plugins) or all (select all plugins).
1626
 
       You can build a plugin as static (compiled into the server) or
1627
 
       dynamic (built as a dynamic library that must be installed
1628
 
       using the INSTALL PLUGIN statement before it can be used).
1629
 
       Some plugins might not support static or dynamic build.
1630
 
       configure --help shows the following information pertaining to
1631
 
       plugins:
1632
 
 
1633
 
          + The plugin-related options
1634
 
 
1635
 
          + The names of all available plugins
1636
 
 
1637
 
          + For each plugin, a description of its purpose, which
1638
 
            build types it supports (static or dynamic), and which
1639
 
            plugin groups it is a part of.
1640
 
       --with-plugins can take a list of one or more plugin names
1641
 
       separated by commas, or a plugin group name. The named plugins
1642
 
       are configured to be built as static plugins.
1643
 
       --with-plugin-PLUGIN configures the given plugin to be built
1644
 
       as a static plugin.
1645
 
       --without-plugin-PLUGIN disables the given plugin from being
1646
 
       built.
1647
 
       If a plugin is named both with a --with and --without option,
1648
 
       the result is undefined.
1649
 
       For any plugin that is not explicitly selected or disabled, it
1650
 
       is selected to be built dynamically if it supports dynamic
1651
 
       build, and not built if it does not support dynamic build.
1652
 
       (Thus, in the case that no plugin options are given, all
1653
 
       plugins that support dynamic build are selected to be built as
1654
 
       dynamic plugins. Plugins that do not support dynamic build are
1655
 
       not built.)
1656
 
 
1657
 
2.3.3. Installing from the Development Source Tree
1658
 
 
1659
 
Caution
1660
 
 
1661
 
   You should read this section only if you are interested in helping
1662
 
   us test our new code. If you just want to get MySQL up and running
1663
 
   on your system, you should use a standard release distribution
1664
 
   (either a binary or source distribution).
1665
 
 
1666
 
   To obtain the most recent development source tree, you must have
1667
 
   Bazaar installed. You can obtain Bazaar from the Bazaar VCS
1668
 
   Website (http://bazaar-vcs.org). Bazaar is supported by any
1669
 
   platform that supports Python, and is therefore compatible with
1670
 
   any Linux, Unix, Windows or Mac OS X host. Instructions for
1671
 
   downloading and installing Bazaar on the different platforms are
1672
 
   available on the Bazaar website.
1673
 
 
1674
 
   All MySQL projects are hosted on Launchpad
1675
 
   (http://launchpad.net/). MySQL projects, including MySQL server,
1676
 
   MySQL Workbench, and others are available from the Sun/MySQL
1677
 
   Engineering (http://launchpad.net/~mysql) page. For the
1678
 
   repositories related only to MySQL server, see the MySQL Server
1679
 
   (http://launchpad.net/mysql-server) page.
1680
 
 
1681
 
   To build under Unix/Linux, you must have the following tools
1682
 
   installed:
1683
 
 
1684
 
     * GNU make, available from http://www.gnu.org/software/make/.
1685
 
       Although some platforms come with their own make
1686
 
       implementations, it is highly recommended that you use GNU
1687
 
       make. It may already be available on your system as gmake.
1688
 
 
1689
 
     * autoconf 2.58 (or newer), available from
1690
 
       http://www.gnu.org/software/autoconf/.
1691
 
 
1692
 
     * automake 1.8.1, available from
1693
 
       http://www.gnu.org/software/automake/.
1694
 
 
1695
 
     * libtool 1.5, available from
1696
 
       http://www.gnu.org/software/libtool/.
1697
 
 
1698
 
     * m4, available from http://www.gnu.org/software/m4/.
1699
 
 
1700
 
     * bison, available from http://www.gnu.org/software/bison/. You
1701
 
       should use the latest version of bison where possible. Version
1702
 
       1.75 and version 2.1 are known to work. There have been
1703
 
       reported problems with bison 1.875. If you experience
1704
 
       problems, upgrade to a later, rather than earlier, version.
1705
 
       Versions of bison older than 1.75 may report this error:
1706
 
sql_yacc.yy:#####: fatal error: maximum table size (32767) exceeded
1707
 
       The maximum table size is not actually exceeded; the error is
1708
 
       caused by bugs in older versions of bison.
1709
 
 
1710
 
   To build under Windows you must have Microsoft Visual C++ 2005
1711
 
   Express Edition, Visual Studio .Net 2003 (7.1), or Visual Studio
1712
 
   2005 (8.0) compiler system.
1713
 
 
1714
 
   Once the necessary tools are installed, you must create a local
1715
 
   branch of the MySQL source code on your machine:
1716
 
 
1717
 
    1. To obtain a copy of the MySQL source code, you must create a
1718
 
       new Bazaar branch. If you do not already have a Bazaar
1719
 
       repository directory set up, you need to initialize a new
1720
 
       directory:
1721
 
shell> mkdir mysql-server
1722
 
shell> bzr init-repo --trees mysql-server
1723
 
 
1724
 
    2. Once you have an initialized directory, you can branch from
1725
 
       the public MySQL server repositories to create a local source
1726
 
       tree. To create a branch of a specific version:
1727
 
shell> cd mysql-server
1728
 
shell> bzr branch lp:mysql-server/5.1 mysql-5.1
1729
 
 
1730
 
    3. The initial download will take some time to complete,
1731
 
       depending on the speed of your connection. Please be patient.
1732
 
       Once you have downloaded the first tree, additional trees
1733
 
       should take significantly less time to download.
1734
 
 
1735
 
    4. When building from the Bazaar branch, you may want to create a
1736
 
       copy of your active branch so that you can make configuration
1737
 
       and other changes without affecting the original branch
1738
 
       contents. You can achieve this by branching from the original
1739
 
       branch:
1740
 
shell> bzr branch mysql-5.1 mysql-5.1-build
1741
 
 
1742
 
    5. To obtain changes made after you have set up the branch
1743
 
       initially, update it using the pull option periodically. Use
1744
 
       this command in the top-level directory of the local copy:
1745
 
shell> bzr pull
1746
 
       You can examine the changeset comments for the tree by using
1747
 
       the log option to bzr:
1748
 
shell> bzr log
1749
 
       You can also browse changesets, comments, and source code
1750
 
       online. To browse this information for MySQL 5.1, go to the
1751
 
       Launchpad MySQL Server (http://launchpad.net/mysql-server)
1752
 
       page.
1753
 
       If you see diffs (changes) or code that you have a question
1754
 
       about, do not hesitate to send email to the MySQL internals
1755
 
       mailing list. See Section 1.5.1, "MySQL Mailing Lists." Also,
1756
 
       if you think you have a better idea on how to do something,
1757
 
       send an email message to the list with a patch.
1758
 
 
1759
 
   After you have the local branch, you can build MySQL server from
1760
 
   the source code. On Windows, the build process is different from
1761
 
   Unix/Linux: see Section 2.5.10, "Installing MySQL from Source on
1762
 
   Windows."
1763
 
 
1764
 
   On Unix/Linux, use the autoconf system to create the configure
1765
 
   script so that you can configure the build environment before
1766
 
   building. The following example shows the typical commands
1767
 
   required to build MySQL from a source tree.
1768
 
 
1769
 
    1. Change location to the top-level directory of the source tree;
1770
 
       replace mysql-5.1 with the appropriate directory name.
1771
 
shell> cd mysql-5.1
1772
 
 
1773
 
    2. Prepare the source tree for configuration.
1774
 
       Prior to MySQL 5.1.12, you must separately configure the
1775
 
       InnoDB storage engine. Run the following command from the main
1776
 
       source directory:
1777
 
shell> (cd storage/innobase; autoreconf --force --install)
1778
 
       You can omit the previous command for MySQL 5.1.12 and later,
1779
 
       or if you do not require InnoDB support.
1780
 
       Prepare the remainder of the source tree:
1781
 
shell> autoreconf --force --install
1782
 
       As an alternative to the preceding autoreconf command, you can
1783
 
       use BUILD/autorun.sh, which acts as a shortcut for the
1784
 
       following sequence of commands:
1785
 
shell> aclocal; autoheader
1786
 
shell> libtoolize --automake --force
1787
 
shell> automake --force --add-missing; autoconf
1788
 
       If you get some strange errors during this stage, verify that
1789
 
       you have the correct version of libtool installed.
1790
 
 
1791
 
    3. Configure the source tree and compile MySQL:
1792
 
shell> ./configure  # Add your favorite options here
1793
 
shell> make
1794
 
       For a description of some configure options, see Section
1795
 
       2.3.2, "Typical configure Options."
1796
 
       A collection of our standard configuration scripts is located
1797
 
       in the BUILD/ subdirectory. For example, you may find it more
1798
 
       convenient to use the BUILD/compile-pentium-debug script than
1799
 
       the preceding set of shell commands. To compile on a different
1800
 
       architecture, modify the script by removing flags that are
1801
 
       Pentium-specific, or use another script that may be more
1802
 
       appropriate. These scripts are provided on an "as-is" basis.
1803
 
       They are not officially maintained and their contents may
1804
 
       change from release to release.
1805
 
 
1806
 
    4. When the build is done, run make install. Be careful with this
1807
 
       on a production machine; the command may overwrite your live
1808
 
       release installation. If you already have MySQL installed and
1809
 
       do not want to overwrite it, run ./configure with values for
1810
 
       the --prefix, --with-tcp-port, and --with-unix-socket-path
1811
 
       options different from those used for your production server.
1812
 
 
1813
 
    5. Play hard with your new installation and try to make the new
1814
 
       features crash. Start by running make test. See Section
1815
 
       22.1.2, "MySQL Test Suite."
1816
 
 
1817
 
    6. If you have gotten to the make stage, but the distribution
1818
 
       does not compile, please enter the problem into our bugs
1819
 
       database using the instructions given in Section 1.6, "How to
1820
 
       Report Bugs or Problems." If you have installed the latest
1821
 
       versions of the required GNU tools, and they crash trying to
1822
 
       process our configuration files, please report that also.
1823
 
       However, if you get a command not found error or a similar
1824
 
       problem for aclocal, configure, or other required tools, do
1825
 
       not report it. Instead, make sure that all the required tools
1826
 
       are installed and that your PATH variable is set correctly so
1827
 
       that your shell can find them.
1828
 
 
1829
 
2.3.4. Dealing with Problems Compiling MySQL
1830
 
 
1831
 
   All MySQL programs compile cleanly for us with no warnings on
1832
 
   Solaris or Linux using gcc. On other systems, warnings may occur
1833
 
   due to differences in system include files. See Section 2.3.5,
1834
 
   "MIT-pthreads Notes," for warnings that may occur when using
1835
 
   MIT-pthreads. For other problems, check the following list.
1836
 
 
1837
 
   The solution to many problems involves reconfiguring. If you do
1838
 
   need to reconfigure, take note of the following:
1839
 
 
1840
 
     * If configure is run after it has previously been run, it may
1841
 
       use information that was gathered during its previous
1842
 
       invocation. This information is stored in config.cache. When
1843
 
       configure starts up, it looks for that file and reads its
1844
 
       contents if it exists, on the assumption that the information
1845
 
       is still correct. That assumption is invalid when you
1846
 
       reconfigure.
1847
 
 
1848
 
     * Each time you run configure, you must run make again to
1849
 
       recompile. However, you may want to remove old object files
1850
 
       from previous builds first because they were compiled using
1851
 
       different configuration options.
1852
 
 
1853
 
   To prevent old configuration information or object files from
1854
 
   being used, run these commands before re-running configure:
1855
 
shell> rm config.cache
1856
 
shell> make clean
1857
 
 
1858
 
   Alternatively, you can run make distclean.
1859
 
 
1860
 
   The following list describes some of the problems when compiling
1861
 
   MySQL that have been found to occur most often:
1862
 
 
1863
 
     * If you get errors such as the ones shown here when compiling
1864
 
       sql_yacc.cc, you probably have run out of memory or swap
1865
 
       space:
1866
 
Internal compiler error: program cc1plus got fatal signal 11
1867
 
Out of virtual memory
1868
 
Virtual memory exhausted
1869
 
       The problem is that gcc requires a huge amount of memory to
1870
 
       compile sql_yacc.cc with inline functions. Try running
1871
 
       configure with the --with-low-memory option:
1872
 
shell> ./configure --with-low-memory
1873
 
       This option causes -fno-inline to be added to the compile line
1874
 
       if you are using gcc and -O0 if you are using something else.
1875
 
       You should try the --with-low-memory option even if you have
1876
 
       so much memory and swap space that you think you can't
1877
 
       possibly have run out. This problem has been observed to occur
1878
 
       even on systems with generous hardware configurations, and the
1879
 
       --with-low-memory option usually fixes it.
1880
 
 
1881
 
     * By default, configure picks c++ as the compiler name and GNU
1882
 
       c++ links with -lg++. If you are using gcc, that behavior can
1883
 
       cause problems during configuration such as this:
1884
 
configure: error: installation or configuration problem:
1885
 
C++ compiler cannot create executables.
1886
 
       You might also observe problems during compilation related to
1887
 
       g++, libg++, or libstdc++.
1888
 
       One cause of these problems is that you may not have g++, or
1889
 
       you may have g++ but not libg++, or libstdc++. Take a look at
1890
 
       the config.log file. It should contain the exact reason why
1891
 
       your C++ compiler didn't work. To work around these problems,
1892
 
       you can use gcc as your C++ compiler. Try setting the
1893
 
       environment variable CXX to "gcc -O3". For example:
1894
 
shell> CXX="gcc -O3" ./configure
1895
 
       This works because gcc compiles C++ source files as well as
1896
 
       g++ does, but does not link in libg++ or libstdc++ by default.
1897
 
       Another way to fix these problems is to install g++, libg++,
1898
 
       and libstdc++. However, do not use libg++ or libstdc++ with
1899
 
       MySQL because this only increases the binary size of mysqld
1900
 
       without providing any benefits. Some versions of these
1901
 
       libraries have also caused strange problems for MySQL users in
1902
 
       the past.
1903
 
 
1904
 
     * If your compile fails with errors such as any of the
1905
 
       following, you must upgrade your version of make to GNU make:
1906
 
making all in mit-pthreads
1907
 
make: Fatal error in reader: Makefile, line 18:
1908
 
Badly formed macro assignment
1909
 
       Or:
1910
 
make: file `Makefile' line 18: Must be a separator (:
1911
 
       Or:
1912
 
pthread.h: No such file or directory
1913
 
       Solaris and FreeBSD are known to have troublesome make
1914
 
       programs.
1915
 
       GNU make 3.75 is known to work.
1916
 
 
1917
 
     * If you want to define flags to be used by your C or C++
1918
 
       compilers, do so by adding the flags to the CFLAGS and
1919
 
       CXXFLAGS environment variables. You can also specify the
1920
 
       compiler names this way using CC and CXX. For example:
1921
 
shell> CC=gcc
1922
 
shell> CFLAGS=-O3
1923
 
shell> CXX=gcc
1924
 
shell> CXXFLAGS=-O3
1925
 
shell> export CC CFLAGS CXX CXXFLAGS
1926
 
       See Section 2.2, "Installing MySQL from Generic Binaries on
1927
 
       Unix/Linux," for a list of flag definitions that have been
1928
 
       found to be useful on various systems.
1929
 
 
1930
 
     * If you get errors such as those shown here when compiling
1931
 
       mysqld, configure did not correctly detect the type of the
1932
 
       last argument to accept(), getsockname(), or getpeername():
1933
 
cxx: Error: mysqld.cc, line 645: In this statement, the referenced
1934
 
     type of the pointer value ''length'' is ''unsigned long'',
1935
 
     which is not compatible with ''int''.
1936
 
new_sock = accept(sock, (struct sockaddr *)&cAddr, &length);
1937
 
       To fix this, edit the config.h file (which is generated by
1938
 
       configure). Look for these lines:
1939
 
/* Define as the base type of the last arg to accept */
1940
 
#define SOCKET_SIZE_TYPE XXX
1941
 
       Change XXX to size_t or int, depending on your operating
1942
 
       system. (You must do this each time you run configure because
1943
 
       configure regenerates config.h.)
1944
 
 
1945
 
     * The sql_yacc.cc file is generated from sql_yacc.yy. Normally,
1946
 
       the build process does not need to create sql_yacc.cc because
1947
 
       MySQL comes with a pre-generated copy. However, if you do need
1948
 
       to re-create it, you might encounter this error:
1949
 
"sql_yacc.yy", line xxx fatal: default action causes potential...
1950
 
       This is a sign that your version of yacc is deficient. You
1951
 
       probably need to install bison (the GNU version of yacc) and
1952
 
       use that instead.
1953
 
 
1954
 
     * On Debian Linux 3.0, you need to install gawk instead of the
1955
 
       default mawk.
1956
 
 
1957
 
     * If you need to debug mysqld or a MySQL client, run configure
1958
 
       with the --with-debug option, and then recompile and link your
1959
 
       clients with the new client library. See MySQL Internals:
1960
 
       Porting (http://forge.mysql.com/wiki/MySQL_Internals_Porting).
1961
 
 
1962
 
     * If you get a compilation error on Linux (for example, SuSE
1963
 
       Linux 8.1 or Red Hat Linux 7.3) similar to the following one,
1964
 
       you probably do not have g++ installed:
1965
 
libmysql.c:1329: warning: passing arg 5 of `gethostbyname_r' from
1966
 
incompatible pointer type
1967
 
libmysql.c:1329: too few arguments to function `gethostbyname_r'
1968
 
libmysql.c:1329: warning: assignment makes pointer from integer
1969
 
without a cast
1970
 
make[2]: *** [libmysql.lo] Error 1
1971
 
       By default, the configure script attempts to determine the
1972
 
       correct number of arguments by using g++ (the GNU C++
1973
 
       compiler). This test yields incorrect results if g++ is not
1974
 
       installed. There are two ways to work around this problem:
1975
 
 
1976
 
          + Make sure that the GNU C++ g++ is installed. On some
1977
 
            Linux distributions, the required package is called gpp;
1978
 
            on others, it is named gcc-c++.
1979
 
 
1980
 
          + Use gcc as your C++ compiler by setting the CXX
1981
 
            environment variable to gcc:
1982
 
export CXX="gcc"
1983
 
       You must run configure again after making either of those
1984
 
       changes.
1985
 
 
1986
 
2.3.5. MIT-pthreads Notes
1987
 
 
1988
 
   This section describes some of the issues involved in using
1989
 
   MIT-pthreads.
1990
 
 
1991
 
   On Linux, you should not use MIT-pthreads. Use the installed
1992
 
   LinuxThreads implementation instead. See Section 2.6, "Installing
1993
 
   MySQL on Linux."
1994
 
 
1995
 
   If your system does not provide native thread support, you should
1996
 
   build MySQL using the MIT-pthreads package. This includes older
1997
 
   FreeBSD systems, SunOS 4.x, Solaris 2.4 and earlier, and some
1998
 
   others. See Section 2.1, "General Installation Guidance."
1999
 
 
2000
 
   MIT-pthreads is not part of the MySQL 5.1 source distribution. If
2001
 
   you require this package, you need to download it separately from
2002
 
   http://dev.mysql.com/Downloads/Contrib/pthreads-1_60_beta6-mysql.t
2003
 
   ar.gz
2004
 
 
2005
 
   After downloading, extract this source archive into the top level
2006
 
   of the MySQL source directory. It creates a new subdirectory named
2007
 
   mit-pthreads.
2008
 
 
2009
 
     * On most systems, you can force MIT-pthreads to be used by
2010
 
       running configure with the --with-mit-threads option:
2011
 
shell> ./configure --with-mit-threads
2012
 
       Building in a nonsource directory is not supported when using
2013
 
       MIT-pthreads because we want to minimize our changes to this
2014
 
       code.
2015
 
 
2016
 
     * The checks that determine whether to use MIT-pthreads occur
2017
 
       only during the part of the configuration process that deals
2018
 
       with the server code. If you have configured the distribution
2019
 
       using --without-server to build only the client code, clients
2020
 
       do not know whether MIT-pthreads is being used and use Unix
2021
 
       socket file connections by default. Because Unix socket files
2022
 
       do not work under MIT-pthreads on some platforms, this means
2023
 
       you need to use -h or --host with a value other than localhost
2024
 
       when you run client programs.
2025
 
 
2026
 
     * When MySQL is compiled using MIT-pthreads, system locking is
2027
 
       disabled by default for performance reasons. You can tell the
2028
 
       server to use system locking with the --external-locking
2029
 
       option. This is needed only if you want to be able to run two
2030
 
       MySQL servers against the same data files, but that is not
2031
 
       recommended, anyway.
2032
 
 
2033
 
     * Sometimes the pthread bind() command fails to bind to a socket
2034
 
       without any error message (at least on Solaris). The result is
2035
 
       that all connections to the server fail. For example:
2036
 
shell> mysqladmin version
2037
 
mysqladmin: connect to server at '' failed;
2038
 
error: 'Can't connect to mysql server on localhost (146)'
2039
 
       The solution to this problem is to kill the mysqld server and
2040
 
       restart it. This has happened to us only when we have forcibly
2041
 
       stopped the server and restarted it immediately.
2042
 
 
2043
 
     * With MIT-pthreads, the sleep() system call isn't interruptible
2044
 
       with SIGINT (break). This is noticeable only when you run
2045
 
       mysqladmin --sleep. You must wait for the sleep() call to
2046
 
       terminate before the interrupt is served and the process
2047
 
       stops.
2048
 
 
2049
 
     * When linking, you might receive warning messages like these
2050
 
       (at least on Solaris); they can be ignored:
2051
 
ld: warning: symbol `_iob' has differing sizes:
2052
 
    (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
2053
 
file /usr/lib/libc.so value=0x140);
2054
 
    /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
2055
 
ld: warning: symbol `__iob' has differing sizes:
2056
 
    (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
2057
 
file /usr/lib/libc.so value=0x140);
2058
 
    /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
2059
 
 
2060
 
     * Some other warnings also can be ignored:
2061
 
implicit declaration of function `int strtoll(...)'
2062
 
implicit declaration of function `int strtoul(...)'
2063
 
 
2064
 
     * We have not been able to make readline work with MIT-pthreads.
2065
 
       (This is not necessary, but may be of interest to some.)
2066
 
 
2067
 
2.4. Upgrading or Downgrading MySQL
2068
 
 
2069
 
2.4.1. Upgrading MySQL
2070
 
 
2071
 
   As a general rule, to upgrade from one release series to another,
2072
 
   you should go to the next series rather than skipping a series. To
2073
 
   upgrade from a release series previous to MySQL 5.0, upgrade to
2074
 
   each successive release series in turn until you have reached
2075
 
   MySQL 5.0, and then proceed with the upgrade to MySQL 5.1. For
2076
 
   example, if you currently are running MySQL 4.0 and wish to
2077
 
   upgrade to a newer series, upgrade to MySQL 4.1 first before
2078
 
   upgrading to 5.0, and so forth. For information on upgrading to
2079
 
   MySQL 5.0, see the MySQL 5.0 Reference Manual; for earlier
2080
 
   releases, see the MySQL 3.23, 4.0, 4.1 Reference Manual.
2081
 
 
2082
 
   If you perform a binary (in-place) upgrade without dumping and
2083
 
   reloading tables, you cannot upgrade directly from MySQL 4.1 to
2084
 
   5.1. This occurs due to an incompatible change in the MyISAM table
2085
 
   index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
2086
 
   repair all MyISAM tables (see Section 2.4.4, "Rebuilding or
2087
 
   Repairing Tables or Indexes"). Then upgrade from MySQL 5.0 to 5.1
2088
 
   and check and repair your tables.
2089
 
 
2090
 
   To upgrade from MySQL 5.0 to 5.1, use the items in the following
2091
 
   checklist as a guide:
2092
 
 
2093
 
     * Before any upgrade, back up your databases, including the
2094
 
       mysql database that contains the grant tables. See Section
2095
 
       6.1, "Database Backup Methods."
2096
 
 
2097
 
     * Read all the notes in Section 2.4.1.1, "Upgrading from MySQL
2098
 
       5.0 to 5.1." These notes enable you to identify upgrade issues
2099
 
       that apply to your current MySQL installation. Some
2100
 
       incompatibilities discussed in that section require your
2101
 
       attention before upgrading. Others should be dealt with after
2102
 
       upgrading.
2103
 
 
2104
 
     * Read Appendix C, "MySQL Change History" as well, which
2105
 
       provides information about features that are new in MySQL 5.1
2106
 
       or differ from those found in MySQL 5.0.
2107
 
 
2108
 
     * After you upgrade to a new version of MySQL, run mysql_upgrade
2109
 
       (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
2110
 
       Upgrade"). This program checks your tables, and attempts to
2111
 
       repair them if necessary. It also updates your grant tables to
2112
 
       make sure that they have the current structure so that you can
2113
 
       take advantage of any new capabilities. (Some releases of
2114
 
       MySQL introduce changes to the structure of the grant tables
2115
 
       to add new privileges or features.)
2116
 
 
2117
 
     * If you are running MySQL Server on Windows, see Section 2.5.7,
2118
 
       "Upgrading MySQL on Windows."
2119
 
 
2120
 
     * If you are using replication, see Section 16.3.3, "Upgrading a
2121
 
       Replication Setup," for information on upgrading your
2122
 
       replication setup.
2123
 
 
2124
 
     * If you are upgrading an installation originally produced by
2125
 
       installing multiple RPM packages, it is best to upgrade all
2126
 
       the packages, not just some. For example, if you previously
2127
 
       installed the server and client RPMs, do not upgrade just the
2128
 
       server RPM.
2129
 
 
2130
 
     * As of MySQL 5.1.9, the mysqld-max server is included in binary
2131
 
       distributions. There is no separate MySQL-Max distribution. As
2132
 
       of MySQL 5.1.12, there is no mysqld-max server at all in
2133
 
       binary distributions. They contain a server that includes the
2134
 
       features previously included in mysqld-max.
2135
 
 
2136
 
     * If you have created a user-defined function (UDF) with a given
2137
 
       name and upgrade MySQL to a version that implements a new
2138
 
       built-in function with the same name, the UDF becomes
2139
 
       inaccessible. To correct this, use DROP FUNCTION to drop the
2140
 
       UDF, and then use CREATE FUNCTION to re-create the UDF with a
2141
 
       different nonconflicting name. The same is true if the new
2142
 
       version of MySQL implements a built-in function with the same
2143
 
       name as an existing stored function. See Section 8.2.4,
2144
 
       "Function Name Parsing and Resolution," for the rules
2145
 
       describing how the server interprets references to different
2146
 
       kinds of functions.
2147
 
 
2148
 
   You can always move the MySQL format files and data files between
2149
 
   different versions on systems with the same architecture as long
2150
 
   as you stay within versions for the same release series of MySQL.
2151
 
 
2152
 
   If you are cautious about using new versions, you can always
2153
 
   rename your old mysqld before installing a newer one. For example,
2154
 
   if you are using MySQL 5.0.13 and want to upgrade to 5.1.10,
2155
 
   rename your current server from mysqld to mysqld-5.0.13. If your
2156
 
   new mysqld then does something unexpected, you can simply shut it
2157
 
   down and restart with your old mysqld.
2158
 
 
2159
 
   If, after an upgrade, you experience problems with recompiled
2160
 
   client programs, such as Commands out of sync or unexpected core
2161
 
   dumps, you probably have used old header or library files when
2162
 
   compiling your programs. In this case, you should check the date
2163
 
   for your mysql.h file and libmysqlclient.a library to verify that
2164
 
   they are from the new MySQL distribution. If not, recompile your
2165
 
   programs with the new headers and libraries.
2166
 
 
2167
 
   If problems occur, such as that the new mysqld server does not
2168
 
   start or that you cannot connect without a password, verify that
2169
 
   you do not have an old my.cnf file from your previous
2170
 
   installation. You can check this with the --print-defaults option
2171
 
   (for example, mysqld --print-defaults). If this command displays
2172
 
   anything other than the program name, you have an active my.cnf
2173
 
   file that affects server or client operation.
2174
 
 
2175
 
   If your MySQL installation contains a large amount of data that
2176
 
   might take a long time to convert after an in-place upgrade, you
2177
 
   might find it useful to create a "dummy" database instance for
2178
 
   assessing what conversions might be needed and the work involved
2179
 
   to perform them. Make a copy of your MySQL instance that contains
2180
 
   a full copy of the mysql database, plus all other databases
2181
 
   without data. Run your upgrade procedure on this dummy instance to
2182
 
   see what actions might be needed so that you can better evaluate
2183
 
   the work involved when performing actual data conversion on your
2184
 
   original database instance.
2185
 
 
2186
 
   It is a good idea to rebuild and reinstall the Perl DBD::mysql
2187
 
   module whenever you install a new release of MySQL. The same
2188
 
   applies to other MySQL interfaces as well, such as PHP mysql
2189
 
   extensions and the Python MySQLdb module.
2190
 
 
2191
 
2.4.1.1. Upgrading from MySQL 5.0 to 5.1
2192
 
 
2193
 
   After upgrading a 5.0 installation to 5.0.10 or above, it is
2194
 
   necessary to upgrade your grant tables. Otherwise, creating stored
2195
 
   procedures and functions might not work. To perform this upgrade,
2196
 
   run mysql_upgrade.
2197
 
 
2198
 
Note
2199
 
 
2200
 
   It is good practice to back up your data before installing any new
2201
 
   version of software. Although MySQL works very hard to ensure a
2202
 
   high level of quality, you should protect your data by making a
2203
 
   backup.
2204
 
 
2205
 
   To upgrade to 5.1 from any previous version, MySQL recommends that
2206
 
   you dump your tables with mysqldump before upgrading and reload
2207
 
   the dump file after upgrading.
2208
 
 
2209
 
   If you perform a binary (in-place) upgrade without dumping and
2210
 
   reloading tables, you cannot upgrade directly from MySQL 4.1 to
2211
 
   5.1. This occurs due to an incompatible change in the MyISAM table
2212
 
   index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
2213
 
   repair all MyISAM tables (see Section 2.4.4, "Rebuilding or
2214
 
   Repairing Tables or Indexes"). Then upgrade from MySQL 5.0 to 5.1
2215
 
   and check and repair your tables.
2216
 
 
2217
 
   In general, you should do the following when upgrading from MySQL
2218
 
   5.0 to 5.1:
2219
 
 
2220
 
     * Read all the items in the following sections to see whether
2221
 
       any of them might affect your applications:
2222
 
 
2223
 
          + Section 2.4.1, "Upgrading MySQL," has general update
2224
 
            information.
2225
 
 
2226
 
          + The items in the change lists found later in this section
2227
 
            enable you to identify upgrade issues that apply to your
2228
 
            current MySQL installation.
2229
 
 
2230
 
          + The MySQL 5.1 change history describes significant new
2231
 
            features you can use in 5.1 or that differ from those
2232
 
            found in MySQL 5.0. Some of these changes may result in
2233
 
            incompatibilities. See Section C.1, "Changes in Release
2234
 
            5.1.x (Production)."
2235
 
 
2236
 
     * Note particularly any changes that are marked Known issue or
2237
 
       Incompatible change. These incompatibilities with earlier
2238
 
       versions of MySQL may require your attention before you
2239
 
       upgrade.
2240
 
       Our aim is to avoid these changes, but occasionally they are
2241
 
       necessary to correct problems that would be worse than an
2242
 
       incompatibility between releases. If any upgrade issue
2243
 
       applicable to your installation involves an incompatibility
2244
 
       that requires special handling, follow the instructions given
2245
 
       in the incompatibility description. Often this will involve a
2246
 
       dump and reload, or use of a statement such as CHECK TABLE or
2247
 
       REPAIR TABLE.
2248
 
       For dump and reload instructions, see Section 2.4.4,
2249
 
       "Rebuilding or Repairing Tables or Indexes." Any procedure
2250
 
       that involves REPAIR TABLE with the USE_FRM option must be
2251
 
       done before upgrading. Use of this statement with a version of
2252
 
       MySQL different from the one used to create the table (that
2253
 
       is, using it after upgrading) may damage the table. See
2254
 
       Section 12.5.2.6, "REPAIR TABLE Syntax."
2255
 
 
2256
 
     * After you upgrade to a new version of MySQL, run mysql_upgrade
2257
 
       (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
2258
 
       Upgrade"). This program checks your tables, and attempts to
2259
 
       repair them if necessary. It also updates your grant tables to
2260
 
       make sure that they have the current structure so that you can
2261
 
       take advantage of any new capabilities. (Some releases of
2262
 
       MySQL introduce changes to the structure of the grant tables
2263
 
       to add new privileges or features.)
2264
 
 
2265
 
     * Check Section 2.4.3, "Checking Whether Tables or Indexes Must
2266
 
       Be Rebuilt," to see whether changes to table formats or to
2267
 
       character sets or collations were made between your current
2268
 
       version of MySQL and the version to which you are upgrading.
2269
 
       If so and these changes result in an incompatibility between
2270
 
       MySQL versions, you will need to upgrade the affected tables
2271
 
       using the instructions in Section 2.4.4, "Rebuilding or
2272
 
       Repairing Tables or Indexes."
2273
 
 
2274
 
     * If you are running MySQL Server on Windows, see Section 2.5.7,
2275
 
       "Upgrading MySQL on Windows."
2276
 
 
2277
 
     * If you are using replication, see Section 16.3.3, "Upgrading a
2278
 
       Replication Setup," for information on upgrading your
2279
 
       replication setup.
2280
 
 
2281
 
   If your MySQL installation contains a large amount of data that
2282
 
   might take a long time to convert after an in-place upgrade, you
2283
 
   might find it useful to create a "dummy" database instance for
2284
 
   assessing what conversions might be needed and the work involved
2285
 
   to perform them. Make a copy of your MySQL instance that contains
2286
 
   a full copy of the mysql database, plus all other databases
2287
 
   without data. Run your upgrade procedure on this dummy instance to
2288
 
   see what actions might be needed so that you can better evaluate
2289
 
   the work involved when performing actual data conversion on your
2290
 
   original database instance.
2291
 
 
2292
 
   MySQL Enterprise MySQL Enterprise subscribers will find more
2293
 
   information about upgrading in the Knowledge Base articles found
2294
 
   at Upgrading
2295
 
   (https://kb.mysql.com/search.php?cat=search&category=41). Access
2296
 
   to the MySQL Knowledge Base collection of articles is one of the
2297
 
   advantages of subscribing to MySQL Enterprise. For more
2298
 
   information, see
2299
 
   http://www.mysql.com/products/enterprise/advisors.html.
2300
 
 
2301
 
   The following lists describe changes that may affect applications
2302
 
   and that you should watch out for when upgrading to MySQL 5.1.
2303
 
 
2304
 
   Configuration Changes:
2305
 
 
2306
 
     * Before MySQL 5.1.11, to build MySQL from source with SSL
2307
 
       support enabled, you would invoke configure with either the
2308
 
       --with-openssl or --with-yassl option. In MySQL 5.1.11, those
2309
 
       options both have been replaced by the --with-ssl option. By
2310
 
       default, --with-ssl causes the bundled yaSSL library to be
2311
 
       used. To select OpenSSL instead, give the option as
2312
 
       --with-ssl=path, where path is the directory where the OpenSSL
2313
 
       header files and libraries are located.
2314
 
 
2315
 
   Server Changes:
2316
 
 
2317
 
     * Known issue: After a binary upgrade to MySQL 5.1 from a MySQL
2318
 
       5.0 installation that contains ARCHIVE tables, accessing those
2319
 
       tables will cause the server to crash, even if you have run
2320
 
       mysql_upgrade or CHECK TABLE ... FOR UPGRADE. To work around
2321
 
       this problem, use mysqldump to dump all ARCHIVE tables before
2322
 
       upgrading, and reload them into MySQL 5.1 after upgrading.
2323
 
 
2324
 
     * Known issue: The fix for
2325
 
       Bug#23491: http://bugs.mysql.com/23491 introduced a problem
2326
 
       with SHOW CREATE VIEW, which is used by mysqldump. This causes
2327
 
       an incompatibility when upgrading from versions affected by
2328
 
       that bug fix (MySQL 5.0.40 through 5.0.43, MySQL 5.1.18
2329
 
       through 5.1.19): If you use mysqldump before upgrading from an
2330
 
       affected version and reload the data after upgrading to a
2331
 
       higher version, you must drop and recreate your views.
2332
 
 
2333
 
     * Known issue: Dumps performed by using mysqldump to generate a
2334
 
       dump file before the upgrade and reloading the file after
2335
 
       upgrading are subject to the following problem:
2336
 
       Before MySQL 5.0.40, mysqldump displays SPATIAL index
2337
 
       definitions using prefix lengths for the indexed columns.
2338
 
       These prefix lengths are accepted in MySQL 5.0, but not as of
2339
 
       MySQL 5.1. If you use mysqldump from versions of MySQL older
2340
 
       than 5.0.40, any table containing SPATIAL indexes will cause
2341
 
       an error when the dump file is reloaded into MySQL 5.1 or
2342
 
       higher.
2343
 
       For example, a table definition might look like this when
2344
 
       dumped in MySQL 5.0:
2345
 
CREATE TABLE `t` (
2346
 
 `g` geometry NOT NULL,
2347
 
 SPATIAL KEY `g` (`g`(32))
2348
 
) ENGINE=MyISAM DEFAULT CHARSET=latin1
2349
 
       The SPATIAL index definition will not be accepted in MySQL
2350
 
       5.1. To work around this, edit the dump file to remove the
2351
 
       prefix:
2352
 
CREATE TABLE `t` (
2353
 
 `g` geometry NOT NULL,
2354
 
 SPATIAL KEY `g` (`g`)
2355
 
) ENGINE=MyISAM DEFAULT CHARSET=latin1
2356
 
       Dump files can be large, so it may be preferable to dump table
2357
 
       definitions and data separately to make it easier to edit the
2358
 
       definitions:
2359
 
shell> mysqldump --no-data other_args > definitions.sql
2360
 
shell> mysqldump --no-create-info other_args > data.sql
2361
 
       Then edit definitions.sql before reloading definitions.sql and
2362
 
       data.sql, in that order.
2363
 
       If you upgrade to a version of MySQL 5.0 higher than 5.0.40
2364
 
       before upgrading to MySQL 5.1, this problem does not occur.
2365
 
 
2366
 
     * Known issue: Before MySQL 5.1.30, the CHECK TABLE ... FOR
2367
 
       UPGRADE statement did not check for incompatible collation
2368
 
       changes made in MySQL 5.1.24. (This also affects mysqlcheck
2369
 
       and mysql_upgrade, which cause that statement to be executed.)
2370
 
       Prior to the fix made in 5.1.30, a binary upgrade (performed
2371
 
       without dumping tables with mysqldump before the upgrade and
2372
 
       reloading the dump file after the upgrade) would corrupt
2373
 
       tables. After the fix, CHECK TABLE ... FOR UPGRADE properly
2374
 
       detects the problem and warns about tables that need repair.
2375
 
       However, the fix is not backward compatible and can result in
2376
 
       a downgrading problem under these circumstances:
2377
 
 
2378
 
         1. Perform a binary upgrade to a version of MySQL that
2379
 
            includes the fix.
2380
 
 
2381
 
         2. Run CHECK TABLE ... FOR UPGRADE (or mysqlcheck or
2382
 
            mysql_upgrade) to upgrade tables.
2383
 
 
2384
 
         3. Perform a binary downgrade to a version of MySQL that
2385
 
            does not include the fix.
2386
 
       The solution is to dump tables with mysqldump before the
2387
 
       downgrade and reload the dump file after the downgrade.
2388
 
       Alternatively, drop and recreate affected indexes.
2389
 
 
2390
 
     * Known issue: MySQL introduces encoding for table names that
2391
 
       have non-ASCII characters (see Section 8.2.3, "Mapping of
2392
 
       Identifiers to File Names"). After a binary upgrade from MySQL
2393
 
       5.0 to 5.1 or higher, the server recognizes names that have
2394
 
       non-ASCII characters and adds a #mysql50# prefix to them.
2395
 
       As of MySQL 5.1.31, mysql_upgrade encodes these names by
2396
 
       executing the following command:
2397
 
mysqlcheck --all-databases --check-upgrade --fix-db-names --fix-table
2398
 
-names
2399
 
       Prior to MySQL 5.1.31, mysql_upgrade does not execute this
2400
 
       command, so you should execute it manually if you have
2401
 
       database or table names that contain nonalphanumeric
2402
 
       characters.
2403
 
       Prior to MySQL 5.1.23, the mysqlcheck command does not perform
2404
 
       the name encoding for views. To work around this problem, drop
2405
 
       each affected view and recreate it.
2406
 
       mysqlcheck cannot fix names that contain literal instances of
2407
 
       the @ character that is used for encoding special characters.
2408
 
       If you have databases or tables that contain this character,
2409
 
       use mysqldump to dump them before upgrading to MySQL 5.1, and
2410
 
       then reload the dump file after upgrading.
2411
 
 
2412
 
     * Known issue: When upgrading from MySQL 5.0 to versions of 5.1
2413
 
       prior to 5.1.23, running mysqlcheck (or mysql_upgrade, which
2414
 
       runs mysqlcheck) to upgrade tables fails for names that must
2415
 
       be written as quoted identifiers. To work around this problem,
2416
 
       rename each affected table to a name that does not require
2417
 
       quoting:
2418
 
RENAME TABLE `tab``le_a` TO table_a;
2419
 
RENAME TABLE `table b` TO table_b;
2420
 
       After renaming the tables, run the mysql_upgrade program. Then
2421
 
       rename the tables back to their original names:
2422
 
RENAME TABLE table_a TO `tab``le_a`;
2423
 
RENAME TABLE table_b TO `table b`;
2424
 
 
2425
 
     * Known issue: In connection with view creation, the server
2426
 
       created arc directories inside database directories and
2427
 
       maintained useless copies of .frm files there. Creation and
2428
 
       renaming procedures of those copies as well as creation of arc
2429
 
       directories has been discontinued in MySQL 5.1.29.
2430
 
       This change does cause a problem when downgrading to older
2431
 
       server versions which manifests itself under these
2432
 
       circumstances:
2433
 
 
2434
 
         1. Create a view v_orig in MySQL 5.1.29 or higher.
2435
 
 
2436
 
         2. Rename the view to v_new and then back to v_orig.
2437
 
 
2438
 
         3. Downgrade to an older 5.1.x server and run mysql_upgrade.
2439
 
 
2440
 
         4. Try to rename v_orig to v_new again. This operation
2441
 
            fails.
2442
 
       As a workaround to avoid this problem, use either of these
2443
 
       approaches:
2444
 
 
2445
 
          + Dump your data using mysqldump before downgrading and
2446
 
            reload the dump file after downgrading.
2447
 
 
2448
 
          + Instead of renaming a view after the downgrade, drop it
2449
 
            and recreate it.
2450
 
 
2451
 
     * Incompatible change: Character set or collation changes were
2452
 
       made in MySQL 5.1.21, 5.1.23, and 5.1.24 that may require
2453
 
       table indexes to be rebuilt. For details, see Section 2.4.3,
2454
 
       "Checking Whether Tables or Indexes Must Be Rebuilt."
2455
 
 
2456
 
     * Incompatible change: MySQL 5.1 implements support for a plugin
2457
 
       API that allows the loading and unloading of components at
2458
 
       runtime, without restarting the server. Section 22.2, "The
2459
 
       MySQL Plugin Interface." The plugin API requires the
2460
 
       mysql.plugin table. After upgrading from an older version of
2461
 
       MySQL, you should run the mysql_upgrade command to create this
2462
 
       table. See Section 4.4.8, "mysql_upgrade --- Check Tables for
2463
 
       MySQL Upgrade."
2464
 
       Plugins are installed in the directory named by the plugin_dir
2465
 
       system variable. This variable also controls the location from
2466
 
       which the server loads user-defined functions (UDFs), which is
2467
 
       a change from earlier versions of MySQL. That is, all UDF
2468
 
       library files now must be installed in the plugin directory.
2469
 
       When upgrading from an older version of MySQL, you must
2470
 
       migrate your UDF files to the plugin directory.
2471
 
 
2472
 
     * Incompatible change: The table_cache system variable has been
2473
 
       renamed to table_open_cache. Any scripts that refer to
2474
 
       table_cache must be updated to use the new name.
2475
 
 
2476
 
     * Incompatible change: In MySQL 5.1.36, options for loading
2477
 
       plugins such as pluggable storage engines were changed from
2478
 
       boolean to tristate format. The implementations overlap, but
2479
 
       if you previously used options of the form --plugin_name=0 or
2480
 
       --plugin_name=1, you should instead use --plugin_name=OFF or
2481
 
       --plugin_name=ON, respectively. For details, see Section
2482
 
       5.1.3, "Server Options for Loading Plugins."
2483
 
 
2484
 
     * Incompatible change: From MySQL 5.1.24 to 5.1.31, the UPDATE
2485
 
       statement was changed such that assigning NULL to a NOT NULL
2486
 
       column caused an error even when strict SQL mode was not
2487
 
       enabled. The original behavior before MySQL 5.1.24 was that
2488
 
       such assignments caused an error only in strict SQL mode, and
2489
 
       otherwise set the column to the implicit default value for the
2490
 
       column data type and generated a warning. (For information
2491
 
       about implicit default values, see Section 10.1.4, "Data Type
2492
 
       Default Values.")
2493
 
       The change caused compatibility problems for applications that
2494
 
       relied on the original behavior. It also caused replication
2495
 
       problems between servers that had the original behavior and
2496
 
       those that did not, for applications that assigned NULL to NOT
2497
 
       NULL columns in UPDATE statements without strict SQL mode
2498
 
       enabled. The change was reverted in MySQL 5.1.32 so that
2499
 
       UPDATE again had the original behavior. Problems can still
2500
 
       occur if you replicate between servers that have the modified
2501
 
       UPDATE behavior and those that do not.
2502
 
 
2503
 
     * Incompatible change: As of MySQL 5.1.29, the default binary
2504
 
       logging mode has been changed from MIXED to STATEMENT for
2505
 
       compatibility with MySQL 5.0.
2506
 
 
2507
 
     * Incompatible change: In MySQL 5.1.25, a change was made to the
2508
 
       way that the server handles prepared statements. This affects
2509
 
       prepared statements processed at the SQL level (using the
2510
 
       PREPARE statement) and those processed using the binary
2511
 
       client-server protocol (using the mysql_stmt_prepare() C API
2512
 
       function).
2513
 
       Previously, changes to metadata of tables or views referred to
2514
 
       in a prepared statement could cause a server crash when the
2515
 
       statement was next executed, or perhaps an error at execute
2516
 
       time with a crash occurring later. For example, this could
2517
 
       happen after dropping a table and recreating it with a
2518
 
       different definition.
2519
 
       Now metadata changes to tables or views referred to by
2520
 
       prepared statements are detected and cause automatic
2521
 
       repreparation of the statement when it is next executed.
2522
 
       Metadata changes occur for DDL statements such as those that
2523
 
       create, drop, alter, rename, or truncate tables, or that
2524
 
       analyze, optimize, or repair tables. Repreparation also occurs
2525
 
       after referenced tables or views are flushed from the table
2526
 
       definition cache, either implicitly to make room for new
2527
 
       entries in the cache, or explicitly due to FLUSH TABLES.
2528
 
       Repreparation is automatic, but to the extent that it occurs,
2529
 
       performance of prepared statements is diminished.
2530
 
       Table content changes (for example, with INSERT or UPDATE) do
2531
 
       not cause repreparation, nor do SELECT statements.
2532
 
       An incompatibility with previous versions of MySQL is that a
2533
 
       prepared statement may now return a different set of columns
2534
 
       or different column types from one execution to the next. For
2535
 
       example, if the prepared statement is SELECT * FROM t1,
2536
 
       altering t1 to contain a different number of columns causes
2537
 
       the next execution to return a number of columns different
2538
 
       from the previous execution.
2539
 
       Older versions of the client library cannot handle this change
2540
 
       in behavior. For applications that use prepared statements
2541
 
       with the new server, an upgrade to the new client library is
2542
 
       strongly recommended.
2543
 
       Along with this change to statement repreparation, the default
2544
 
       value of the table_definition_cache system variable has been
2545
 
       increased from 128 to 256. The purpose of this increase is to
2546
 
       lessen the chance that prepared statements will need
2547
 
       repreparation due to referred-to tables/views having been
2548
 
       flushed from the cache to make room for new entries.
2549
 
       A new status variable, Com_stmt_reprepare, has been introduced
2550
 
       to track the number of repreparations.
2551
 
 
2552
 
     * Incompatible change: As of MySQL 5.1.23, within a stored
2553
 
       routine, it is no longer allowable to declare a cursor for a
2554
 
       SHOW or DESCRIBE statement. This happened to work in some
2555
 
       instances, but is no longer supported. In many cases, a
2556
 
       workaround for this change is to use the cursor with a SELECT
2557
 
       query to read from an INFORMATION_SCHEMA table that produces
2558
 
       the same information as the SHOW statement.
2559
 
 
2560
 
     * Incompatible change: SHOW CREATE VIEW displays view
2561
 
       definitions using an AS alias_name clause for each column. If
2562
 
       a column is created from an expression, the default alias is
2563
 
       the expression text, which can be quite long. As of MySQL
2564
 
       5.1.23, aliases for column names in CREATE VIEW statements are
2565
 
       checked against the maximum column length of 64 characters
2566
 
       (not the maximum alias length of 256 characters). As a result,
2567
 
       views created from the output of SHOW CREATE VIEW fail if any
2568
 
       column alias exceeds 64 characters. This can cause problems
2569
 
       for replication or loading dump files. For additional
2570
 
       information and workarounds, see Section D.4, "Restrictions on
2571
 
       Views."
2572
 
 
2573
 
     * Incompatible change: Several issues were identified for stored
2574
 
       programs (stored procedures and functions, triggers, and
2575
 
       events) and views containing non-ASCII symbols. These issues
2576
 
       involved conversion errors due to incomplete character set
2577
 
       information when translating these objects to and from stored
2578
 
       format.
2579
 
       To address these problems, the representation for these
2580
 
       objects was changed in MySQL 5.1.21. However, the fixes affect
2581
 
       all stored programs and views. (For example, you will see
2582
 
       warnings about "no creation context.") To avoid warnings from
2583
 
       the server about the use of old definitions from any release
2584
 
       prior to 5.1.21, you should dump stored programs and views
2585
 
       with mysqldump after upgrading to 5.1.21 or higher, and then
2586
 
       reload them to recreate them with new definitions. Invoke
2587
 
       mysqldump with a --default-character-set option that names the
2588
 
       non-ASCII character set that was used for the definitions when
2589
 
       the objects were originally defined.
2590
 
 
2591
 
     * Incompatible change: As of MySQL 5.1.20, mysqld_safe supports
2592
 
       error logging to syslog on systems that support the logger
2593
 
       command. The new --syslog and --skip-syslog options can be
2594
 
       used instead of the --log-error option to control logging
2595
 
       behavior, as described in Section 4.3.2, "mysqld_safe ---
2596
 
       MySQL Server Startup Script."
2597
 
       In 5.1.21 and up, the default is --skip-syslog, which is
2598
 
       compatible with the default behavior of writing an error log
2599
 
       file for releases prior to 5.1.20.
2600
 
       In 5.1.20 only, the following conditions apply: 1) The default
2601
 
       is to use syslog, which is not compatible with releases prior
2602
 
       to 5.1.20. 2) Logging to syslog may fail to operate correctly
2603
 
       in some cases. For these reasons, avoid using MySQL 5.1.20.
2604
 
 
2605
 
     * Incompatible change: As of MySQL 5.1.18, the plugin interface
2606
 
       and its handling of system variables was changed. Command-line
2607
 
       options such as --skip-innodb now cause an error if InnoDB is
2608
 
       not built-in or plugin-loaded. You should use
2609
 
       --loose-skip-innodb if you do not want any error even if
2610
 
       InnoDB is not available. The --loose prefix modifier should be
2611
 
       used for all command-line options where you are uncertain
2612
 
       whether the plugin exists and when you want the operation to
2613
 
       proceed even if the option is necessarily ignored due to the
2614
 
       absence of the plugin. (For a desecription of how --loose
2615
 
       works, see Section 4.2.3.1, "Using Options on the Command
2616
 
       Line.")
2617
 
 
2618
 
     * Incompatible change: As of MySQL 5.1.15, InnoDB rolls back
2619
 
       only the last statement on a transaction timeout. A new
2620
 
       option, --innodb_rollback_on_timeout, causes InnoDB to abort
2621
 
       and roll back the entire transaction if a transaction timeout
2622
 
       occurs (the same behavior as in MySQL 4.1).
2623
 
 
2624
 
     * Incompatible change: As of MySQL 5.1.15, the following
2625
 
       conditions apply to enabling the read_only system variable:
2626
 
 
2627
 
          + If you attempt to enable read_only while you have any
2628
 
            explicit locks (acquired with LOCK TABLES or have a
2629
 
            pending transaction, an error will occur.
2630
 
 
2631
 
          + If other clients hold explicit table locks or have
2632
 
            pending transactions, the attempt to enable read_only
2633
 
            blocks until the locks are released and the transactions
2634
 
            end. While the attempt to enable read_only is pending,
2635
 
            requests by other clients for table locks or to begin
2636
 
            transactions also block until read_only has been set.
2637
 
 
2638
 
          + read_only can be enabled while you hold a global read
2639
 
            lock (acquired with FLUSH TABLES WITH READ LOCK) because
2640
 
            that does not involve table locks.
2641
 
       Previously, the attempt to enable read_only would return
2642
 
       immediately even if explicit locks or transactions were
2643
 
       pending, so some data changes could occur for statements
2644
 
       executing in the server at the same time.
2645
 
 
2646
 
     * Incompatible change: The number of function names affected by
2647
 
       IGNORE_SPACE was reduced significantly in MySQL 5.1.13, from
2648
 
       about 200 to about 30. (For details about IGNORE_SPACE, see
2649
 
       Section 8.2.4, "Function Name Parsing and Resolution.") This
2650
 
       change improves the consistency of parser operation. However,
2651
 
       it also introduces the possibility of incompatibility for old
2652
 
       SQL code that relies on the following conditions:
2653
 
 
2654
 
          + IGNORE_SPACE is disabled.
2655
 
 
2656
 
          + The presence or absence of whitespace following a
2657
 
            function name is used to distinguish between a built-in
2658
 
            function and stored function that have the same name (for
2659
 
            example, PI() versus PI ()).
2660
 
       For functions that are no longer affected by IGNORE_SPACE as
2661
 
       of MySQL 5.1.13, that strategy no longer works. Either of the
2662
 
       following approaches can be used if you have code that is
2663
 
       subject to the preceding incompatibility:
2664
 
 
2665
 
          + If a stored function has a name that conflicts with a
2666
 
            built-in function, refer to the stored function with a
2667
 
            schema name qualifier, regardless of whether whitespace
2668
 
            is present. For example, write schema_name.PI() or
2669
 
            schema_name.PI ().
2670
 
 
2671
 
          + Alternatively, rename the stored function to use a
2672
 
            nonconflicting name and change invocations of the
2673
 
            function to use the new name.
2674
 
 
2675
 
     * Incompatible change: For utf8 columns, the full-text parser
2676
 
       incorrectly considered several nonword punctuation and
2677
 
       whitespace characters as word characters, causing some
2678
 
       searches to return incorrect results. The fix involves a
2679
 
       change to the full-text parser in MySQL 5.1.12, so as of
2680
 
       5.1.12, any tables that have FULLTEXT indexes on utf8 columns
2681
 
       must be repaired with REPAIR TABLE:
2682
 
REPAIR TABLE tbl_name QUICK;
2683
 
 
2684
 
     * Incompatible change: Storage engines can be pluggable at
2685
 
       runtime, so the distinction between disabled and invalid
2686
 
       storage engines no longer applies. As of MySQL 5.1.12, this
2687
 
       affects the NO_ENGINE_SUBSTITUTION SQL mode, as described in
2688
 
       Section 5.1.8, "Server SQL Modes."
2689
 
 
2690
 
     * Incompatible change: The structure of FULLTEXT indexes has
2691
 
       been changed in MySQL 5.1.6. After upgrading to MySQL 5.1.6 or
2692
 
       greater, any tables that have FULLTEXT indexes must be
2693
 
       repaired with REPAIR TABLE:
2694
 
REPAIR TABLE tbl_name QUICK;
2695
 
 
2696
 
     * Incompatible change: In MySQL 5.1.6, when log tables were
2697
 
       implemented, the default log destination for the general query
2698
 
       and slow query log was TABLE. As of MySQL 5.1.21, this default
2699
 
       has been changed to FILE, which is compatible with MySQL 5.0,
2700
 
       but incompatible with earlier releases of MySQL 5.1. If you
2701
 
       are upgrading from MySQL 5.0 to 5.1.21 or higher, no logging
2702
 
       option changes should be necessary. However, if you are
2703
 
       upgrading from 5.1.6 through 5.1.20 to 5.1.21 or higher and
2704
 
       were using TABLE logging, use the --log-output=TABLE option
2705
 
       explicitly to preserve your server's table-logging behavior.
2706
 
 
2707
 
     * Incompatible change: For ENUM columns that had enumeration
2708
 
       values containing commas, the commas were mapped to 0xff
2709
 
       internally. However, this rendered the commas
2710
 
       indistinguishable from true 0xff characters in the values.
2711
 
       This no longer occurs. However, the fix requires that you dump
2712
 
       and reload any tables that have ENUM columns containing true
2713
 
       0xff in their values: Dump the tables using mysqldump with the
2714
 
       current server before upgrading from a version of MySQL 5.1
2715
 
       older than 5.1.15 to version 5.1.15 or newer.
2716
 
 
2717
 
     * As of MySQL 5.1.12, the lc_time_names system variable
2718
 
       specifies the locale that controls the language used to
2719
 
       display day and month names and abbreviations. This variable
2720
 
       affects the output from the DATE_FORMAT(), DAYNAME() and
2721
 
       MONTHNAME() functions. See Section 9.8, "MySQL Server Locale
2722
 
       Support."
2723
 
 
2724
 
     * As of MySQL 5.1.9, mysqld_safe no longer implicitly invokes
2725
 
       mysqld-max if it exists. Instead, it invokes mysqld unless a
2726
 
       --mysqld or --mysqld-version option is given to specify
2727
 
       another server explicitly. If you previously relied on the
2728
 
       implicit invocation of mysqld-max, you should use an
2729
 
       appropriate option now. As of MySQL 5.1.12, there is no longer
2730
 
       any separate mysqld-max server, so no change should be
2731
 
       necessary.
2732
 
 
2733
 
   SQL Changes:
2734
 
 
2735
 
     * Known issue: Prior to MySQL 5.1.17, the parser accepted
2736
 
       invalid code in SQL condition handlers, leading to server
2737
 
       crashes or unexpected execution behavior in stored programs.
2738
 
       Specifically, the parser allowed a condition handler to refer
2739
 
       to labels for blocks that enclose the handler declaration.
2740
 
       This was incorrect because block label scope does not include
2741
 
       the code for handlers declared within the labeled block.
2742
 
       As of 5.1.17, the parser rejects this invalid construct, but
2743
 
       if you perform a binary upgrade (without dumping and reloading
2744
 
       your databases), existing handlers that contain the construct
2745
 
       still are invalid and should be rewritten even if they appear
2746
 
       to function as you expect.
2747
 
       To find affected handlers, use mysqldump to dump all stored
2748
 
       procedures and functions, triggers, and events. Then attempt
2749
 
       to reload them into an upgraded server. Handlers that contain
2750
 
       illegal label references will be rejected.
2751
 
       For more information about condition handlers and writing them
2752
 
       to avoid invalid jumps, see Section 12.8.4.2, "DECLARE for
2753
 
       Handlers."
2754
 
 
2755
 
     * Incompatible change: The parser accepted statements that
2756
 
       contained /* ... */ that were not properly closed with */,
2757
 
       such as SELECT 1 /* + 2. As of MySQL 5.1.23, statements that
2758
 
       contain unclosed /*-comments now are rejected with a syntax
2759
 
       error.
2760
 
       This fix has the potential to cause incompatibilities. Because
2761
 
       of Bug#26302: http://bugs.mysql.com/26302, which caused the
2762
 
       trailing */ to be truncated from comments in views, stored
2763
 
       routines, triggers, and events, it is possible that objects of
2764
 
       those types may have been stored with definitions that now
2765
 
       will be rejected as syntactically invalid. Such objects should
2766
 
       be dropped and re-created so that their definitions do not
2767
 
       contain truncated comments.
2768
 
 
2769
 
     * Incompatible change: Multiple-table DELETE statements
2770
 
       containing ambiguous aliases could have unintended side
2771
 
       effects such as deleting rows from the wrong table. Example:
2772
 
DELETE FROM t1 AS a2 USING t1 AS a1 INNER JOIN t2 AS a2;
2773
 
       As of MySQL 5.1.23, alias declarations can be declared only in
2774
 
       the table_references part. Elsewhere in the statement, alias
2775
 
       references are allowed but not alias declarations. Statements
2776
 
       containing aliases that are no longer allowed must be
2777
 
       rewritten.
2778
 
 
2779
 
     * Incompatible change: As of MySQL 5.1.8, TYPE = engine_name is
2780
 
       still accepted as a synonym for the ENGINE = engine_name table
2781
 
       option but generates a warning. You should note that this
2782
 
       option is not available in MySQL 5.1.7, and is removed
2783
 
       altogether as of MySQL 5.4 and produces a syntax error.
2784
 
       TYPE has been deprecated since MySQL 4.0.
2785
 
 
2786
 
     * Incompatible change: The namespace for triggers changed in
2787
 
       MySQL 5.0.10. Previously, trigger names had to be unique per
2788
 
       table. Now they must be unique within the schema (database).
2789
 
       An implication of this change is that DROP TRIGGER syntax now
2790
 
       uses a schema name instead of a table name (schema name is
2791
 
       optional and, if omitted, the current schema will be used).
2792
 
       When upgrading from a version of MySQL 5 older than 5.0.10 to
2793
 
       MySQL 5.0.10 or newer, you must drop all triggers and
2794
 
       re-create them or DROP TRIGGER will not work after the
2795
 
       upgrade. Here is a suggested procedure for doing this:
2796
 
 
2797
 
         1. Upgrade to MySQL 5.0.10 or later to be able to access
2798
 
            trigger information in the INFORMATION_SCHEMA.TRIGGERS
2799
 
            table. (This should work even for pre-5.0.10 triggers.)
2800
 
 
2801
 
         2. Dump all trigger definitions using the following SELECT
2802
 
            statement:
2803
 
SELECT CONCAT('CREATE TRIGGER ', t.TRIGGER_SCHEMA, '.', t.TRIGGER_NAM
2804
 
E,
2805
 
              ' ', t.ACTION_TIMING, ' ', t.EVENT_MANIPULATION, ' ON '
2806
 
,
2807
 
              t.EVENT_OBJECT_SCHEMA, '.', t.EVENT_OBJECT_TABLE,
2808
 
              ' FOR EACH ROW ', t.ACTION_STATEMENT, '//' )
2809
 
INTO OUTFILE '/tmp/triggers.sql'
2810
 
FROM INFORMATION_SCHEMA.TRIGGERS AS t;
2811
 
            The statement uses INTO OUTFILE, so you must have the
2812
 
            FILE privilege. The file will be created on the server
2813
 
            host. Use a different file name if you like. To be 100%
2814
 
            safe, inspect the trigger definitions in the triggers.sql
2815
 
            file, and perhaps make a backup of the file.
2816
 
 
2817
 
         3. Stop the server and drop all triggers by removing all
2818
 
            .TRG files in your database directories. Change location
2819
 
            to your data directory and issue this command:
2820
 
shell> rm */*.TRG
2821
 
 
2822
 
         4. Start the server and re-create all triggers using the
2823
 
            triggers.sql file:
2824
 
mysql> delimiter // ;
2825
 
mysql> source /tmp/triggers.sql //
2826
 
 
2827
 
         5. Check that all triggers were successfully created using
2828
 
            the SHOW TRIGGERS statement.
2829
 
 
2830
 
     * Incompatible change: MySQL 5.1.6 introduces the TRIGGER
2831
 
       privilege. Previously, the SUPER privilege was needed to
2832
 
       create or drop triggers. Now those operations require the
2833
 
       TRIGGER privilege. This is a security improvement because you
2834
 
       no longer need to grant users the SUPER privilege to enable
2835
 
       them to create triggers. However, the requirement that the
2836
 
       account named in a trigger's DEFINER clause must have the
2837
 
       SUPER privilege has changed to a requirement for the TRIGGER
2838
 
       privilege. When upgrading from a previous version of MySQL 5.0
2839
 
       or 5.1 to MySQL 5.1.6 or newer, be sure to update your grant
2840
 
       tables by running mysql_upgrade. This will assign the TRIGGER
2841
 
       privilege to all accounts that had the SUPER privilege. If you
2842
 
       fail to update the grant tables, triggers may fail when
2843
 
       activated. After updating the grant tables, you can revoke the
2844
 
       SUPER privilege from those accounts that no longer otherwise
2845
 
       require it.
2846
 
 
2847
 
     * Some keywords may be reserved in MySQL 5.1 that were not
2848
 
       reserved in MySQL 5.0. See Section 8.3, "Reserved Words."
2849
 
 
2850
 
     * The BACKUP TABLE, and RESTORE TABLE statements are deprecated.
2851
 
       mysqldump or mysqlhotcopy can be used as alternatives.
2852
 
 
2853
 
     * The LOAD DATA FROM MASTER and LOAD TABLE FROM MASTER
2854
 
       statements are deprecated. See Section 12.6.2.2, "LOAD DATA
2855
 
       FROM MASTER Syntax," for recommended alternatives.
2856
 
 
2857
 
     * The INSTALL PLUGIN and UNINSTALL PLUGIN statements that are
2858
 
       used for the plugin API are new. So is the WITH PARSER clause
2859
 
       for FULLTEXT index creation that associates a parser plugin
2860
 
       with a full-text index. Section 22.2, "The MySQL Plugin
2861
 
       Interface."
2862
 
 
2863
 
   C API Changes:
2864
 
 
2865
 
     * Incompatible change: As of MySQL 5.1.7, the
2866
 
       mysql_stmt_attr_get() C API function returns a boolean rather
2867
 
       than an unsigned int for STMT_ATTR_UPDATE_MAX_LENGTH.
2868
 
       (Bug#16144: http://bugs.mysql.com/16144)
2869
 
 
2870
 
2.4.2. Downgrading MySQL
2871
 
 
2872
 
   This section describes what you should do to downgrade to an older
2873
 
   MySQL version in the unlikely case that the previous version
2874
 
   worked better than the new one.
2875
 
 
2876
 
   If you are downgrading within the same release series (for
2877
 
   example, from 5.0.13 to 5.0.12) the general rule is that you just
2878
 
   have to install the new binaries on top of the old ones. There is
2879
 
   no need to do anything with the databases. As always, however, it
2880
 
   is always a good idea to make a backup.
2881
 
 
2882
 
   The following items form a checklist of things you should do
2883
 
   whenever you perform a downgrade:
2884
 
 
2885
 
     * Read the upgrading section for the release series from which
2886
 
       you are downgrading to be sure that it does not have any
2887
 
       features you really need. See Section 2.4.1, "Upgrading
2888
 
       MySQL."
2889
 
 
2890
 
     * If there is a downgrading section for that version, you should
2891
 
       read that as well.
2892
 
 
2893
 
     * To see which new features were added between the version to
2894
 
       which you are downgrading and your current version, see the
2895
 
       change logs (Appendix C, "MySQL Change History").
2896
 
 
2897
 
     * Check Section 2.4.3, "Checking Whether Tables or Indexes Must
2898
 
       Be Rebuilt," to see whether changes to table formats or to
2899
 
       character sets or collations were made between your current
2900
 
       version of MySQL and the version to which you are downgrading.
2901
 
       If so and these changes result in an incompatibility between
2902
 
       MySQL versions, you will need to downgrade the affected tables
2903
 
       using the instructions in Section 2.4.4, "Rebuilding or
2904
 
       Repairing Tables or Indexes."
2905
 
 
2906
 
   In most cases, you can move the MySQL format files and data files
2907
 
   between different versions on the same architecture as long as you
2908
 
   stay within versions for the same release series of MySQL.
2909
 
 
2910
 
   If you downgrade from one release series to another, there may be
2911
 
   incompatibilities in table storage formats. In this case, use
2912
 
   mysqldump to dump your tables before downgrading. After
2913
 
   downgrading, reload the dump file using mysql or mysqlimport to
2914
 
   re-create your tables. For examples, see Section 2.4.5, "Copying
2915
 
   MySQL Databases to Another Machine."
2916
 
 
2917
 
   A typical symptom of a downward-incompatible table format change
2918
 
   when you downgrade is that you cannot open tables. In that case,
2919
 
   use the following procedure:
2920
 
 
2921
 
    1. Stop the older MySQL server that you are downgrading to.
2922
 
 
2923
 
    2. Restart the newer MySQL server you are downgrading from.
2924
 
 
2925
 
    3. Dump any tables that were inaccessible to the older server by
2926
 
       using mysqldump to create a dump file.
2927
 
 
2928
 
    4. Stop the newer MySQL server and restart the older one.
2929
 
 
2930
 
    5. Reload the dump file into the older server. Your tables should
2931
 
       be accessible.
2932
 
 
2933
 
   It might also be the case that the structure of the system tables
2934
 
   in the mysql database has changed and that downgrading introduces
2935
 
   some loss of functionality or requires some adjustments. Here are
2936
 
   some examples:
2937
 
 
2938
 
     * Trigger creation requires the TRIGGER privilege as of MySQL
2939
 
       5.1. In MySQL 5.0, there is no TRIGGER privilege and SUPER is
2940
 
       required instead. If you downgrade from MySQL 5.1 to 5.0, you
2941
 
       will need to give the SUPER privilege to those accounts that
2942
 
       had the TRIGGER privilege in 5.1.
2943
 
 
2944
 
     * Triggers were added in MySQL 5.0, so if you downgrade from 5.0
2945
 
       to 4.1, you cannot use triggers at all.
2946
 
 
2947
 
2.4.2.1. Downgrading to MySQL 5.0
2948
 
 
2949
 
   When downgrading to MySQL 5.0 from MySQL 5.1, you should keep in
2950
 
   mind the following issues relating to features found in MySQL 5.1,
2951
 
   but not in MySQL 5.0:
2952
 
 
2953
 
     * Partitioning.  MySQL 5.0 does not support user-defined
2954
 
       partitioning. If a table was created as a partitioned table in
2955
 
       5.1 (or if an table created in a previous version of MySQL was
2956
 
       altered to include partitions after an upgrade to 5.1), the
2957
 
       table is accessible after downgrade only if you do one of the
2958
 
       following:
2959
 
 
2960
 
          + Export the table using mysqldump and then drop it in
2961
 
            MySQL 5.1; import the table again following the downgrade
2962
 
            to MySQL 5.0.
2963
 
 
2964
 
          + Prior to the downgrade, remove the table's partitioning
2965
 
            using ALTER TABLE table_name REMOVE PARTITIONING.
2966
 
 
2967
 
     * Event Scheduler.  MySQL 5.0 does not support scheduled events.
2968
 
       If your databases contain scheduled event definitions, you
2969
 
       should prevent them from being dumped when you use mysqldump
2970
 
       by using the --skip-events option. (See Section 4.5.4,
2971
 
       "mysqldump --- A Database Backup Program.")
2972
 
 
2973
 
     * Stored routines.  MySQL 5.1.21 added a number of new columns
2974
 
       to the mysql.proc table in which stored routine definitions
2975
 
       are stored. If you are downgrading from MySQL 5.1.21 or later
2976
 
       to MySQL 5.0, you cannot import the MySQL 5.1 routine
2977
 
       definitions into MySQL 5.0.46 or earlier using the dump of
2978
 
       mysql.proc created by mysqldump (such as when using the
2979
 
       --all-databases option). Instead, you should run mysqldump
2980
 
       --routines prior to performing the downgrade and run the
2981
 
       stored routines DDL statements following the downgrade.
2982
 
       See Bug#11986: http://bugs.mysql.com/11986,
2983
 
       Bug#30029: http://bugs.mysql.com/30029, and
2984
 
       Bug#30660: http://bugs.mysql.com/30660, for more information.
2985
 
 
2986
 
     * Triggers.  Trigger creation requires the TRIGGER privilege as
2987
 
       of MySQL 5.1. In MySQL 5.0, there is no TRIGGER privilege and
2988
 
       SUPER is required instead. If you downgrade from MySQL 5.1 to
2989
 
       5.0, you will need to give the SUPER privilege to those
2990
 
       accounts that had the TRIGGER privilege in 5.1.
2991
 
 
2992
 
2.4.3. Checking Whether Tables or Indexes Must Be Rebuilt
2993
 
 
2994
 
   A binary upgrade or downgrade is one that installs one version of
2995
 
   MySQL "in place" over an existing version, without dumping and
2996
 
   reloading tables:
2997
 
 
2998
 
    1. Stop the server for the existing version if it is running.
2999
 
 
3000
 
    2. Install a different version of MySQL. This is an upgrade if
3001
 
       the new version is higher than the original version, a
3002
 
       downgrade if the version is lower.
3003
 
 
3004
 
    3. Start the server for the new version.
3005
 
 
3006
 
   In many cases, the tables from the previous version of MySQL can
3007
 
   be used without problem by the new version. However, sometimes
3008
 
   changes occur that require tables or table indexes to be rebuilt,
3009
 
   as described in this section. If you have tables that are affected
3010
 
   by any of the issues described here, rebuild the tables or indexes
3011
 
   as necessary using the instructions given in Section 2.4.4,
3012
 
   "Rebuilding or Repairing Tables or Indexes."
3013
 
 
3014
 
   Table Incompatibilities
3015
 
 
3016
 
   After a binary upgrade to MySQL 5.1 from a MySQL 5.0 installation
3017
 
   that contains ARCHIVE tables, accessing those tables causes the
3018
 
   server to crash, even if you have run mysql_upgrade or CHECK TABLE
3019
 
   ... FOR UPGRADE. To work around this problem, use mysqldump to
3020
 
   dump all ARCHIVE tables before upgrading, and reload them into
3021
 
   MySQL 5.1 after upgrading. The same problem occurs for binary
3022
 
   downgrades from MySQL 5.1 to 5.0.
3023
 
 
3024
 
   Index Incompatibilities
3025
 
 
3026
 
   If you perform a binary upgrade without dumping and reloading
3027
 
   tables, you cannot upgrade directly from MySQL 4.1 to 5.1 or
3028
 
   higher. This occurs due to an incompatible change in the MyISAM
3029
 
   table index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
3030
 
   repair all MyISAM tables. Then upgrade from MySQL 5.0 to 5.1 and
3031
 
   check and repair your tables.
3032
 
 
3033
 
   Modifications to the handling of character sets or collations
3034
 
   might change the character sort order, which causes the ordering
3035
 
   of entries in any index that uses an affected character set or
3036
 
   collation to be incorrect. Such changes result in several possible
3037
 
   problems:
3038
 
 
3039
 
     * Comparison results that differ from previous results
3040
 
 
3041
 
     * Inability to find some index values due to misordered index
3042
 
       entries
3043
 
 
3044
 
     * Misordered ORDER BY results
3045
 
 
3046
 
     * Tables that CHECK TABLE reports as being in need of repair
3047
 
 
3048
 
   The solution to these problems is to rebuild any indexes that use
3049
 
   an affected character set or collation, either by dropping and
3050
 
   re-creating the indexes, or by dumping and reloading the entire
3051
 
   table. For information about rebuilding indexes, see Section
3052
 
   2.4.4, "Rebuilding or Repairing Tables or Indexes."
3053
 
 
3054
 
   To check whether a table has indexes that must be rebuilt, consult
3055
 
   the following list. It indicates which versions of MySQL
3056
 
   introduced character set or collation changes that require indexes
3057
 
   to be rebuilt. Each entry indicates the version in which the
3058
 
   change occurred and the character sets or collations that the
3059
 
   change affects. If the change is associated with a particular bug
3060
 
   report, the bug number is given.
3061
 
 
3062
 
   The list applies both for binary upgrades and downgrades. For
3063
 
   example, Bug#27877: http://bugs.mysql.com/27877 was fixed in MySQL
3064
 
   5.1.24 and 5.4.0, so it applies to upgrades from versions older
3065
 
   than 5.1.24 to 5.1.24 or newer, and to downgrades from 5.1.24 or
3066
 
   newer to versions older than 5.1.24.
3067
 
 
3068
 
   In many cases, you can use CHECK TABLE ... FOR UPGRADE to identify
3069
 
   tables for which index rebuilding is required. (It will report:
3070
 
   Table upgrade required. Please do "REPAIR TABLE `tbl_name`" or
3071
 
   dump/reload to fix it!) In these cases, you can also use
3072
 
   mysqlcheck --check-upgrade or mysql_upgrade, which execute CHECK
3073
 
   TABLE. However, the use of CHECK TABLE applies only after
3074
 
   upgrades, not downgrades. Also, CHECK TABLE is not applicable to
3075
 
   all storage engines. For details about which storage engines CHECK
3076
 
   TABLE supports, see Section 12.5.2.3, "CHECK TABLE Syntax."
3077
 
 
3078
 
   Changes that cause index rebuilding to be necessary:
3079
 
 
3080
 
     * MySQL 5.0.48, 5.1.21 (Bug#29461: http://bugs.mysql.com/29461)
3081
 
       Affects indexes for columns that use any of these character
3082
 
       sets: eucjpms, euc_kr, gb2312, latin7, macce, ujis
3083
 
       Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
3084
 
       as of MySQL 5.1.29, 5.4.0 (see
3085
 
       Bug#39585: http://bugs.mysql.com/39585).
3086
 
 
3087
 
     * MySQL 5.0.48, 5.1.23 (Bug#27562: http://bugs.mysql.com/27562)
3088
 
       Affects indexes that use the ascii_general_ci collation for
3089
 
       columns that contain any of these characters: '`' GRAVE
3090
 
       ACCENT, '[' LEFT SQUARE BRACKET, '\' REVERSE SOLIDUS, ']'
3091
 
       RIGHT SQUARE BRACKET, '~' TILDE
3092
 
       Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
3093
 
       as of MySQL 5.1.29, 5.4.0 (see
3094
 
       Bug#39585: http://bugs.mysql.com/39585).
3095
 
 
3096
 
     * MySQL 5.1.24, 5.4.0 (Bug#27877: http://bugs.mysql.com/27877)
3097
 
       Affects indexes that use the utf8_general_ci or
3098
 
       ucs2_general_ci collation for columns that contain 'Ɵ' LATIN
3099
 
       SMALL LETTER SHARP S (German).
3100
 
       Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
3101
 
       as of MySQL 5.1.30, 5.4.0 (see
3102
 
       Bug#40053: http://bugs.mysql.com/40053).
3103
 
 
3104
 
2.4.4. Rebuilding or Repairing Tables or Indexes
3105
 
 
3106
 
   This section describes how to rebuild a table. This can be
3107
 
   necessitated by changes to MySQL such as how data types are
3108
 
   handled or changes to character set handling. For example, an
3109
 
   error in a collation might have been corrected, necessitating a
3110
 
   table rebuild to rebuild the indexes for character columns that
3111
 
   use the collation. It might also be that a table repair or upgrade
3112
 
   should be done as indicated by a table check operation such as
3113
 
   that performed by CHECK TABLE, mysqlcheck, or mysql_upgrade.
3114
 
 
3115
 
   Methods for rebuilding a table include dumping and reloading it,
3116
 
   or using ALTER TABLE or REPAIR TABLE.
3117
 
 
3118
 
Note
3119
 
 
3120
 
   If you are rebuilding tables because a different version of MySQL
3121
 
   will not handle them after a binary (in-place) upgrade or
3122
 
   downgrade, you must use the dump-and-reload method. Dump the
3123
 
   tables before upgrading or downgrading (using your original
3124
 
   version of MySQL), and reload the tables after upgrading or
3125
 
   downgrading (after installing the new version).
3126
 
 
3127
 
   If you use the dump-and-reload method of rebuilding tables only
3128
 
   for the purpose of rebuilding indexes, you can perform the dump
3129
 
   either before or after upgrading or downgrading. Reloading still
3130
 
   must be done afterward.
3131
 
 
3132
 
   To re-create a table by dumping and reloading it, use mysqldump to
3133
 
   create a dump file and mysql to reload the file:
3134
 
shell> mysqldump db_name t1 > dump.sql
3135
 
shell> mysql db_name < dump.sql
3136
 
 
3137
 
   To recreate all the tables in a single database, specify the
3138
 
   database name without any following table name:
3139
 
shell> mysqldump db_name > dump.sql
3140
 
shell> mysql db_name < dump.sql
3141
 
 
3142
 
   To recreate all tables in all databases, use the --all-databases
3143
 
   option:
3144
 
shell> mysqldump --all-databases > dump.sql
3145
 
shell> mysql < dump.sql
3146
 
 
3147
 
   To rebuild a table with ALTER TABLE, use a "null" alteration; that
3148
 
   is, an ALTER TABLE statement that "changes" the table to use the
3149
 
   storage engine that it already has. For example, if t1 is a MyISAM
3150
 
   table, use this statement:
3151
 
mysql> ALTER TABLE t1 ENGINE = MyISAM;
3152
 
 
3153
 
   If you are not sure which storage engine to specify in the ALTER
3154
 
   TABLE statement, use SHOW CREATE TABLE to display the table
3155
 
   definition.
3156
 
 
3157
 
   If you must rebuild a table because a table checking operation
3158
 
   indicates that the table is corrupt or needs an upgrade, you can
3159
 
   use REPAIR TABLE if that statement supports the table's storage
3160
 
   engine. For example, to repair a MyISAM table, use this statement:
3161
 
mysql> REPAIR TABLE t1;
3162
 
 
3163
 
   For storage engines such as InnoDB that REPAIR TABLE does not
3164
 
   support, use mysqldump to create a dump file and mysql to reload
3165
 
   the file, as described earlier.
3166
 
 
3167
 
   For specifics about which storage engines REPAIR TABLE supports,
3168
 
   see Section 12.5.2.6, "REPAIR TABLE Syntax."
3169
 
 
3170
 
   mysqlcheck --repair provides command-line access to the REPAIR
3171
 
   TABLE statement. This can be a more convenient means of repairing
3172
 
   tables because you can use the --databases or --all-databases
3173
 
   option to repair all tables in specific databases or all
3174
 
   databases, respectively:
3175
 
shell> mysqlcheck --repair --databases db_name ...
3176
 
shell> mysqlcheck --repair --all-databases
3177
 
 
3178
 
2.4.5. Copying MySQL Databases to Another Machine
3179
 
 
3180
 
   You can copy the .frm, .MYI, and .MYD files for MyISAM tables
3181
 
   between different architectures that support the same
3182
 
   floating-point format. (MySQL takes care of any byte-swapping
3183
 
   issues.) See Section 13.5, "The MyISAM Storage Engine."
3184
 
 
3185
 
   In cases where you need to transfer databases between different
3186
 
   architectures, you can use mysqldump to create a file containing
3187
 
   SQL statements. You can then transfer the file to the other
3188
 
   machine and feed it as input to the mysql client.
3189
 
 
3190
 
   Use mysqldump --help to see what options are available.
3191
 
 
3192
 
   The easiest (although not the fastest) way to move a database
3193
 
   between two machines is to run the following commands on the
3194
 
   machine on which the database is located:
3195
 
shell> mysqladmin -h 'other_hostname' create db_name
3196
 
shell> mysqldump db_name | mysql -h 'other_hostname' db_name
3197
 
 
3198
 
   If you want to copy a database from a remote machine over a slow
3199
 
   network, you can use these commands:
3200
 
shell> mysqladmin create db_name
3201
 
shell> mysqldump -h 'other_hostname' --compress db_name | mysql db_na
3202
 
me
3203
 
 
3204
 
   You can also store the dump in a file, transfer the file to the
3205
 
   target machine, and then load the file into the database there.
3206
 
   For example, you can dump a database to a compressed file on the
3207
 
   source machine like this:
3208
 
shell> mysqldump --quick db_name | gzip > db_name.gz
3209
 
 
3210
 
   Transfer the file containing the database contents to the target
3211
 
   machine and run these commands there:
3212
 
shell> mysqladmin create db_name
3213
 
shell> gunzip < db_name.gz | mysql db_name
3214
 
 
3215
 
   You can also use mysqldump and mysqlimport to transfer the
3216
 
   database. For large tables, this is much faster than simply using
3217
 
   mysqldump. In the following commands, DUMPDIR represents the full
3218
 
   path name of the directory you use to store the output from
3219
 
   mysqldump.
3220
 
 
3221
 
   First, create the directory for the output files and dump the
3222
 
   database:
3223
 
shell> mkdir DUMPDIR
3224
 
shell> mysqldump --tab=DUMPDIR db_name
3225
 
 
3226
 
   Then transfer the files in the DUMPDIR directory to some
3227
 
   corresponding directory on the target machine and load the files
3228
 
   into MySQL there:
3229
 
shell> mysqladmin create db_name           # create database
3230
 
shell> cat DUMPDIR/*.sql | mysql db_name   # create tables in databas
3231
 
e
3232
 
shell> mysqlimport db_name DUMPDIR/*.txt   # load data into tables
3233
 
 
3234
 
   Do not forget to copy the mysql database because that is where the
3235
 
   grant tables are stored. You might have to run commands as the
3236
 
   MySQL root user on the new machine until you have the mysql
3237
 
   database in place.
3238
 
 
3239
 
   After you import the mysql database on the new machine, execute
3240
 
   mysqladmin flush-privileges so that the server reloads the grant
3241
 
   table information.
3242
 
 
3243
 
2.5. Installing MySQL on Windows
3244
 
 
3245
 
   This section describes the process for installing MySQL on
3246
 
   Windows.
3247
 
 
3248
 
   To run MySQL on Windows, you need the following:
3249
 
 
3250
 
     * A Windows operating system such as Windows 2000, Windows XP,
3251
 
       Windows Vista, Windows Server 2003, or Windows Server 2008.
3252
 
       Both 32-bit and 64-bit versions are supported.
3253
 
       In addition to running MySQL as a standard application, you
3254
 
       can also run the MySQL server as a Windows service. By using a
3255
 
       service you can monitor and control the operation of the
3256
 
       server through the standard Windows service management tools.
3257
 
       For more information, see Section 2.5.5.6, "Starting MySQL as
3258
 
       a Windows Service."
3259
 
       Generally, you should install MySQL on Windows using an
3260
 
       account that has administrator rights. Otherwise, you may
3261
 
       encounter problems with certain operations such as editing the
3262
 
       PATH environment variable or accessing the Service Control
3263
 
       Manager. Once installed, MySQL does not need to be executed
3264
 
       using a user with Administrator privileges.
3265
 
 
3266
 
     * TCP/IP protocol support.
3267
 
 
3268
 
     * Enough space on the hard drive to unpack, install, and create
3269
 
       the databases in accordance with your requirements (generally
3270
 
       a minimum of 200 megabytes is recommended.)
 
755
   MySQL compressed tar file binary distributions have names of the
 
756
   form mysql-VERSION-OS.tar.gz, where VERSION is a number (for
 
757
   example, 5.1.62), and OS indicates the type of operating system
 
758
   for which the distribution is intended (for example, pc-linux-i686
 
759
   or winx64).
 
760
 
 
761
   To install MySQL from a compressed tar file binary distribution,
 
762
   your system must have GNU gunzip to uncompress the distribution
 
763
   and a reasonable tar to unpack it. If your tar program supports
 
764
   the z option, it can both uncompress and unpack the file.
 
765
 
 
766
   GNU tar is known to work. The standard tar provided with some
 
767
   operating systems is not able to unpack the long file names in the
 
768
   MySQL distribution. You should download and install GNU tar, or if
 
769
   available, use a preinstalled version of GNU tar. Usually this is
 
770
   available as gnutar, gtar, or as tar within a GNU or Free Software
 
771
   directory, such as /usr/sfw/bin or /usr/local/bin. GNU tar is
 
772
   available from http://www.gnu.org/software/tar/.
 
773
   Warning
 
774
 
 
775
   If you have previously installed MySQL using your operating system
 
776
   native package management system, such as yum or apt-get, you may
 
777
   experience problems installing using a native binary. Make sure
 
778
   your previous MySQL previous installation has been removed
 
779
   entirely (using your package management system), and that any
 
780
   additional files, such as old versions of your data files, have
 
781
   also been removed. You should also check the existence of
 
782
   configuration files such as /etc/my.cnf or the /etc/mysql
 
783
   directory have been deleted.
 
784
 
 
785
   If you run into problems and need to file a bug report, please use
 
786
   the instructions in Section 1.7, "How to Report Bugs or Problems."
 
787
 
 
788
   On Unix, to install a compressed tar file binary distribution,
 
789
   unpack it at the installation location you choose (typically
 
790
   /usr/local/mysql). This creates the directories shown in the
 
791
   following table.
 
792
 
 
793
   Table 2.2. MySQL Installation Layout for Generic Unix/Linux Binary
 
794
   Package
 
795
   Directory Contents of Directory
 
796
   bin Client programs and the mysqld server
 
797
   data Log files, databases
 
798
   docs Manual in Info format
 
799
   man Unix manual pages
 
800
   include Include (header) files
 
801
   lib Libraries
 
802
   scripts mysql_install_db
 
803
   share Miscellaneous support files, including error messages,
 
804
   sample configuration files, SQL for database installation
 
805
   sql-bench Benchmarks
 
806
 
 
807
   Debug versions of the mysqld binary are available as mysqld-debug.
 
808
   To compile your own debug version of MySQL from a source
 
809
   distribution, use the appropriate configuration options to enable
 
810
   debugging support. For more information on compiling from source,
 
811
   see Section 2.11, "Installing MySQL from Source."
 
812
 
 
813
   To install and use a MySQL binary distribution, the basic command
 
814
   sequence looks like this:
 
815
shell> groupadd mysql
 
816
shell> useradd -r -g mysql mysql
 
817
shell> cd /usr/local
 
818
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
 
819
shell> ln -s full-path-to-mysql-VERSION-OS mysql
 
820
shell> cd mysql
 
821
shell> chown -R mysql .
 
822
shell> chgrp -R mysql .
 
823
shell> scripts/mysql_install_db --user=mysql
 
824
shell> chown -R root .
 
825
shell> chown -R mysql data
 
826
# Next command is optional
 
827
shell> cp support-files/my-medium.cnf /etc/my.cnf
 
828
shell> bin/mysqld_safe --user=mysql &
 
829
# Next command is optional
 
830
shell> cp support-files/mysql.server /etc/init.d/mysql.server
 
831
 
 
832
   A more detailed version of the preceding description for
 
833
   installing a binary distribution follows.
 
834
   Note
 
835
 
 
836
   This procedure assumes that you have root (administrator) access
 
837
   to your system. Alternatively, you can prefix each command using
 
838
   the sudo (Linux) or pfexec (OpenSolaris) command.
 
839
 
 
840
   The procedure does not set up any passwords for MySQL accounts.
 
841
   After following the procedure, proceed to Section 2.12,
 
842
   "Postinstallation Setup and Testing."
 
843
 
 
844
Create a mysql User and Group
 
845
 
 
846
   If your system does not already have a user and group for mysqld
 
847
   to run as, you may need to create one. The following commands add
 
848
   the mysql group and the mysql user. You might want to call the
 
849
   user and group something else instead of mysql. If so, substitute
 
850
   the appropriate name in the following instructions. The syntax for
 
851
   useradd and groupadd may differ slightly on different versions of
 
852
   Unix, or they may have different names such as adduser and
 
853
   addgroup.
 
854
shell> groupadd mysql
 
855
shell> useradd -r -g mysql mysql
 
856
 
 
857
   Note
 
858
 
 
859
   Because the user is required only for ownership purposes, not
 
860
   login purposes, the useradd command uses the -r option to create a
 
861
   user that does not have login permissions to your server host.
 
862
   Omit this option to permit logins for the user (or if your useradd
 
863
   does not support the option).
 
864
 
 
865
Obtain and Unpack the Distribution
 
866
 
 
867
   Pick the directory under which you want to unpack the distribution
 
868
   and change location into it. The example here unpacks the
 
869
   distribution under /usr/local. The instructions, therefore, assume
 
870
   that you have permission to create files and directories in
 
871
   /usr/local. If that directory is protected, you must perform the
 
872
   installation as root.
 
873
shell> cd /usr/local
 
874
 
 
875
   Obtain a distribution file using the instructions in Section
 
876
   2.1.3, "How to Get MySQL." For a given release, binary
 
877
   distributions for all platforms are built from the same MySQL
 
878
   source distribution.
 
879
 
 
880
   Unpack the distribution, which creates the installation directory.
 
881
   Then create a symbolic link to that directory. tar can uncompress
 
882
   and unpack the distribution if it has z option support:
 
883
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
 
884
shell> ln -s full-path-to-mysql-VERSION-OS mysql
 
885
 
 
886
   The tar command creates a directory named mysql-VERSION-OS. The ln
 
887
   command makes a symbolic link to that directory. This enables you
 
888
   to refer more easily to the installation directory as
 
889
   /usr/local/mysql.
 
890
 
 
891
   If your tar does not have z option support, use gunzip to unpack
 
892
   the distribution and tar to unpack it. Replace the preceding tar
 
893
   command with the following alternative command to uncompress and
 
894
   extract the distribution:
 
895
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
 
896
 
 
897
Perform Postinstallation Setup
 
898
 
 
899
   The remainder of the installation process involves setting up the
 
900
   configuration file, creating the core databases, and starting the
 
901
   MySQL server. For instructions, see Section 2.12,
 
902
   "Postinstallation Setup and Testing."
 
903
   Note
 
904
 
 
905
   The accounts that are listed in the MySQL grant tables initially
 
906
   have no passwords. After starting the server, you should set up
 
907
   passwords for them using the instructions in Section 2.12,
 
908
   "Postinstallation Setup and Testing."
 
909
 
 
910
2.3. Installing MySQL on Microsoft Windows
 
911
 
 
912
   MySQL for Microsoft Windows is available in a number of different
 
913
   forms. A Microsoft Windows operating system such as Windows 2000,
 
914
   Windows XP, Windows Vista, Windows 7, Windows Server 2003, or
 
915
   Windows Server 2008. Both 32-bit and 64-bit versions are
 
916
   supported.
 
917
 
 
918
   In addition to running MySQL as a standard application, you can
 
919
   also run the MySQL server as a Windows service. By using a service
 
920
   you can monitor and control the operation of the server through
 
921
   the standard Windows service management tools. For more
 
922
   information, see Section 2.3.5.7, "Starting MySQL Server as a
 
923
   Microsoft Windows Service."
 
924
 
 
925
   Generally, you should install MySQL on Windows using an account
 
926
   that has administrator rights. Otherwise, you may encounter
 
927
   problems with certain operations such as editing the PATH
 
928
   environment variable or accessing the Service Control Manager.
 
929
   Once installed, MySQL does not need to be executed using a user
 
930
   with Administrator privileges.
3271
931
 
3272
932
   For a list of limitations within the Windows version of MySQL, see
3273
 
   Section D.7.3, "Windows Platform Limitations."
 
933
   Section E.7.5, "Windows Platform Limitations."
3274
934
 
3275
935
   In addition to the MySQL Server package, you may need or want
3276
936
   additional components to use MySQL with your application or
3277
937
   development environment. These include, but are not limited to:
3278
938
 
3279
 
     * If you plan to connect to the MySQL server via ODBC, you need
3280
 
       a Connector/ODBC driver. For more information, including
3281
 
       installation and configuration instructions, see Section 21.1,
 
939
     * If you plan to connect to the MySQL server using ODBC, you
 
940
       need a Connector/ODBC driver. For more information, including
 
941
       installation and configuration instructions, see Section 20.1,
3282
942
       "MySQL Connector/ODBC."
3283
943
 
3284
944
     * If you plan to use MySQL server with .NET applications, you
3285
 
       need the Connector/NET driver. For more information, including
3286
 
       installation and configuration instructions, see Section 21.2,
3287
 
       "MySQL Connector/NET."
 
945
       need the Connector/Net driver. For more information, including
 
946
       installation and configuration instructions, see Section 20.2,
 
947
       "MySQL Connector/Net."
3288
948
 
3289
949
   MySQL distributions for Windows can be downloaded from
3290
950
   http://dev.mysql.com/downloads/. See Section 2.1.3, "How to Get
3307
967
       MySQL, but no additional components, and a complete package
3308
968
       that includes MySQL, configuration tools, benchmarks and other
3309
969
       components. For more information on the specific differences,
3310
 
       see Section 2.5.2, "Choosing An Installation Package"
 
970
       see Section 2.3.2, "Choosing the Installation Package for
 
971
       Microsoft Windows"
3311
972
       For instructions on installing MySQL using one of the MSI
3312
 
       installation packages, see Section 2.5.3, "Installing MySQL
3313
 
       with the MSI Package."
 
973
       installation packages, see Section 2.3.3, "Installing MySQL on
 
974
       Microsoft Windows Using an MSI Package."
3314
975
 
3315
976
     * Standard binary distribution format packaged as a Zip file
3316
977
       containing all of the necessary files that you unpack into
3318
979
       in the full Windows MSI Installer package, but does not
3319
980
       including an installation program.
3320
981
       For instructions on installing MySQL using the Zip file, see
3321
 
       Section 2.5.5, "Installing MySQL from a noinstall Zip
3322
 
       Archive."
 
982
       Section 2.3.5, "Installing MySQL on Microsoft Windows Using a
 
983
       noinstall Zip Archive."
3323
984
 
3324
985
     * The source distribution contains all the code and support
3325
986
       files for building the executables using the Visual Studio
3326
987
       compiler system.
3327
988
       For instructions on building MySQL from source on Windows, see
3328
 
       Section 2.5.10, "Installing MySQL from Source on Windows."
 
989
       Section 2.11.7, "Installing MySQL from Source on Windows."
3329
990
 
3330
991
   MySQL on Windows considerations:
3331
992
 
3332
993
     * Large Table Support
3333
994
       If you need tables with a size larger than 4GB, install MySQL
3334
 
       on an NTFS or newer file system. Don't forget to use MAX_ROWS
 
995
       on an NTFS or newer file system. Do not forget to use MAX_ROWS
3335
996
       and AVG_ROW_LENGTH when you create tables. See Section
3336
997
       12.1.17, "CREATE TABLE Syntax."
3337
998
 
3347
1008
       After installing MySQL Server, it is recommended that you
3348
1009
       disable virus scanning on the main directory (datadir) being
3349
1010
       used to store your MySQL table data. There is usually a system
3350
 
       built into the virus scanning software to allow certain
 
1011
       built into the virus scanning software to permit certain
3351
1012
       directories to be specifically ignored during virus scanning.
3352
1013
       In addition, by default, MySQL creates temporary files in the
3353
1014
       standard Windows temporary directory. To prevent the temporary
3355
1016
       temporary directory for MySQL temporary files and add this to
3356
1017
       the virus scanning exclusion list. To do this, add a
3357
1018
       configuration option for the tmpdir parameter to your my.ini
3358
 
       configuration file. For more information, see Section 2.5.5.2,
 
1019
       configuration file. For more information, see Section 2.3.5.2,
3359
1020
       "Creating an Option File."
3360
1021
 
3361
 
2.5.1. Windows Installation Layout
 
1022
2.3.1. MySQL Installation Layout on Microsoft Windows
3362
1023
 
3363
1024
   For MySQL 5.1 on Windows, the default installation directory is
3364
1025
   C:\Program Files\MySQL\MySQL Server 5.1. Some Windows users prefer
3367
1028
   same.
3368
1029
 
3369
1030
   For MySQL 5.1.23 and earlier, all of the files are located within
3370
 
   this parent directory, using the following structure:
 
1031
   the parent directory, using the structure shown in the following
 
1032
   table.
3371
1033
 
3372
 
   Table 2.2. Installation Layout for Windows using MySQL 5.1.23 and
3373
 
   earlier
3374
 
   Directory         Contents of Directory
3375
 
   bin       Client programs and the mysqld server
3376
 
   data      Log files, databases
3377
 
   Docs      Manual in CHM format
3378
 
   examples  Example programs and scripts
3379
 
   include   Include (header) files
3380
 
   lib       Libraries
3381
 
   scripts   Utility scripts
3382
 
   share     Error message files
 
1034
   Table 2.3. Installation Layout for Windows Using MySQL 5.1.23 and
 
1035
   Earlier
 
1036
   Directory Contents of Directory
 
1037
   bin Client programs and the mysqld server
 
1038
   data Log files, databases
 
1039
   examples Example programs and scripts
 
1040
   include Include (header) files
 
1041
   lib Libraries
 
1042
   scripts Utility scripts
 
1043
   share Miscellaneous support files, including error messages,
 
1044
   character set files, sample configuration files, SQL for database
 
1045
   installation
3383
1046
 
3384
1047
   For MySQL 5.1.24 and later, the default location of data directory
3385
1048
   was changed. The remainder of the directory structure remains the
3386
 
   same:
 
1049
   same.
3387
1050
 
3388
 
   Table 2.3. Installation Layout for Windows using MySQL 5.1.24 and
 
1051
   Table 2.4. Installation Layout for Windows Using MySQL 5.1.24 and
3389
1052
   later
3390
1053
   Directory Contents of Directory
3391
1054
   bin Client programs and the mysqld server
3392
1055
   C:\Documents and Settings\All Users\Application Data\MySQL Log
3393
 
   files, databases
 
1056
   files, databases (Windows XP, Windows Server 2003)
 
1057
   C:\ProgramData\MySQL Log files, databases (Windows 7, Windows
 
1058
   Server 2008)
3394
1059
   Docs Manual in CHM format
3395
1060
   examples Example programs and scripts
3396
1061
   include Include (header) files
3397
1062
   lib Libraries
3398
1063
   scripts Utility scripts
3399
 
   share Error message files
3400
 
 
3401
 
2.5.2. Choosing An Installation Package
3402
 
 
3403
 
   For MySQL 5.1, there are three installation packages to choose
3404
 
   from when installing MySQL on Windows:
 
1064
   share Miscellaneous support files, including error messages,
 
1065
   character set files, sample configuration files, SQL for database
 
1066
   installation
 
1067
 
 
1068
2.3.2. Choosing the Installation Package for Microsoft Windows
 
1069
 
 
1070
   For MySQL 5.1, there are three installation package formats to
 
1071
   choose from when installing MySQL on Windows:
 
1072
 
 
1073
   Table 2.5. Microsoft Windows MySQL Installation package comparison
3405
1074
     Packaging
3406
1075
   Feature Essentials Complete Zip (No-install)
3407
1076
   Installer Yes Yes No
3435
1104
 
3436
1105
   Figure 2.2. Installation Workflow for Windows using Zip
3437
1106
   Installation Workflow for Windows using Zip
3438
 
 
3439
 
Note
 
1107
   Note
3440
1108
 
3441
1109
   For the Essentials and Complete packages in the MSI installer, you
3442
1110
   can select individual components to be installed by using the
3446
1114
   Full details on the components are suggested uses are provided
3447
1115
   below for reference:
3448
1116
 
3449
 
     * Windows Essentials --- this package has a file name similar to
3450
 
       mysql-essential-5.1.41-win32.msi and is supplied as a
 
1117
     * Windows Essentials: This package has a file name similar to
 
1118
       mysql-essential-5.1.62-win32.msi and is supplied as a
3451
1119
       Microsoft Installer (MSI) package. The package includes the
3452
1120
       minimum set of files needed to install MySQL on Windows,
3453
1121
       including the MySQL Server Instance Config Wizard. This
3454
1122
       package does not include optional components such as the
3455
1123
       embedded server, developer headers and libraries or benchmark
3456
1124
       suite.
3457
 
       To install using this package, see Section 2.5.3, "Installing
3458
 
       MySQL with the MSI Package."
 
1125
       To install using this package, see Section 2.3.3, "Installing
 
1126
       MySQL on Microsoft Windows Using an MSI Package."
3459
1127
 
3460
 
     * Windows MSI Installer (Complete) --- this package has a file
3461
 
       name similar to mysql-5.1.41-win32.zip and contains all files
 
1128
     * Windows MSI Installer (Complete): This package has a file name
 
1129
       similar to mysql-5.1.62-win32.msi and contains all files
3462
1130
       needed for a complete Windows installation, including the
3463
1131
       MySQL Server Instance Config Wizard. This package includes
3464
1132
       optional components such as the embedded server and benchmark
3465
1133
       suite.
3466
 
       To install using this package, see Section 2.5.3, "Installing
3467
 
       MySQL with the MSI Package."
 
1134
       To install using this package, see Section 2.3.3, "Installing
 
1135
       MySQL on Microsoft Windows Using an MSI Package."
3468
1136
 
3469
 
     * Without installer --- this package has a file name similar to
3470
 
       mysql-noinstall-5.1.41-win32.zip and contains all the files
 
1137
     * Without installer: This package has a file name similar to
 
1138
       mysql-noinstall-5.1.62-win32.zip and contains all the files
3471
1139
       found in the Complete install package, with the exception of
3472
1140
       the MySQL Server Instance Config Wizard. This package does not
3473
1141
       include an automated installer, and must be manually installed
3476
1144
   The Essentials package is recommended for most users. Both the
3477
1145
   Essentials and Complete distributions are available as an .msi
3478
1146
   file for use with the Windows Installer. The Noinstall
3479
 
   distribution is packaged as Zip archives. To use Zip archives, you
3480
 
   must have a tool that can unpack .zip files.
 
1147
   distribution is packaged as a Zip archive. To use a Zip archive,
 
1148
   you must have a tool that can unpack .zip files.
3481
1149
 
3482
1150
   When using the MSI installers you can automate the installation
3483
 
   process. For more information, see Section 2.5.3.2, "Installing
3484
 
   MySQL Automatically using MSI." To automate the creation of a
3485
 
   MySQL instance, see Section 2.5.4.13, "Creating an Instance from
 
1151
   process. For more information, see Section 2.3.3.2, "Automating
 
1152
   MySQL Installation on Microsoft Windows using the MSI Package." To
 
1153
   automate the creation of a MySQL instance, see Section 2.3.4.13,
 
1154
   "MySQL Server Instance Config Wizard: Creating an Instance from
3486
1155
   the Command Line."
3487
1156
 
3488
1157
   Your choice of install package affects the installation process
3489
 
   you must follow. If you choose to install either the Essentials or
3490
 
   Complete install packages, see Section 2.5.3, "Installing MySQL
3491
 
   with the MSI Package." If you choose to install MySQL from the
3492
 
   Noinstall archive, see Section 2.5.5, "Installing MySQL from a
3493
 
   noinstall Zip Archive."
3494
 
 
3495
 
2.5.3. Installing MySQL with the MSI Package
3496
 
 
3497
 
   The MSI package are designed to install and configure MySQL in
3498
 
   such a way that you can immediately get started using MySQL.
3499
 
 
3500
 
   The MySQL Installation Wizard and MySQL Config Wizard are
 
1158
   you must follow. If you choose to install either an Essentials or
 
1159
   Complete install package, see Section 2.3.3, "Installing MySQL on
 
1160
   Microsoft Windows Using an MSI Package." If you choose to install
 
1161
   a Noinstall archive, see Section 2.3.5, "Installing MySQL on
 
1162
   Microsoft Windows Using a noinstall Zip Archive."
 
1163
 
 
1164
2.3.3. Installing MySQL on Microsoft Windows Using an MSI Package
 
1165
 
 
1166
   The MSI package is designed to install and configure MySQL in such
 
1167
   a way that you can immediately get started using MySQL.
 
1168
 
 
1169
   The MySQL Installation Wizard and MySQL Configuration Wizard are
3501
1170
   available in the Essentials and Complete install packages. They
3502
1171
   are recommended for most standard MySQL installations. Exceptions
3503
1172
   include users who need to install multiple instances of MySQL on a
3505
1174
   server configuration.
3506
1175
 
3507
1176
     * For information on installing using the GUI MSI installer
3508
 
       process, see Section 2.5.3, "Installing MySQL with the MSI
3509
 
       Package."
 
1177
       process, see Section 2.3.3.1, "Using the MySQL Installation
 
1178
       Wizard for Microsoft Windows."
3510
1179
 
3511
1180
     * For information on installing using the command line using the
3512
 
       MSI package, see Section 2.5.3.2, "Installing MySQL
3513
 
       Automatically using MSI."
 
1181
       MSI package, see Section 2.3.3.2, "Automating MySQL
 
1182
       Installation on Microsoft Windows using the MSI Package."
3514
1183
 
3515
1184
     * If you have previously installed MySQL using the MSI package
3516
 
       and want to remove MySQL, see Section 2.5.3.3, "Removing MySQL
3517
 
       Installed from the MSI Package."
 
1185
       and want to remove MySQL, see Section 2.3.3.3, "Removing MySQL
 
1186
       When Installed from the MSI Package."
3518
1187
 
3519
1188
   The workflow sequence for using the installer is shown in the
3520
1189
   figure below:
3521
1190
 
3522
1191
   Figure 2.3. Installation Workflow for Windows using MSI Installer
3523
1192
   Installation Workflow for Windows using MSI Installer
3524
 
 
3525
 
Note
 
1193
   Note
3526
1194
 
3527
1195
   Microsoft Windows XP and later include a firewall which
3528
1196
   specifically blocks ports. If you plan on using MySQL through a
3550
1218
    7. Confirm your choices by clicking the OK button.
3551
1219
 
3552
1220
   Additionally, when running the MySQL Installation Wizard on
3553
 
   Windows Vista, ensure that you are logged in as a user with
3554
 
   administrative rights.
3555
 
 
3556
 
Note
3557
 
 
3558
 
   When using Windows Vista, you may want to disable User Account
3559
 
   Control (UAC) before performing the installation. If you do not do
3560
 
   so, then MySQL may be identified as a security risk, which will
3561
 
   mean that you need to enable MySQL. You can disable the security
3562
 
   checking by following these instructions:
 
1221
   Windows Vista or newer, ensure that you are logged in as a user
 
1222
   with administrative rights.
 
1223
   Note
 
1224
 
 
1225
   When using Windows Vista or newer, you may want to disable User
 
1226
   Account Control (UAC) before performing the installation. If you
 
1227
   do not do so, then MySQL may be identified as a security risk,
 
1228
   which will mean that you need to enable MySQL. You can disable the
 
1229
   security checking by following these instructions:
3563
1230
 
3564
1231
    1. Open Control Panel.
3565
1232
 
3566
1233
    2. Under the User Accounts and Family Safety, select Add or
3567
1234
       remove user accounts.
3568
1235
 
3569
 
    3. Click on the Got to the main User Accounts page link.
 
1236
    3. Click the Got to the main User Accounts page link.
3570
1237
 
3571
1238
    4. Click on Turn User Account Control on or off. You may be
3572
1239
       prompted to provide permission to change this setting. Click
3573
1240
       Continue.
3574
1241
 
3575
 
    5. Deselect or unceck the checkbox next to Use User Account
 
1242
    5. Deselect or uncheck the check box next to Use User Account
3576
1243
       Control (UAC) to help protect your computer. Click OK to save
3577
1244
       the setting.
3578
1245
 
3580
1247
   Now to reboot the machine and apply the changes. You can then
3581
1248
   follow the instructions below for installing Windows.
3582
1249
 
3583
 
2.5.3.1. Using the MySQL Installation Wizard
 
1250
2.3.3.1. Using the MySQL Installation Wizard for Microsoft Windows
3584
1251
 
3585
1252
   MySQL Installation Wizard is an installer for the MySQL server
3586
1253
   that uses the latest installer technologies for Microsoft Windows.
3587
1254
   The MySQL Installation Wizard, in combination with the MySQL
3588
 
   Config Wizard, allows a user to install and configure a MySQL
 
1255
   Config Wizard, enables a user to install and configure a MySQL
3589
1256
   server that is ready for use immediately after installation.
3590
1257
 
3591
1258
   The MySQL Installation Wizard uses the standard Microsoft
3592
1259
   Installer Engine (MSI) system is the standard installer for all
3593
 
   MySQL server distributions, version 4.1.5 and higher. Users of
3594
 
   previous versions of MySQL need to shut down and remove their
3595
 
   existing MySQL installations manually before installing MySQL with
3596
 
   the MySQL Installation Wizard. See Section 2.5.3.1.6, "Upgrading
3597
 
   MySQL with the Installation Wizard," for more information on
 
1260
   MySQL server distributions. See Section 2.3.3.1.6, "MySQL
 
1261
   Installation Wizard: Upgrading MySQL," for more information on
3598
1262
   upgrading from a previous version.
3599
1263
 
3600
1264
   If you are upgrading an installation from MySQL 5.1.31 or earlier
3601
1265
   to MySQL 5.1.32 or later, read the notes provided in Section
3602
 
   2.5.3.1.6, "Upgrading MySQL with the Installation Wizard."
 
1266
   2.3.3.1.6, "MySQL Installation Wizard: Upgrading MySQL."
3603
1267
 
3604
1268
   The Microsoft Windows Installer Engine was updated with the
3605
1269
   release of Windows XP; those using a previous version of Windows
3611
1275
   In addition, Microsoft has introduced the WiX (Windows Installer
3612
1276
   XML) toolkit. This is the first highly acknowledged Open Source
3613
1277
   project from Microsoft. We have switched to WiX because it is an
3614
 
   Open Source project and it allows us to handle the complete
 
1278
   Open Source project and it enables us to handle the complete
3615
1279
   Windows installation process in a flexible manner using scripts.
3616
1280
 
3617
1281
   Improving the MySQL Installation Wizard depends on the support and
3618
1282
   feedback of users like you. If you find that the MySQL
3619
1283
   Installation Wizard is lacking some feature important to you, or
3620
1284
   if you discover a bug, please report it in our bugs database using
3621
 
   the instructions given in Section 1.6, "How to Report Bugs or
 
1285
   the instructions given in Section 1.7, "How to Report Bugs or
3622
1286
   Problems."
3623
1287
 
3624
 
2.5.3.1.1. Downloading and Starting the MySQL Installation Wizard
 
1288
2.3.3.1.1. MySQL Installation Wizard: Downloading and Starting
3625
1289
 
3626
1290
   The MySQL installation packages can be downloaded from
3627
1291
   http://dev.mysql.com/downloads/. If the package you download is
3634
1298
   there is an .msi file present, double-click it to start the
3635
1299
   installation process.
3636
1300
 
3637
 
2.5.3.1.2. Choosing an Install Type
 
1301
2.3.3.1.2. MySQL Installation Wizard: Choosing an Install Type
3638
1302
 
3639
1303
   There are three installation types available: Typical, Complete,
3640
1304
   and Custom.
3651
1315
 
3652
1316
   The Custom installation type gives you complete control over which
3653
1317
   packages you wish to install and the installation path that is
3654
 
   used. See Section 2.5.3.1.3, "The Custom Install Dialog," for more
3655
 
   information on performing a custom install.
 
1318
   used. See Section 2.3.3.1.3, "MySQL Installation Wizard: The
 
1319
   Custom Install Dialog," for more information on performing a
 
1320
   custom install.
3656
1321
 
3657
1322
   If you choose the Typical or Complete installation types and click
3658
1323
   the Next button, you advance to the confirmation screen to verify
3659
1324
   your choices and begin the installation. If you choose the Custom
3660
1325
   installation type and click the Next button, you advance to the
3661
 
   custom installation dialog, described in Section 2.5.3.1.3, "The
3662
 
   Custom Install Dialog."
 
1326
   custom installation dialog, described in Section 2.3.3.1.3, "MySQL
 
1327
   Installation Wizard: The Custom Install Dialog."
3663
1328
 
3664
 
2.5.3.1.3. The Custom Install Dialog
 
1329
2.3.3.1.3. MySQL Installation Wizard: The Custom Install Dialog
3665
1330
 
3666
1331
   If you wish to change the installation path or the specific
3667
1332
   components that are installed by the MySQL Installation Wizard,
3670
1335
   A tree view on the left side of the custom install dialog lists
3671
1336
   all available components. Components that are not installed have a
3672
1337
   red X icon; components that are installed have a gray icon. To
3673
 
   change whether a component is installed, click on that component's
 
1338
   change whether a component is installed, click that component's
3674
1339
   icon and choose a new option from the drop-down list that appears.
3675
1340
 
3676
1341
   You can change the default installation path by clicking the
3679
1344
   After choosing your installation components and installation path,
3680
1345
   click the Next button to advance to the confirmation dialog.
3681
1346
 
3682
 
2.5.3.1.4. The Confirmation Dialog
 
1347
2.3.3.1.4. MySQL Installation Wizard: The Confirmation Dialog
3683
1348
 
3684
1349
   Once you choose an installation type and optionally choose your
3685
1350
   installation components, you advance to the confirmation dialog.
3691
1356
   button. To exit the MySQL Installation Wizard without installing
3692
1357
   MySQL, click the Cancel button.
3693
1358
 
3694
 
   After installation is complete, you have the option of registering
3695
 
   with the MySQL web site. Registration gives you access to post in
3696
 
   the MySQL forums at forums.mysql.com (http://forums.mysql.com),
3697
 
   along with the ability to report bugs at bugs.mysql.com
3698
 
   (http://bugs.mysql.com) and to subscribe to our newsletter. The
3699
 
   final screen of the installer provides a summary of the
 
1359
   In MySQL 5.1.47 and earlier, after installation is complete, you
 
1360
   have the option of registering with the MySQL web site.
 
1361
   Registration gives you access to post in the MySQL forums at
 
1362
   forums.mysql.com (http://forums.mysql.com), along with the ability
 
1363
   to report bugs at bugs.mysql.com (http://bugs.mysql.com) and to
 
1364
   subscribe to our newsletter.
 
1365
 
 
1366
   The final screen of the installer provides a summary of the
3700
1367
   installation and gives you the option to launch the MySQL Config
3701
1368
   Wizard, which you can use to create a configuration file, install
3702
1369
   the MySQL service, and configure security settings.
3703
1370
 
3704
 
2.5.3.1.5. Changes Made by MySQL Installation Wizard
 
1371
2.3.3.1.5. MySQL Installation Wizard: Changes Made
3705
1372
 
3706
1373
   Once you click the Install button, the MySQL Installation Wizard
3707
1374
   begins the installation process and makes certain changes to your
3711
1378
 
3712
1379
   The MySQL Installation Wizard creates one Windows registry key in
3713
1380
   a typical install situation, located in
3714
 
   HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB.
 
1381
   HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB. For 64-bit Windows, the
 
1382
   registry location is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MYSQL
 
1383
   AB. A server version specific entry will be created for each major
 
1384
   version of MySQL that you install.
3715
1385
 
3716
1386
   The MySQL Installation Wizard creates a key named after the major
3717
1387
   version of the server that is being installed, such as MySQL
3720
1390
   directory. In a default installation it contains C:\Program
3721
1391
   Files\MySQL\MySQL Server 5.1\. The Version string contains the
3722
1392
   release number. For example, for an installation of MySQL Server
3723
 
   5.1.41, the key contains a value of 5.1.41.
 
1393
   5.1.62, the key contains a value of 5.1.62.
3724
1394
 
3725
1395
   These registry keys are used to help external tools identify the
3726
1396
   installed location of the MySQL server, preventing a complete scan
3781
1451
   default location of the data directory is the AppData directory
3782
1452
   configured for the user that installed the MySQL application.
3783
1453
 
3784
 
2.5.3.1.6. Upgrading MySQL with the Installation Wizard
 
1454
2.3.3.1.6. MySQL Installation Wizard: Upgrading MySQL
3785
1455
 
3786
1456
   The MySQL Installation Wizard can perform server upgrades
3787
1457
   automatically using the upgrade capabilities of MSI. That means
3792
1462
 
3793
1463
   Automatic upgrades are available only when upgrading between
3794
1464
   installations that have the same major and minor version numbers.
3795
 
   For example, you can upgrade automatically from MySQL 5.1.34 to
3796
 
   MySQL 5.1.37, but not from MySQL 5.0 to MySQL 5.1.
 
1465
   For example, you can upgrade automatically from MySQL 5.1.5 to
 
1466
   MySQL 5.1.6, but not from MySQL 5.0 to MySQL 5.1.
3797
1467
 
3798
1468
   In MySQL 5.1.32 and later, the EXE version of the MSI installer
3799
1469
   packages were removed. When upgrading an existing MySQL
3816
1486
 
3817
1487
         3. Install the new version of MySQL using the MSI installer.
3818
1488
            When running the installation, skip updating the security
3819
 
            by deselecting the checkbox on the security screen.
 
1489
            by deselecting the check box on the security screen.
3820
1490
 
3821
1491
         4. Complete the installation, and then start the server
3822
1492
            again. You should be able to login with your existing
3827
1497
       installation with an open source installer. You cannot upgrade
3828
1498
       an open source installation using the enterprise installer.
3829
1499
 
3830
 
   See Section 2.5.7, "Upgrading MySQL on Windows."
 
1500
   See Section 2.3.7, "Upgrading MySQL Server on Microsoft Windows."
3831
1501
 
3832
 
2.5.3.2. Installing MySQL Automatically using MSI
 
1502
2.3.3.2. Automating MySQL Installation on Microsoft Windows using the
 
1503
MSI Package
3833
1504
 
3834
1505
   The Microsoft Installer (MSI) supports a both a quiet and a
3835
1506
   passive mode that can be used to install MySQL automatically
3836
 
   without requireing intervention. You can use this either in
3837
 
   scripts to automatically install MySQL or through a terminal
3838
 
   connection such as Telnet where you do not have access to the
3839
 
   standard Windows user interface. The MSI packages can also be used
3840
 
   in combination with Microsoft's Group Policy system (part of
3841
 
   Windows Server 2003 and Windows Server 2008) to install MySQL
3842
 
   across multiple machines.
 
1507
   without requiring intervention. You can use this either in scripts
 
1508
   to automatically install MySQL or through a terminal connection
 
1509
   such as Telnet where you do not have access to the standard
 
1510
   Windows user interface. The MSI packages can also be used in
 
1511
   combination with Microsoft's Group Policy system (part of Windows
 
1512
   Server 2003 and Windows Server 2008) to install MySQL across
 
1513
   multiple machines.
3843
1514
 
3844
1515
   To install MySQL from one of the MSI packages automatically from
3845
1516
   the command line (or within a script), you need to use the
3846
1517
   msiexec.exe tool. For example, to perform a quiet installation
3847
1518
   (which shows no dialog boxes or progress):
3848
 
shell> msiexec /i /quiet mysql-5.1.39.msi
 
1519
shell> msiexec /i /quiet mysql-5.1.62.msi
3849
1520
 
3850
1521
   The /i indicates that you want to perform an installation. The
3851
1522
   /quiet option indicates that you want no interactive elements.
3853
1524
   To provide a dialog box showing the progress during installation,
3854
1525
   and the dialog boxes providing information on the installation and
3855
1526
   registration of MySQL, use /passive mode instead of /quiet:
3856
 
shell> msiexec /i /passive mysql-5.1.39.msi
 
1527
shell> msiexec /i /passive mysql-5.1.62.msi
3857
1528
 
3858
1529
   Regardless of the mode of the installation, installing the package
3859
1530
   in this manner performs a 'Typical' installation, and installs the
3861
1532
 
3862
1533
   You can also use this method to uninstall MySQL by using the
3863
1534
   /uninstall or /x options:
3864
 
shell> msiexec /x /quiet mysql-5.1.39.msi
 
1535
shell> msiexec /x /quiet mysql-5.1.62.msi
3865
1536
 
3866
1537
   To install MySQL and configure a MySQL instance from the command
3867
 
   line, see Section 2.5.4.13, "Creating an Instance from the Command
3868
 
   Line."
 
1538
   line, see Section 2.3.4.13, "MySQL Server Instance Config Wizard:
 
1539
   Creating an Instance from the Command Line."
3869
1540
 
3870
1541
   For information on using MSI packages to install software
3871
1542
   automatically using Group Policy, see How to use Group Policy to
3872
1543
   remotely install software in Windows Server 2003
3873
1544
   (http://support.microsoft.com/kb/816102).
3874
1545
 
3875
 
2.5.3.3. Removing MySQL Installed from the MSI Package
 
1546
2.3.3.3. Removing MySQL When Installed from the MSI Package
3876
1547
 
3877
1548
   To uninstall a MySQL where you have used the MSI packages, you
3878
1549
   must use the Add/Remove Programs tool within Control Panel. To do
3879
1550
   this:
3880
1551
 
3881
 
    1. Right click on the start menu and choose Control Panel.
 
1552
    1. Right-click the start menu and choose Control Panel.
3882
1553
 
3883
1554
    2. If the Control Panel is set to category mode (you will see
3884
1555
       Pick a category at the top of the Control Panel window),
3885
 
       double click on Add or Remove Programs. If the Control is set
3886
 
       to classic mode, doubgle click on the Add or Remove Programs
3887
 
       icon.
 
1556
       double-click Add or Remove Programs. If the Control is set to
 
1557
       classic mode, double-click the Add or Remove Programs icon.
3888
1558
 
3889
1559
    3. Find MySQL in the list of installed software. MySQL Server is
3890
1560
       installed against major version numbers (MySQL 5.0, MySQL 5.1,
3900
1570
   logs produced during execution are kept in their configured
3901
1571
   location.
3902
1572
 
3903
 
2.5.4. MySQL Server Instance Config Wizard
 
1573
   If you try to install MySQL again the information will be retained
 
1574
   and you will be prompted to enter the password configured with the
 
1575
   original installation.
 
1576
 
 
1577
   If you want to delete MySQL completely:
 
1578
 
 
1579
     * Delete the associated data directory. On Windows XP and
 
1580
       Windows Server 2003, before MySQL 5.1.24, the default data
 
1581
       directory would be located within the MySQL installation
 
1582
       directory. On MySQL 5.1.24 and later, the default data
 
1583
       directory is the configured AppData directory, which is
 
1584
       C:\Documents and Settings\All Users\Application Data\MySQL by
 
1585
       default.
 
1586
 
 
1587
     * On Windows 7 and Windows Server 2008, the default data
 
1588
       directory location is C:\ProgramData\Mysql.
 
1589
       Note
 
1590
       The C:\ProgramData directory is hidden by default. You must
 
1591
       change your folder options to view the hidden file. Choose
 
1592
       Organize, Folder and search options, Show hidden folders.
 
1593
 
 
1594
2.3.4. Using the MySQL Server Instance Config Wizard
3904
1595
 
3905
1596
   The MySQL Server Instance Config Wizard helps automate the process
3906
1597
   of configuring your server. It creates a custom MySQL
3919
1610
   Figure 2.4. MySQL Server Instance Config Wizard Workflow
3920
1611
   MySQL Server Instance Config Wizard Workflow
3921
1612
 
3922
 
2.5.4.1. Starting the MySQL Server Instance Config Wizard
 
1613
2.3.4.1. Starting the MySQL Server Instance Config Wizard
3923
1614
 
3924
1615
   The MySQL Server Instance Config Wizard is normally started as
3925
1616
   part of the installation process. You should only need to run the
3927
1618
   the configuration parameters of your server.
3928
1619
 
3929
1620
   If you chose not to open a port prior to installing MySQL on
3930
 
   Windows Vista, you can choose to use the MySQL Server Instance
3931
 
   Config Wizard after installation. However, you must open a port in
3932
 
   the Windows Firewall. To do this see the instructions given in
3933
 
   Section 2.5.3.1.1, "Downloading and Starting the MySQL
3934
 
   Installation Wizard." Rather than opening a port, you also have
3935
 
   the option of adding MySQL as a program that bypasses the Windows
3936
 
   Firewall. One or the other option is sufficient --- you need not
3937
 
   do both. Additionally, when running the MySQL Server Config Wizard
3938
 
   on Windows Vista ensure that you are logged in as a user with
3939
 
   administrative rights.
 
1621
   Windows Vista or newer, you can choose to use the MySQL Server
 
1622
   Instance Config Wizard after installation. However, you must open
 
1623
   a port in the Windows Firewall. To do this see the instructions
 
1624
   given in Section 2.3.3.1.1, "MySQL Installation Wizard:
 
1625
   Downloading and Starting." Rather than opening a port, you also
 
1626
   have the option of adding MySQL as a program that bypasses the
 
1627
   Windows Firewall. One or the other option is sufficient---you need
 
1628
   not do both. Additionally, when running the MySQL Server Config
 
1629
   Wizard on Windows Vista or newer, ensure that you are logged in as
 
1630
   a user with administrative rights.
3940
1631
   MySQL Server Instance Config Wizard
3941
1632
 
3942
1633
   You can launch the MySQL Config Wizard by clicking the MySQL
3963
1654
   Apart from making changes to the my.ini file by running the MySQL
3964
1655
   Server Instance Config Wizard again, you can modify it by opening
3965
1656
   it with a text editor and making any necessary changes. You can
3966
 
   also modify the server configuration with the MySQL Administrator
3967
 
   (http://www.mysql.com/products/administrator/) utility. For more
 
1657
   also modify the server configuration with the
 
1658
   http://www.mysql.com/products/administrator/ utility. For more
3968
1659
   information about server configuration, see Section 5.1.2, "Server
3969
1660
   Command Options."
3970
1661
 
3975
1666
   Windows installation directory (for example, C:\WINDOWS).
3976
1667
 
3977
1668
   Under Windows Server 2003, Windows Server 2000, Windows XP, and
3978
 
   Windows Vista MySQL Server Instance Config Wizard will configure
 
1669
   Windows Vista, MySQL Server Instance Config Wizard will configure
3979
1670
   MySQL to work as a Windows service. To start and stop MySQL you
3980
1671
   use the Services application that is supplied as part of the
3981
1672
   Windows Administrator Tools.
3982
1673
 
3983
 
2.5.4.2. Choosing a Maintenance Option
 
1674
2.3.4.2. MySQL Server Instance Config Wizard: Choosing a Maintenance
 
1675
Option
3984
1676
 
3985
1677
   If the MySQL Server Instance Config Wizard detects an existing
3986
1678
   configuration file, you have the option of either reconfiguring
4005
1697
   Configuration Type dialog where you can choose the type of
4006
1698
   installation that you wish to configure.
4007
1699
 
4008
 
2.5.4.3. Choosing a Configuration Type
 
1700
2.3.4.3. MySQL Server Instance Config Wizard: Choosing a
 
1701
Configuration Type
4009
1702
 
4010
1703
   When you start the MySQL Server Instance Config Wizard for a new
4011
1704
   MySQL installation, or choose the Re-configure Instance option for
4036
1729
 
4037
1730
   To complete the Standard Configuration, please refer to the
4038
1731
   sections on Service Options and Security Options in Section
4039
 
   2.5.4.10, "The Service Options Dialog," and Section 2.5.4.11, "The
4040
 
   Security Options Dialog," respectively.
 
1732
   2.3.4.10, "MySQL Server Instance Config Wizard: The Service
 
1733
   Options Dialog," and Section 2.3.4.11, "MySQL Server Instance
 
1734
   Config Wizard: The Security Options Dialog," respectively.
4041
1735
 
4042
 
2.5.4.4. The Server Type Dialog
 
1736
2.3.4.4. MySQL Server Instance Config Wizard: The Server Type Dialog
4043
1737
 
4044
1738
   There are three different server types available to choose from.
4045
1739
   The server type that you choose affects the decisions that the
4065
1759
       MySQL server is configured to use all available system
4066
1760
       resources.
4067
1761
 
4068
 
Note
 
1762
   Note
4069
1763
 
4070
1764
   By selecting one of the preconfigured configurations, the values
4071
1765
   and settings of various options in your my.cnf or my.ini will be
4074
1768
   and values that were created during the execution of the Config
4075
1769
   Wizard.
4076
1770
 
4077
 
2.5.4.5. The Database Usage Dialog
 
1771
2.3.4.5. MySQL Server Instance Config Wizard: The Database Usage
 
1772
Dialog
4078
1773
 
4079
 
   The Database Usage dialog allows you to indicate the storage
 
1774
   The Database Usage dialog enables you to indicate the storage
4080
1775
   engines that you expect to use when creating MySQL tables. The
4081
1776
   option you choose determines whether the InnoDB storage engine is
4082
1777
   available and what percentage of the server resources are
4125
1820
   resources dedicated to MyISAM. The remaining resources are
4126
1821
   allocated to InnoDB.
4127
1822
 
4128
 
2.5.4.6. The InnoDB Tablespace Dialog
 
1823
2.3.4.6. MySQL Server Instance Config Wizard: The InnoDB Tablespace
 
1824
Dialog
4129
1825
 
4130
1826
   Some users may want to locate the InnoDB tablespace files in a
4131
1827
   different location than the MySQL server data directory. Placing
4144
1840
   situation you must move the existing tablespace files to the new
4145
1841
   location manually before starting the server.
4146
1842
 
4147
 
2.5.4.7. The Concurrent Connections Dialog
 
1843
2.3.4.7. MySQL Server Instance Config Wizard: The Concurrent
 
1844
Connections Dialog
4148
1845
 
4149
1846
   To prevent the server from running out of resources, it is
4150
1847
   important to limit the number of concurrent connections to the
4151
1848
   MySQL server that can be established. The Concurrent Connections
4152
 
   dialog allows you to choose the expected usage of your server, and
4153
 
   sets the limit for concurrent connections accordingly. It is also
4154
 
   possible to set the concurrent connection limit manually.
 
1849
   dialog enables you to choose the expected usage of your server,
 
1850
   and sets the limit for concurrent connections accordingly. It is
 
1851
   also possible to set the concurrent connection limit manually.
4155
1852
   MySQL Server Instance Config Wizard: Connections
4156
1853
 
4157
1854
     * Decision Support (DSS)/OLAP: Choose this option if your server
4169
1866
       provided, or enter the maximum number of connections into the
4170
1867
       drop-down box if the number you desire is not listed.
4171
1868
 
4172
 
2.5.4.8. The Networking and Strict Mode Options Dialog
 
1869
2.3.4.8. MySQL Server Instance Config Wizard: The Networking and
 
1870
Strict Mode Options Dialog
4173
1871
 
4174
1872
   Use the Networking Options dialog to enable or disable TCP/IP
4175
1873
   networking and to configure the port number that is used to
4191
1889
   database management systems. If you run applications that rely on
4192
1890
   MySQL's old "forgiving" behavior, make sure to either adapt those
4193
1891
   applications or to disable strict mode. For more information about
4194
 
   strict mode, see Section 5.1.8, "Server SQL Modes."
 
1892
   strict mode, see Section 5.1.6, "Server SQL Modes."
4195
1893
 
4196
 
2.5.4.9. The Character Set Dialog
 
1894
2.3.4.9. MySQL Server Instance Config Wizard: The Character Set
 
1895
Dialog
4197
1896
 
4198
1897
   The MySQL server supports multiple character sets and it is
4199
1898
   possible to set a default server character set that is applied to
4216
1915
       manually. Choose the desired character set from the provided
4217
1916
       drop-down list.
4218
1917
 
4219
 
2.5.4.10. The Service Options Dialog
 
1918
2.3.4.10. MySQL Server Instance Config Wizard: The Service Options
 
1919
Dialog
4220
1920
 
4221
1921
   On Windows platforms, the MySQL server can be installed as a
4222
1922
   Windows service. When installed this way, the MySQL server can be
4229
1929
   Install As Windows Service option. You can change the service name
4230
1930
   by picking a new service name from the drop-down box provided or
4231
1931
   by entering a new service name into the drop-down box.
4232
 
 
4233
 
Note
 
1932
   Note
4234
1933
 
4235
1934
   Service names can include any legal character except forward (/)
4236
1935
   or backward (\) slashes, and must be less than 256 characters
4237
1936
   long.
4238
 
 
4239
 
Warning
 
1937
   Warning
4240
1938
 
4241
1939
   If you are installing multiple versions of MySQL onto the same
4242
1940
   machine, you must choose a different service name for each version
4260
1958
   automatically at startup, uncheck the box next to the Launch the
4261
1959
   MySQL Server Automatically option.
4262
1960
 
4263
 
2.5.4.11. The Security Options Dialog
4264
 
 
4265
 
   It is strongly recommended that you set a root password for your
4266
 
   MySQL server, and the MySQL Server Instance Config Wizard requires
4267
 
   by default that you do so. If you do not wish to set a root
4268
 
   password, uncheck the box next to the Modify Security Settings
4269
 
   option.
4270
 
   MySQL Server Instance Config Wizard: Security
4271
 
 
4272
 
   To set the root password, enter the desired password into both the
4273
 
   New root password and Confirm boxes. If you are reconfiguring an
4274
 
   existing server, you need to enter the existing root password into
4275
 
   the Current root password box.
4276
 
 
4277
 
   To allow root logins from across the network, check the box next
 
1961
2.3.4.11. MySQL Server Instance Config Wizard: The Security Options
 
1962
Dialog
 
1963
 
 
1964
   The content of the security options portion of the MySQL Server
 
1965
   Instance Configuration Wizard will depend on whether this is a new
 
1966
   installation, or modifying an existing installation.
 
1967
 
 
1968
     * Setting the root password for a new installation
 
1969
       It is strongly recommended that you set a root password for
 
1970
       your MySQL server, and the MySQL Server Instance Config Wizard
 
1971
       requires by default that you do so. If you do not wish to set
 
1972
       a root password, uncheck the box next to the Modify Security
 
1973
       Settings option.
 
1974
       Note
 
1975
       If you have previously installed MySQL, but not deleted the
 
1976
       data directory associated with the previous installation, you
 
1977
       may be prompted to provide the current root password. The
 
1978
       password will be the one configured with your old data
 
1979
       directory. If you do not want to use this data, or do not know
 
1980
       the root password, you should cancel the installation, delete
 
1981
       the previous installation data, and then restart the
 
1982
       installation process. For more information on deleting MySQL
 
1983
       data on Microsoft Windows, see Section 2.3.3.3, "Removing
 
1984
       MySQL When Installed from the MSI Package."
 
1985
       MySQL Server Instance Config Wizard: Security
 
1986
 
 
1987
     * To set the root password, enter the desired password into both
 
1988
       the New root password and Confirm boxes.
 
1989
       Setting the root password for an existing installation
 
1990
       If you are modifying the configuration of an existing
 
1991
       configuration, or you are installing an upgrade and the MySQL
 
1992
       Server Instance Configuration Wizard has detected an existing
 
1993
       MySQL system, then you must enter the existing password for
 
1994
       root before changing the configuration information.
 
1995
       MySQL Server Instance Config Wizard: Security (Existing
 
1996
       Installation)
 
1997
       If you want to change the current root password, enter the
 
1998
       desired new password into both the New root password and
 
1999
       Confirm boxes.
 
2000
 
 
2001
   To permit root logins from across the network, check the box next
4278
2002
   to the Enable root access from remote machines option. This
4279
2003
   decreases the security of your root account.
4280
2004
 
4283
2007
   can decrease server security and cause login and permission
4284
2008
   difficulties. For this reason, it is not recommended.
4285
2009
 
4286
 
2.5.4.12. The Confirmation Dialog
 
2010
2.3.4.12. MySQL Server Instance Config Wizard: The Confirmation
 
2011
Dialog
4287
2012
 
4288
2013
   The final dialog in the MySQL Server Instance Config Wizard is the
4289
2014
   Confirmation Dialog. To start the configuration process, click the
4319
2044
   tasks, it displays a summary. Click the Finish button to exit the
4320
2045
   MySQL Server Config Wizard.
4321
2046
 
4322
 
2.5.4.13. Creating an Instance from the Command Line
 
2047
2.3.4.13. MySQL Server Instance Config Wizard: Creating an Instance
 
2048
from the Command Line
4323
2049
 
4324
2050
   In addition to using the GUI interface to the MySQL Server
4325
2051
   Instance Config Wizard, you can also create instances
4337
2063
   The main command line options are provided in the table below.
4338
2064
   Some of the options are required, while some options are optional.
4339
2065
 
4340
 
   Table 2.4. MySQL Server Instance Config Wizard Command Line
 
2066
   Table 2.6. MySQL Server Instance Config Wizard Command Line
4341
2067
   Options
4342
2068
   Option Description
4343
2069
   Required Parameters
4377
2103
   The parameters that you can specify on the command line are listed
4378
2104
   in the table below.
4379
2105
 
4380
 
   Table 2.5. MySQL Server Instance Config Wizard Parameters
 
2106
   Table 2.7. MySQL Server Instance Config Wizard Parameters
4381
2107
   Parameter Description
4382
2108
   ServiceName=$ Specify the name of the service to be created
4383
2109
   AddBinToPath={yes | no} Specifies whether to add the binary
4384
2110
   directory of MySQL to the standard PATH environment variable
4385
2111
   ServerType={DEVELOPMENT | SERVER | DEDICATED} Specify the server
4386
 
   type. For more information, see Section 2.5.4.4, "The Server Type
4387
 
   Dialog"
 
2112
   type. For more information, see Section 2.3.4.4, "MySQL Server
 
2113
   Instance Config Wizard: The Server Type Dialog"
4388
2114
   DatabaseType={MIXED | INNODB | MYISAM} Specify the default
4389
 
   database type. For more information, see Section 2.5.4.5, "The
4390
 
   Database Usage Dialog"
 
2115
   database type. For more information, see Section 2.3.4.5, "MySQL
 
2116
   Server Instance Config Wizard: The Database Usage Dialog"
4391
2117
   ConnectionUsage={DSS | OLTP} Specify the type of connection
4392
2118
   support, this automates the setting for the number of concurrent
4393
2119
   connections (see the ConnectionCount parameter). For more
4394
 
   information, see Section 2.5.4.7, "The Concurrent Connections
4395
 
   Dialog"
 
2120
   information, see Section 2.3.4.7, "MySQL Server Instance Config
 
2121
   Wizard: The Concurrent Connections Dialog"
4396
2122
   ConnectionCount=# Specify the number of concurrent connections to
4397
 
   support. For more information, see Section 2.5.4.4, "The Server
4398
 
   Type Dialog"
 
2123
   support. For more information, see Section 2.3.4.4, "MySQL Server
 
2124
   Instance Config Wizard: The Server Type Dialog"
4399
2125
   SkipNetworking={yes | no} Specify whether network support should
4400
2126
   be supported. Specifying yes disables network access altogether
4401
2127
   Port=# Specify the network port number to use for network
4402
 
   connections. For more information, see Section 2.5.4.8, "The
4403
 
   Networking and Strict Mode Options Dialog"
 
2128
   connections. For more information, see Section 2.3.4.8, "MySQL
 
2129
   Server Instance Config Wizard: The Networking and Strict Mode
 
2130
   Options Dialog"
4404
2131
   StrictMode={yes | no} Specify whether to use the strict SQL mode.
4405
 
   For more information, see Section 2.5.4.8, "The Networking and
4406
 
   Strict Mode Options Dialog"
 
2132
   For more information, see Section 2.3.4.8, "MySQL Server Instance
 
2133
   Config Wizard: The Networking and Strict Mode Options Dialog"
4407
2134
   Charset=$ Specify the default character set. For more information,
4408
 
   see Section 2.5.4.9, "The Character Set Dialog"
 
2135
   see Section 2.3.4.9, "MySQL Server Instance Config Wizard: The
 
2136
   Character Set Dialog"
4409
2137
   RootPassword=$ Specify the root password
4410
2138
   RootCurrentPassword=$ Specify the current root password then
4411
 
   stopping and/or reconfiguring an existing service
4412
 
 
4413
 
Note
 
2139
   stopping or reconfiguring an existing service
 
2140
   Note
4414
2141
 
4415
2142
   When specifying options on the command line, you can enclose the
4416
2143
   entire command-line option and the value you are specifying using
4417
 
   double quotes. This enables you to use spaces in the options. For
4418
 
   example, "-cC:\mysql.ini".
 
2144
   double quotation marks. This enables you to use spaces in the
 
2145
   options. For example, "-cC:\mysql.ini".
4419
2146
 
4420
2147
   The following command installs a MySQL Server 5.1 instance from
4421
2148
   the directory C:\Program Files\MySQL\MySQL Server 5.1 using the
4422
2149
   service name MySQL51 and setting the root password to 1234.
4423
2150
shell> MySQLInstanceConfig.exe -i -q "-lC:\mysql_install_log.txt" Ā»
4424
2151
   "-nMySQL Server 5.1" "-pC:\Program Files\MySQL\MySQL Server 5.1" -
4425
 
v5.1.39 Ā»
 
2152
v5.1.62 Ā»
4426
2153
   "-tmy-template.ini" "-cC:\mytest.ini" ServerType=DEVELOPMENT Datab
4427
2154
aseType=MIXED Ā»
4428
2155
   ConnectionUsage=DSS Port=3311 ServiceName=MySQL51 RootPassword=123
4438
2165
Installing service ...
4439
2166
 
4440
2167
Product Name:         MySQL Server 5.1
4441
 
Version:              5.1.39
 
2168
Version:              5.1.62
4442
2169
Installation Path:    C:\Program Files\MySQL\MySQL Server 5.1\
4443
2170
 
4444
2171
Creating configuration file C:\mytest.ini using template my-template.
4462
2189
defaults-file="C:\mytest.ini" MySQL51.
4463
2190
Windows service MySQL51 installed.
4464
2191
 
4465
 
   When using the command-line, the return values in the following
 
2192
   When using the command line, the return values in the following
4466
2193
   table indicate an error performing the specified option.
4467
2194
 
4468
 
   Table 2.6. Return Value from MySQL Server Instance Config Wizard
 
2195
   Table 2.8. Return Value from MySQL Server Instance Config Wizard
4469
2196
   Value                   Description
4470
2197
   2     Configuration template file cannot be found
4471
2198
   3     The Windows service entry cannot be created
4477
2204
   9     The Windows service entry cannot be removed
4478
2205
 
4479
2206
   You can perform an installation of MySQL automatically using the
4480
 
   MSI packe. For more information, see Section 2.5.3.2, "Installing
4481
 
   MySQL Automatically using MSI."
 
2207
   MSI package. For more information, see Section 2.3.3.2,
 
2208
   "Automating MySQL Installation on Microsoft Windows using the MSI
 
2209
   Package."
4482
2210
 
4483
 
2.5.5. Installing MySQL from a noinstall Zip Archive
 
2211
2.3.5. Installing MySQL on Microsoft Windows Using a noinstall Zip
 
2212
Archive
4484
2213
 
4485
2214
   Users who are installing from the noinstall package can use the
4486
2215
   instructions in this section to manually install MySQL. The
4498
2227
 
4499
2228
   This process is described in the sections that follow.
4500
2229
 
4501
 
2.5.5.1. Extracting the Install Archive
 
2230
2.3.5.1. Extracting the Install Archive
4502
2231
 
4503
2232
   To install MySQL manually, do the following:
4504
2233
 
4505
2234
    1. If you are upgrading from a previous version please refer to
4506
 
       Section 2.5.7, "Upgrading MySQL on Windows," before beginning
4507
 
       the upgrade process.
 
2235
       Section 2.3.7, "Upgrading MySQL Server on Microsoft Windows,"
 
2236
       before beginning the upgrade process.
4508
2237
 
4509
2238
    2. Make sure that you are logged in as a user with administrator
4510
2239
       privileges.
4514
2243
       installs MySQL under C:\Program Files\MySQL. If you do not
4515
2244
       install MySQL at C:\mysql, you must specify the path to the
4516
2245
       install directory during startup or in an option file. See
4517
 
       Section 2.5.5.2, "Creating an Option File."
 
2246
       Section 2.3.5.2, "Creating an Option File."
4518
2247
 
4519
2248
    4. Extract the install archive to the chosen installation
4520
2249
       location using your preferred Zip archive tool. Some tools may
4523
2252
       contents of the subfolder into the chosen installation
4524
2253
       location.
4525
2254
 
4526
 
2.5.5.2. Creating an Option File
 
2255
2.3.5.2. Creating an Option File
4527
2256
 
4528
2257
   If you need to specify startup options when you run the server,
4529
2258
   you can indicate them on the command line or place them in an
4581
2310
   The rules for use of backslash in option file values are given in
4582
2311
   Section 4.2.3.3, "Using Option Files."
4583
2312
 
4584
 
   MySQL Enterprise For expert advice on the start-up options
4585
 
   appropriate to your circumstances, subscribe to the MySQL
4586
 
   Enterprise Monitor. For more information, see
4587
 
   http://www.mysql.com/products/enterprise/advisors.html.
4588
 
 
4589
2313
   In MySQL 5.1.23 and earlier, the MySQL installer places the data
4590
2314
   directory directly under the directory where you install MySQL. On
4591
2315
   MySQL 5.1.24 and later, the data directory is located within the
4603
2327
    2. Use a --datadir option to specify the new data directory
4604
2328
       location each time you start the server.
4605
2329
 
4606
 
2.5.5.3. Selecting a MySQL Server Type
 
2330
2.3.5.3. Selecting a MySQL Server Type
4607
2331
 
4608
2332
   The following table shows the available servers for Windows in
4609
2333
   MySQL 5.1.20 and earlier.
 
2334
 
 
2335
   Table 2.9. mysqld binary types for Microsoft Windows up to MySQL
 
2336
   5.1.20
4610
2337
   Binary Description
4611
2338
   mysqld-nt Optimized binary with named-pipe support
4612
2339
   mysqld Optimized binary without named-pipe support
4615
2342
 
4616
2343
   The following table shows the available servers for Windows in
4617
2344
   MySQL 5.1.21 and later.
 
2345
 
 
2346
   Table 2.10. mysqld binary types for Microsoft Windows MySQL 5.1.21
 
2347
   and later
4618
2348
   Binary Description
4619
2349
   mysqld Optimized binary with named-pipe support
4620
2350
   mysqld-debug Like mysqld, but compiled with full debugging and
4645
2375
       shutting down the MySQL server when named pipes were used.
4646
2376
 
4647
2377
     * For MySQL 5.1.20 and earlier, named-pipe connections are
4648
 
       allowed only by the mysqld-nt and mysqld-debug servers. For
 
2378
       permitted only by the mysqld-nt and mysqld-debug servers. For
4649
2379
       MySQL 5.1.21 and later, the mysqld and mysqld-debug servers
4650
2380
       both contain support for named-pipe connections.
4651
2381
 
4652
 
Note
 
2382
   Note
4653
2383
 
4654
2384
   Most of the examples in this manual use mysqld as the server name.
4655
2385
   If you choose to use a different server, such as mysqld-nt or
4656
2386
   mysqld-debug, make the appropriate substitutions in the commands
4657
2387
   that are shown in the examples.
4658
2388
 
4659
 
2.5.5.4. Starting the Server for the First Time
 
2389
2.3.5.4. Starting MySQL Server on Microsoft Windows for the First
 
2390
Time
4660
2391
 
4661
2392
   This section gives a general overview of starting the MySQL
4662
2393
   server. The following sections provide more specific information
4681
2412
   option.
4682
2413
 
4683
2414
   For information about which server binary to run, see Section
4684
 
   2.5.5.3, "Selecting a MySQL Server Type."
 
2415
   2.3.5.3, "Selecting a MySQL Server Type."
4685
2416
 
4686
2417
   Testing is best done from a command prompt in a console window (or
4687
2418
   "DOS window"). In this way you can have the server display status
4718
2449
   something like this, which indicates that the server is ready to
4719
2450
   service client connections:
4720
2451
mysqld: ready for connections
4721
 
Version: '5.1.41'  socket: ''  port: 3306
 
2452
Version: '5.1.62'  socket: ''  port: 3306
4722
2453
 
4723
2454
   The server continues to write to the console any further
4724
2455
   diagnostic output it produces. You can open a new console window
4728
2459
   output to the error log in the data directory (C:\Program
4729
2460
   Files\MySQL\MySQL Server 5.1\data by default). The error log is
4730
2461
   the file with the .err extension.
4731
 
 
4732
 
Note
 
2462
   Note
4733
2463
 
4734
2464
   The accounts that are listed in the MySQL grant tables initially
4735
2465
   have no passwords. After starting the server, you should set up
4736
 
   passwords for them using the instructions in Section 2.13,
4737
 
   "Post-Installation Setup and Testing."
 
2466
   passwords for them using the instructions in Section 2.12,
 
2467
   "Postinstallation Setup and Testing."
4738
2468
 
4739
 
2.5.5.5. Starting MySQL from the Windows Command Line
 
2469
2.3.5.5. Starting MySQL Server from the Windows Command Line
4740
2470
 
4741
2471
   The MySQL server can be started manually from the command line.
4742
2472
   This can be done on any version of Windows.
4752
2482
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root
4753
2483
 shutdown
4754
2484
 
4755
 
Note
 
2485
   Note
4756
2486
 
4757
2487
   If the MySQL root user account has a password, you need to invoke
4758
2488
   mysqladmin with the -p option and supply the password when
4782
2512
   Use mysqld --verbose --help to display all the options that mysqld
4783
2513
   supports.
4784
2514
 
4785
 
2.5.5.6. Starting MySQL as a Windows Service
4786
 
 
4787
 
   On Windows, the recommended way to run MySQL is to install it as a
4788
 
   Windows service, whereby MySQL starts and stops automatically when
4789
 
   Windows starts and stops. A MySQL server installed as a service
4790
 
   can also be controlled from the command line using NET commands,
4791
 
   or with the graphical Services utility. Generally, to install
4792
 
   MySQL as a Windows service you should be logged in using an
4793
 
   account that has administrator rights.
4794
 
 
4795
 
   The Services utility (the Windows Service Control Manager) can be
4796
 
   found in the Windows Control Panel (under Administrative Tools on
4797
 
   Windows 2000, XP, Vista and Server 2003). To avoid conflicts, it
4798
 
   is advisable to close the Services utility while performing server
4799
 
   installation or removal operations from the command line.
4800
 
 
4801
 
   Before installing MySQL as a Windows service, you should first
4802
 
   stop the current server if it is running by using the following
4803
 
   command:
4804
 
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin"
4805
 
          -u root shutdown
4806
 
 
4807
 
Note
4808
 
 
4809
 
   If the MySQL root user account has a password, you need to invoke
4810
 
   mysqladmin with the -p option and supply the password when
4811
 
   prompted.
4812
 
 
4813
 
   This command invokes the MySQL administrative utility mysqladmin
4814
 
   to connect to the server and tell it to shut down. The command
4815
 
   connects as the MySQL root user, which is the default
4816
 
   administrative account in the MySQL grant system. Note that users
4817
 
   in the MySQL grant system are wholly independent from any login
4818
 
   users under Windows.
4819
 
 
4820
 
   Install the server as a service using this command:
4821
 
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install
4822
 
 
4823
 
   The service-installation command does not start the server.
4824
 
   Instructions for that are given later in this section.
 
2515
2.3.5.6. Customizing the PATH for MySQL Tools
4825
2516
 
4826
2517
   To make it easier to invoke MySQL programs, you can add the path
4827
2518
   name of the MySQL bin directory to your Windows system PATH
4828
2519
   environment variable:
4829
2520
 
4830
 
     * On the Windows desktop, right-click on the My Computer icon,
4831
 
       and select Properties.
 
2521
     * On the Windows desktop, right-click the My Computer icon, and
 
2522
       select Properties.
4832
2523
 
4833
2524
     * Next select the Advanced tab from the System Properties menu
4834
2525
       that appears, and click the Environment Variables button.
4841
2532
       your cursor is positioned at the very end of the text in this
4842
2533
       space.) Then enter the complete path name of your MySQL bin
4843
2534
       directory (for example, C:\Program Files\MySQL\MySQL Server
4844
 
       5.1\bin), Note that there should be a semicolon separating
4845
 
       this path from any values present in this field. Dismiss this
4846
 
       dialogue, and each dialogue in turn, by clicking OK until all
4847
 
       of the dialogues that were opened have been dismissed. You
4848
 
       should now be able to invoke any MySQL executable program by
4849
 
       typing its name at the DOS prompt from any directory on the
4850
 
       system, without having to supply the path. This includes the
4851
 
       servers, the mysql client, and all MySQL command-line
4852
 
       utilities such as mysqladmin and mysqldump.
 
2535
       5.1\bin)
 
2536
       Note
 
2537
       There must be a semicolon separating this path from any values
 
2538
       present in this field.
 
2539
       Dismiss this dialogue, and each dialogue in turn, by clicking
 
2540
       OK until all of the dialogues that were opened have been
 
2541
       dismissed. You should now be able to invoke any MySQL
 
2542
       executable program by typing its name at the DOS prompt from
 
2543
       any directory on the system, without having to supply the
 
2544
       path. This includes the servers, the mysql client, and all
 
2545
       MySQL command-line utilities such as mysqladmin and mysqldump.
4853
2546
       You should not add the MySQL bin directory to your Windows
4854
2547
       PATH if you are running multiple MySQL servers on the same
4855
2548
       machine.
4856
2549
 
4857
 
Warning
 
2550
   Warning
4858
2551
 
4859
2552
   You must exercise great care when editing your system PATH by
4860
2553
   hand; accidental deletion or modification of any portion of the
4861
2554
   existing PATH value can leave you with a malfunctioning or even
4862
2555
   unusable system.
4863
2556
 
4864
 
   The following additional arguments can be used in MySQL 5.1 when
4865
 
   installing the service:
 
2557
2.3.5.7. Starting MySQL Server as a Microsoft Windows Service
 
2558
 
 
2559
   On Windows, the recommended way to run MySQL is to install it as a
 
2560
   Windows service, whereby MySQL starts and stops automatically when
 
2561
   Windows starts and stops, and can be managed using the service
 
2562
   manager framework. A MySQL server installed as a service can also
 
2563
   be controlled from the command line using NET commands, or with
 
2564
   the graphical Services utility. Generally, to install MySQL as a
 
2565
   Windows service you should be logged in using an account that has
 
2566
   administrator rights.
 
2567
 
 
2568
   The Services utility (the Windows Service Control Manager) can be
 
2569
   found in the Windows Control Panel (under Administrative Tools on
 
2570
   Windows 2000, XP, Vista, and Server 2003). To avoid conflicts, it
 
2571
   is advisable to close the Services utility while performing server
 
2572
   installation or removal operations from the command line.
 
2573
 
 
2574
   Before installing MySQL as a Windows service, you should first
 
2575
   stop the current server if it is running by using the following
 
2576
   command:
 
2577
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin"
 
2578
          -u root shutdown
 
2579
 
 
2580
   Note
 
2581
 
 
2582
   If the MySQL root user account has a password, you need to invoke
 
2583
   mysqladmin with the -p option and supply the password when
 
2584
   prompted.
 
2585
 
 
2586
   This command invokes the MySQL administrative utility mysqladmin
 
2587
   to connect to the server and tell it to shut down. The command
 
2588
   connects as the MySQL root user, which is the default
 
2589
   administrative account in the MySQL grant system. Note that users
 
2590
   in the MySQL grant system are wholly independent from any login
 
2591
   users under Windows.
 
2592
 
 
2593
   Install the server as a service using this command:
 
2594
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install
 
2595
 
 
2596
   Note
 
2597
 
 
2598
   The service-installation command does not start the server.
 
2599
 
 
2600
   The following additional arguments can be used when installing the
 
2601
   service:
4866
2602
 
4867
2603
     * You can specify a service name immediately following the
4868
2604
       --install option. The default service name is MySQL.
4896
2632
       other than MySQL following the --install option, the server
4897
2633
       uses that service name. It reads options from the [mysqld]
4898
2634
       group and the group that has the same name as the service in
4899
 
       the standard option files. This allows you to use the [mysqld]
4900
 
       group for options that should be used by all MySQL services,
4901
 
       and an option group with the service name for use by the
4902
 
       server installed with that service name.
 
2635
       the standard option files. This enables you to use the
 
2636
       [mysqld] group for options that should be used by all MySQL
 
2637
       services, and an option group with the service name for use by
 
2638
       the server installed with that service name.
4903
2639
 
4904
2640
     * If the service-installation command specifies a
4905
2641
       --defaults-file option after the service name, the server
4954
2690
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --remove
4955
2691
 
4956
2692
   If mysqld is not running as a service, you can start it from the
4957
 
   command line. For instructions, see Section 2.5.5.5, "Starting
4958
 
   MySQL from the Windows Command Line."
4959
 
 
4960
 
   Please see Section 2.5.6, "Troubleshooting a MySQL Installation
4961
 
   Under Windows," if you encounter difficulties during installation.
4962
 
 
4963
 
2.5.5.7. Testing The MySQL Installation
 
2693
   command line. For instructions, see Section 2.3.5.5, "Starting
 
2694
   MySQL Server from the Windows Command Line."
 
2695
 
 
2696
   Please see Section 2.3.6, "Troubleshooting a Microsoft Windows
 
2697
   MySQL Server Installation," if you encounter difficulties during
 
2698
   installation.
 
2699
 
 
2700
2.3.5.8. Testing The MySQL Server Installation on Microsoft Windows
4964
2701
 
4965
2702
   You can test whether the MySQL server is working by executing any
4966
2703
   of the following commands:
4971
2708
 status proc
4972
2709
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql" test
4973
2710
 
4974
 
Note
 
2711
   Note
4975
2712
 
4976
2713
   By default, mysqlshow will try to connect using the ODBC user.
4977
2714
   This user is not created by default. You should specify a valid
4981
2718
   If mysqld is slow to respond to TCP/IP connections from client
4982
2719
   programs, there is probably a problem with your DNS. In this case,
4983
2720
   start mysqld with the --skip-name-resolve option and use only
4984
 
   localhost and IP numbers in the Host column of the MySQL grant
 
2721
   localhost and IP addresses in the Host column of the MySQL grant
4985
2722
   tables.
4986
2723
 
4987
2724
   You can force a MySQL client to use a named-pipe connection rather
4993
2730
   Note that if you have set a password for the root account, deleted
4994
2731
   the anonymous account, or created a new user account, then you
4995
2732
   must use the appropriate -u and -p options with the commands shown
4996
 
   above in order to connect with the MySQL Server. See Section
4997
 
   4.2.2, "Connecting to the MySQL Server."
 
2733
   above to connect with the MySQL Server. See Section 4.2.2,
 
2734
   "Connecting to the MySQL Server."
4998
2735
 
4999
2736
   For more information about mysqlshow, see Section 4.5.6,
5000
2737
   "mysqlshow --- Display Database, Table, and Column Information."
5001
2738
 
5002
 
2.5.6. Troubleshooting a MySQL Installation Under Windows
 
2739
2.3.6. Troubleshooting a Microsoft Windows MySQL Server Installation
5003
2740
 
5004
2741
   When installing and running MySQL for the first time, you may
5005
2742
   encounter certain errors that prevent the MySQL server from
5011
2748
   information relevant to the error that prevents the server from
5012
2749
   starting. The error log is located in the data directory specified
5013
2750
   in your my.ini file. The default data directory location is
5014
 
   C:\Program Files\MySQL\MySQL Server 5.1\data. See Section 5.2.2,
5015
 
   "The Error Log."
 
2751
   C:\Program Files\MySQL\MySQL Server 5.1\data, or
 
2752
   C:\ProgramData\Mysql on Windows 7 and Windows Server 2008. The
 
2753
   C:\ProgramData diectory is hidden by default. You need to change
 
2754
   your folder options to see the directory and contents. For more
 
2755
   information on the error log and understanding the content, see
 
2756
   Section 5.2.2, "The Error Log."
5016
2757
 
5017
2758
   Another source of information regarding possible errors is the
5018
2759
   console messages displayed when the MySQL service is starting. Use
5019
2760
   the NET START MySQL command from the command line after installing
5020
2761
   mysqld as a service to see any error messages regarding the
5021
 
   starting of the MySQL server as a service. See Section 2.5.5.6,
5022
 
   "Starting MySQL as a Windows Service."
 
2762
   starting of the MySQL server as a service. See Section 2.3.5.7,
 
2763
   "Starting MySQL Server as a Microsoft Windows Service."
5023
2764
 
5024
2765
   The following examples show other common error messages you may
5025
2766
   encounter when installing MySQL and starting the server for the
5071
2812
       If you change the datadir value in your MySQL configuration
5072
2813
       file, you must move the contents of the existing MySQL data
5073
2814
       directory before restarting the MySQL server.
5074
 
       See Section 2.5.5.2, "Creating an Option File."
 
2815
       See Section 2.3.5.2, "Creating an Option File."
5075
2816
 
5076
2817
     * If you reinstall or upgrade MySQL without first stopping and
5077
2818
       removing the existing MySQL service and install MySQL using
5080
2821
       This occurs when the Config Wizard tries to install the
5081
2822
       service and finds an existing service with the same name.
5082
2823
       One solution to this problem is to choose a service name other
5083
 
       than mysql when using the configuration wizard. This allows
 
2824
       than mysql when using the configuration wizard. This enables
5084
2825
       the new service to be installed correctly, but leaves the
5085
2826
       outdated service in place. Although this is harmless, it is
5086
2827
       best to remove old services that are no longer in use.
5094
2835
       http://www.microsoft.com/windows2000/techinfo/reskit/tools/exi
5095
2836
       sting/delsrv-o.asp and use the delsrv mysql syntax.
5096
2837
 
5097
 
2.5.7. Upgrading MySQL on Windows
 
2838
2.3.7. Upgrading MySQL Server on Microsoft Windows
5098
2839
 
5099
2840
   This section lists some of the steps you should take when
5100
2841
   upgrading MySQL on Windows.
5101
2842
 
5102
 
    1. Review Section 2.4.1, "Upgrading MySQL," for additional
 
2843
    1. Review Section 2.13.1, "Upgrading MySQL," for additional
5103
2844
       information on upgrading MySQL that is not specific to
5104
2845
       Windows.
5105
2846
 
5106
2847
    2. You should always back up your current MySQL installation
5107
 
       before performing an upgrade. See Section 6.1, "Database
 
2848
       before performing an upgrade. See Section 6.2, "Database
5108
2849
       Backup Methods."
5109
2850
 
5110
2851
    3. Download the latest Windows distribution of MySQL from
5114
2855
       server is installed as a service, stop the service with the
5115
2856
       following command from the command prompt:
5116
2857
C:\> NET STOP MySQL
5117
 
       If you are not running the MySQL server as a service, use the
5118
 
       following command to stop it:
5119
 
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root
 
2858
       If you are not running the MySQL server as a service, use
 
2859
       mysqladmin to stop it. For example, before upgrading from
 
2860
       MySQL 5.0 to 5.1, use mysqladmin from MySQL 5.0 as follows:
 
2861
C:\> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqladmin" -u root
5120
2862
 shutdown
5121
 
 
5122
 
Note
 
2863
       Note
5123
2864
       If the MySQL root user account has a password, you need to
5124
2865
       invoke mysqladmin with the -p option and supply the password
5125
2866
       when prompted.
5126
2867
 
5127
 
    5. When upgrading to MySQL 5.1 from a version previous to 4.1.5,
5128
 
       or when upgrading from a version of MySQL installed from a Zip
5129
 
       archive to a version of MySQL installed with the MySQL
5130
 
       Installation Wizard, you must manually remove the previous
 
2868
    5. Before upgrading to MySQL 5.1 from a version previous to
 
2869
       4.1.5, or from a version of MySQL installed from a Zip archive
 
2870
       to a version of MySQL installed with the MySQL Installation
 
2871
       Wizard, you must first manually remove the previous
5131
2872
       installation and MySQL service (if the server is installed as
5132
2873
       a service).
5133
2874
       To remove the MySQL service, use the following command:
5134
2875
C:\> C:\mysql\bin\mysqld --remove
 
2876
       Important
5135
2877
       If you do not remove the existing service, the MySQL
5136
2878
       Installation Wizard may fail to properly install the new MySQL
5137
2879
       service.
5143
2885
       installation to the new location.
5144
2886
 
5145
2887
    7. If you are using the MySQL Installation Wizard, start the
5146
 
       wizard as described in Section 2.5.3.1, "Using the MySQL
5147
 
       Installation Wizard."
 
2888
       wizard as described in Section 2.3.3.1, "Using the MySQL
 
2889
       Installation Wizard for Microsoft Windows."
5148
2890
 
5149
2891
    8. If you are installing MySQL from a Zip archive, extract the
5150
2892
       archive. You may either overwrite your existing MySQL
5154
2896
 
5155
2897
    9. If you were running MySQL as a Windows service and you had to
5156
2898
       remove the service earlier in this procedure, reinstall the
5157
 
       service. (See Section 2.5.5.6, "Starting MySQL as a Windows
5158
 
       Service.")
 
2899
       service. (See Section 2.3.5.7, "Starting MySQL Server as a
 
2900
       Microsoft Windows Service.")
5159
2901
   10. Restart the server. For example, use NET START MySQL if you
5160
2902
       run MySQL as a service, or invoke mysqld directly otherwise.
5161
 
   11. If you encounter errors, see Section 2.5.6, "Troubleshooting a
5162
 
       MySQL Installation Under Windows."
5163
 
 
5164
 
2.5.8. Windows Post-Installation Procedures
5165
 
 
5166
 
   On Windows, the data directory and the grant tables do not have to
5167
 
   be created. MySQL Windows distributions include the grant tables
5168
 
   with a set of preinitialized accounts in the mysql database under
5169
 
   the data directory. It is unnecessary to run the mysql_install_db
5170
 
   script that is used on Unix. Regarding passwords, if you installed
5171
 
   MySQL using the Windows Installation Wizard, you may have already
5172
 
   assigned passwords to the accounts. (See Section 2.5.3.1, "Using
5173
 
   the MySQL Installation Wizard.") Otherwise, use the
5174
 
   password-assignment procedure given in Section 2.13.2, "Securing
 
2903
   11. As Administrator, run mysql_upgrade to check your tables,
 
2904
       attempt to repair them if necessary, and update your grant
 
2905
       tables if they have changed so that you can take advantage of
 
2906
       any new capabilities. See Section 4.4.8, "mysql_upgrade ---
 
2907
       Check Tables for MySQL Upgrade."
 
2908
   12. If you encounter errors, see Section 2.3.6, "Troubleshooting a
 
2909
       Microsoft Windows MySQL Server Installation."
 
2910
 
 
2911
2.3.8. MySQL Server on Microsoft Windows Postinstallation Procedures
 
2912
 
 
2913
   On Windows, you need not create the data directory and the grant
 
2914
   tables. MySQL Windows distributions include the grant tables with
 
2915
   a set of preinitialized accounts in the mysql database under the
 
2916
   data directory. Regarding passwords, if you installed MySQL using
 
2917
   the Windows Installation Wizard, you may have already assigned
 
2918
   passwords to the accounts. (See Section 2.3.3.1, "Using the MySQL
 
2919
   Installation Wizard for Microsoft Windows.") Otherwise, use the
 
2920
   password-assignment procedure given in Section 2.12.2, "Securing
5175
2921
   the Initial MySQL Accounts."
5176
2922
 
5177
2923
   Before setting up passwords, you might want to try running some
5178
2924
   client programs to make sure that you can connect to the server
5179
2925
   and that it is operating properly. Make sure that the server is
5180
 
   running (see Section 2.5.5.4, "Starting the Server for the First
5181
 
   Time"), and then issue the following commands to verify that you
5182
 
   can retrieve information from the server. The output should be
5183
 
   similar to what is shown here:
 
2926
   running (see Section 2.3.5.4, "Starting MySQL Server on Microsoft
 
2927
   Windows for the First Time"), and then issue the following
 
2928
   commands to verify that you can retrieve information from the
 
2929
   server. You may need to specify directory different from
 
2930
   C:\mysql\bin on the command line. If you used the Windows
 
2931
   Installation Wizard, the default directory is C:\Program
 
2932
   Files\MySQL\MySQL Server 5.1, and the mysql and mysqlshow client
 
2933
   programs are in C:\Program Files\MySQL\MySQL Server 5.1\bin. See
 
2934
   Section 2.3.3.1, "Using the MySQL Installation Wizard for
 
2935
   Microsoft Windows," for more information.
 
2936
 
 
2937
   Use mysqlshow to see what databases exist:
5184
2938
C:\> C:\mysql\bin\mysqlshow
5185
2939
+--------------------+
5186
2940
|     Databases      |
5190
2944
| test               |
5191
2945
+--------------------+
5192
2946
 
5193
 
Note
5194
 
 
5195
 
   The above may not work if the correct user does not exist. If you
5196
 
   installed using the MSI packages and used the MySQL Server
5197
 
   Instance Config Wizard, then the root will haqve been created
5198
 
   automatically with the password you supplied. In this case, you
5199
 
   should use the -u and -p options where you will be prompted for
5200
 
   the password.
5201
 
 
5202
 
Note
5203
 
 
5204
2947
   The list of installed databases may vary, but will always include
5205
2948
   the minimum of mysql and information_schema. In most cases, the
5206
2949
   test database will also be installed automatically.
5207
2950
 
5208
 
   If you specify the name of the database, then a list of the tables
5209
 
   within a given database will be displayed:
 
2951
   The preceding command (and commands for other MySQL programs such
 
2952
   as mysql) may not work if the correct MySQL account does not
 
2953
   exist. For example, the program may fail with an error, or you may
 
2954
   not be able to view all databases. If you installed using the MSI
 
2955
   packages and used the MySQL Server Instance Config Wizard, then
 
2956
   the root user will have been created automatically with the
 
2957
   password you supplied. In this case, you should use the -u root
 
2958
   and -p options. (You will also need to use the -u root and -p
 
2959
   options if you have already secured the initial MySQL accounts.)
 
2960
   With -p, you will be prompted for the root password. For example:
 
2961
C:\> C:\mysql\bin\mysqlshow -u root -p
 
2962
Enter password: (enter root password here)
 
2963
+--------------------+
 
2964
|     Databases      |
 
2965
+--------------------+
 
2966
| information_schema |
 
2967
| mysql              |
 
2968
| test               |
 
2969
+--------------------+
 
2970
 
 
2971
   If you specify a database name, mysqlshow displays a list of the
 
2972
   tables within the database:
5210
2973
C:\> C:\mysql\bin\mysqlshow mysql
5211
2974
Database: mysql
5212
2975
+---------------------------+
5216
2979
| db                        |
5217
2980
| event                     |
5218
2981
| func                      |
5219
 
| general_log               |
5220
 
| help_category             |
5221
 
| help_keyword              |
5222
 
| help_relation             |
5223
 
| help_topic                |
5224
 
| host                      |
5225
 
| plugin                    |
5226
 
| proc                      |
5227
 
| procs_priv                |
5228
 
| servers                   |
5229
 
| slow_log                  |
5230
 
| tables_priv               |
5231
 
| time_zone                 |
5232
 
| time_zone_leap_second     |
5233
 
| time_zone_name            |
5234
 
| time_zone_transition      |
5235
 
| time_zone_transition_type |
5236
 
| user                      |
5237
 
+---------------------------+
5238
 
 
5239
 
 
5240
 
C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM db" mysql
5241
 
+------+-------+------+
5242
 
| host | db    | user |
5243
 
+------+-------+------+
5244
 
| %    | test% |      |
5245
 
+------+-------+------+
5246
 
 
5247
 
   You may need to specify a different directory from the one shown;
5248
 
   if you used the Windows Installation Wizard, then the default
5249
 
   directory is C:\Program Files\MySQL\MySQL Server 5.1, and the
5250
 
   mysql and mysqlshow client programs are in C:\Program
5251
 
   Files\MySQL\MySQL Server 5.1\bin. See Section 2.5.3.1, "Using the
5252
 
   MySQL Installation Wizard," for more information.
5253
 
 
5254
 
   If you have already secured the initial MySQL accounts, you may
5255
 
   need to use the -u and -p options to supply a user name and
5256
 
   password to the mysqlshow and mysql client programs; otherwise the
5257
 
   programs may fail with an error, or you may not be able to view
5258
 
   all databases. For example, if you have assigned the password
5259
 
   "secretpass" to the MySQL root account, then you can invoke
5260
 
   mysqlshow and mysql as shown here:
5261
 
C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass
5262
 
+--------------------+
5263
 
|     Databases      |
5264
 
+--------------------+
5265
 
| information_schema |
5266
 
| mysql              |
5267
 
| test               |
5268
 
+--------------------+
5269
 
 
5270
 
C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass mysql
5271
 
Database: mysql
5272
 
+---------------------------+
5273
 
|          Tables           |
5274
 
+---------------------------+
5275
 
| columns_priv              |
5276
 
| db                        |
5277
 
| event                     |
5278
 
| func                      |
5279
 
| general_log               |
5280
 
| help_category             |
5281
 
| help_keyword              |
5282
 
| help_relation             |
5283
 
| help_topic                |
5284
 
| host                      |
5285
 
| plugin                    |
5286
 
| proc                      |
5287
 
| procs_priv                |
5288
 
| servers                   |
5289
 
| slow_log                  |
5290
 
| tables_priv               |
5291
 
| time_zone                 |
5292
 
| time_zone_leap_second     |
5293
 
| time_zone_name            |
5294
 
| time_zone_transition      |
5295
 
| time_zone_transition_type |
5296
 
| user                      |
5297
 
+---------------------------+
5298
 
 
5299
 
 
5300
 
C:\> C:\mysql\bin\mysql -uroot -psecretpass -e "SELECT Host,Db,User F
5301
 
ROM db" mysql
5302
 
+------+-------+------+
5303
 
| host | db    | user |
5304
 
+------+-------+------+
5305
 
| %    | test% |      |
5306
 
+------+-------+------+
5307
 
 
5308
 
   For more information about these programs, see Section 4.5.6,
 
2982
| help_category             |
 
2983
| help_keyword              |
 
2984
| help_relation             |
 
2985
| help_topic                |
 
2986
| host                      |
 
2987
| plugin                    |
 
2988
| proc                      |
 
2989
| procs_priv                |
 
2990
| servers                   |
 
2991
| tables_priv               |
 
2992
| time_zone                 |
 
2993
| time_zone_leap_second     |
 
2994
| time_zone_name            |
 
2995
| time_zone_transition      |
 
2996
| time_zone_transition_type |
 
2997
| user                      |
 
2998
+---------------------------+
 
2999
 
 
3000
   Use the mysql program to select information from a table in the
 
3001
   mysql database:
 
3002
C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM mysql.db"
 
3003
+------+--------+------+
 
3004
| host | db     | user |
 
3005
+------+--------+------+
 
3006
| %    | test   |      |
 
3007
| %    | test_% |      |
 
3008
+------+--------+------+
 
3009
 
 
3010
   For more information about mysqlshow and mysql, see Section 4.5.6,
5309
3011
   "mysqlshow --- Display Database, Table, and Column Information,"
5310
3012
   and Section 4.5.1, "mysql --- The MySQL Command-Line Tool."
5311
3013
 
5312
 
   If you are running a version of Windows that supports services and
5313
 
   you want the MySQL server to run automatically when Windows
5314
 
   starts, see Section 2.5.5.6, "Starting MySQL as a Windows
5315
 
   Service."
5316
 
 
5317
 
2.5.9. MySQL on Windows Compared to MySQL on Unix
5318
 
 
5319
 
   MySQL for Windows has proven itself to be very stable. The Windows
5320
 
   version of MySQL has the same features as the corresponding Unix
5321
 
   version, with the following exceptions:
5322
 
 
5323
 
     * Limited number of ports
5324
 
       Windows systems have about 4,000 ports available for client
5325
 
       connections, and after a connection on a port closes, it takes
5326
 
       two to four minutes before the port can be reused. In
5327
 
       situations where clients connect to and disconnect from the
5328
 
       server at a high rate, it is possible for all available ports
5329
 
       to be used up before closed ports become available again. If
5330
 
       this happens, the MySQL server appears to be unresponsive even
5331
 
       though it is running. Note that ports may be used by other
5332
 
       applications running on the machine as well, in which case the
5333
 
       number of ports available to MySQL is lower.
5334
 
       For more information about this problem, see
5335
 
       http://support.microsoft.com/default.aspx?scid=kb;en-us;196271
5336
 
       .
5337
 
 
5338
 
     * Concurrent reads
5339
 
       MySQL depends on the pread() and pwrite() system calls to be
5340
 
       able to mix INSERT and SELECT. Currently, we use mutexes to
5341
 
       emulate pread() and pwrite(). We intend to replace the file
5342
 
       level interface with a virtual interface in the future so that
5343
 
       we can use the readfile()/writefile() interface to get more
5344
 
       speed. The current implementation limits the number of open
5345
 
       files that MySQL 5.1 can use to 2,048, which means that you
5346
 
       cannot run as many concurrent threads on Windows as on Unix.
5347
 
 
5348
 
     * Blocking read
5349
 
       MySQL uses a blocking read for each connection. That has the
5350
 
       following implications if named-pipe connections are enabled:
5351
 
 
5352
 
          + A connection is not disconnected automatically after
5353
 
            eight hours, as happens with the Unix version of MySQL.
5354
 
 
5355
 
          + If a connection hangs, it is not possible to break it
5356
 
            without killing MySQL.
5357
 
 
5358
 
          + mysqladmin kill does not work on a sleeping connection.
5359
 
 
5360
 
          + mysqladmin shutdown cannot abort as long as there are
5361
 
            sleeping connections.
5362
 
       We plan to fix this problem in the future.
5363
 
 
5364
 
     * ALTER TABLE
5365
 
       While you are executing an ALTER TABLE statement, the table is
5366
 
       locked from being used by other threads. This has to do with
5367
 
       the fact that on Windows, you can't delete a file that is in
5368
 
       use by another thread. In the future, we may find some way to
5369
 
       work around this problem.
5370
 
 
5371
 
     * DATA DIRECTORY and INDEX DIRECTORY
5372
 
       The DATA DIRECTORY and INDEX DIRECTORY options for CREATE
5373
 
       TABLE are ignored on Windows, because Windows doesn't support
5374
 
       symbolic links. These options also are ignored on systems that
5375
 
       have a nonfunctional realpath() call.
5376
 
 
5377
 
     * DROP DATABASE
5378
 
       You cannot drop a database that is in use by another thread.
5379
 
 
5380
 
     * Case-insensitive names
5381
 
       File names are not case sensitive on Windows, so MySQL
5382
 
       database and table names are also not case sensitive on
5383
 
       Windows. The only restriction is that database and table names
5384
 
       must be specified using the same case throughout a given
5385
 
       statement. See Section 8.2.2, "Identifier Case Sensitivity."
5386
 
 
5387
 
     * Directory and file names
5388
 
       On Windows, MySQL Server supports only directory and file
5389
 
       names that are compatible with the current ANSI code pages.
5390
 
       For example, the following Japanese directory name will not
5391
 
       work in the Western locale (code page 1252):
5392
 
datadir="C:/ē»“åŸŗē™¾ē§‘å…³äŗŽäø­ę–‡ē»“åŸŗē™¾ē§‘"
5393
 
       The same limitation applies to directory and file names
5394
 
       referred to in SQL statements, such as the data file path name
5395
 
       in LOAD DATA INFILE.
5396
 
 
5397
 
     * The "\" path name separator character
5398
 
       Path name components in Windows are separated by the "\"
5399
 
       character, which is also the escape character in MySQL. If you
5400
 
       are using LOAD DATA INFILE or SELECT ... INTO OUTFILE, use
5401
 
       Unix-style file names with "/" characters:
5402
 
mysql> LOAD DATA INFILE 'C:/tmp/skr.txt' INTO TABLE skr;
5403
 
mysql> SELECT * INTO OUTFILE 'C:/tmp/skr.txt' FROM skr;
5404
 
       Alternatively, you must double the "\" character:
5405
 
mysql> LOAD DATA INFILE 'C:\\tmp\\skr.txt' INTO TABLE skr;
5406
 
mysql> SELECT * INTO OUTFILE 'C:\\tmp\\skr.txt' FROM skr;
5407
 
 
5408
 
     * Problems with pipes
5409
 
       Pipes do not work reliably from the Windows command-line
5410
 
       prompt. If the pipe includes the character ^Z / CHAR(24),
5411
 
       Windows thinks that it has encountered end-of-file and aborts
5412
 
       the program.
5413
 
       This is mainly a problem when you try to apply a binary log as
5414
 
       follows:
5415
 
C:\> mysqlbinlog binary_log_file | mysql --user=root
5416
 
       If you have a problem applying the log and suspect that it is
5417
 
       because of a ^Z / CHAR(24) character, you can use the
5418
 
       following workaround:
5419
 
C:\> mysqlbinlog binary_log_file --result-file=/tmp/bin.sql
5420
 
C:\> mysql --user=root --execute "source /tmp/bin.sql"
5421
 
       The latter command also can be used to reliably read in any
5422
 
       SQL file that may contain binary data.
5423
 
 
5424
 
     * Access denied for user error
5425
 
       If MySQL cannot resolve your host name properly, you may get
5426
 
       the following error when you attempt to run a MySQL client
5427
 
       program to connect to a server running on the same machine:
5428
 
Access denied for user 'some_user'@'unknown'
5429
 
to database 'mysql'
5430
 
       To fix this problem, you should create a file named
5431
 
       \windows\hosts containing the following information:
5432
 
127.0.0.1       localhost
5433
 
 
5434
 
   Here are some open issues for anyone who might want to help us
5435
 
   improve MySQL on Windows:
5436
 
 
5437
 
     * Add macros to use the faster thread-safe increment/decrement
5438
 
       methods provided by Windows.
5439
 
 
5440
 
2.5.10. Installing MySQL from Source on Windows
5441
 
 
5442
 
   These instructions describe how to build binaries from source for
5443
 
   MySQL 5.1 on Windows. Instructions are provided for building
5444
 
   binaries from a standard source distribution or from the Bazaar
5445
 
   tree that contains the latest development source.
5446
 
 
5447
 
Note
5448
 
 
5449
 
   The instructions here are strictly for users who want to test
5450
 
   MySQL on Microsoft Windows from the latest source distribution or
5451
 
   from the Bazaar tree. For production use, we do not advise using a
5452
 
   MySQL server built by yourself from source. Normally, it is best
5453
 
   to use precompiled binary distributions of MySQL that are built
5454
 
   specifically for optimal performance on Windows by Sun
5455
 
   Microsystems, Inc. Instructions for installing binary
5456
 
   distributions are available in Section 2.5, "Installing MySQL on
5457
 
   Windows."
5458
 
 
5459
 
   To build MySQL on Windows from source, you must satisfy the
5460
 
   following system, compiler, and resource requirements:
5461
 
 
5462
 
     * Windows 2000, Windows XP, or newer version.
5463
 
       Windows Vista is supported when using Visual Studio 2005
5464
 
       provided you have installed the following updates:
5465
 
 
5466
 
          + Microsoft Visual Studio 2005 Professional Edition - ENU
5467
 
            Service Pack 1 (KB926601)
5468
 
            (http://support.microsoft.com/?kbid=926601)
5469
 
 
5470
 
          + Security Update for Microsoft Visual Studio 2005
5471
 
            Professional Edition - ENU (KB937061)
5472
 
            (http://support.microsoft.com/?kbid=937061)
5473
 
 
5474
 
          + Update for Microsoft Visual Studio 2005 Professional
5475
 
            Edition - ENU (KB932232)
5476
 
            (http://support.microsoft.com/?kbid=932232)
5477
 
 
5478
 
     * CMake, which can be downloaded from http://www.cmake.org.
5479
 
       After installing, modify your path to include the cmake
5480
 
       binary.
5481
 
 
5482
 
     * Microsoft Visual C++ 2005 Express Edition, Visual Studio .Net
5483
 
       2003 (7.1), or Visual Studio 2005 (8.0) compiler system.
5484
 
 
5485
 
     * If you are using Visual C++ 2005 Express Edition, you must
5486
 
       also install an appropriate Platform SDK. More information and
5487
 
       links to downloads for various Windows platforms is available
5488
 
       from
5489
 
       http://www.microsoft.com/downloads/details.aspx?familyid=0baf2
5490
 
       b35-c656-4969-ace8-e4c0c0716adb.
5491
 
 
5492
 
     * If you are compiling from a Bazaar tree or making changes to
5493
 
       the parser, you need bison for Windows, which can be
5494
 
       downloaded from
5495
 
       http://gnuwin32.sourceforge.net/packages/bison.htm. Download
5496
 
       the package labeled "Complete package, excluding sources".
5497
 
       After installing the package, modify your path to include the
5498
 
       bison binary and ensure that this binary is accessible from
5499
 
       Visual Studio.
5500
 
 
5501
 
     * Cygwin might be necessary if you want to run the test script
5502
 
       or package the compiled binaries and support files into a Zip
5503
 
       archive. (Cygwin is needed only to test or package the
5504
 
       distribution, not to build it.) Cygwin is available from
5505
 
       http://cygwin.com.
5506
 
 
5507
 
     * 3GB to 5GB of disk space.
5508
 
 
5509
 
   The exact system requirements for Visual Studio can be found here:
5510
 
   http://msdn.microsoft.com/vstudio/Previous/2003/sysreqs/default.as
5511
 
   px and
5512
 
   http://msdn.microsoft.com/vstudio/products/sysreqs/default.aspx
5513
 
 
5514
 
   You also need a MySQL source distribution for Windows, which can
5515
 
   be obtained two ways:
5516
 
 
5517
 
     * Obtain a source distribution packaged by Sun Microsystems,
5518
 
       Inc. These are available from http://dev.mysql.com/downloads/.
5519
 
 
5520
 
     * Package a source distribution yourself from the latest Bazaar
5521
 
       developer source tree. For instructions on pulling the latest
5522
 
       source files, see Section 2.3.3, "Installing from the
5523
 
       Development Source Tree."
5524
 
 
5525
 
   If you find something not working as expected, or you have
5526
 
   suggestions about ways to improve the current build process on
5527
 
   Windows, please send a message to the win32 mailing list. See
5528
 
   Section 1.5.1, "MySQL Mailing Lists."
5529
 
 
5530
 
2.5.10.1. Building MySQL from Source Using CMake and Visual Studio
5531
 
 
5532
 
   You can build MySQL on Windows by using a combination of cmake and
5533
 
   Microsoft Visual Studio .NET 2003 (7.1), Microsoft Visual Studio
5534
 
   2005 (8.0) or Microsoft Visual C++ 2005 Express Edition. You must
5535
 
   have the appropriate Microsoft Platform SDK installed.
5536
 
 
5537
 
Note
5538
 
 
5539
 
   To compile from the source code on Windows you must use the
5540
 
   standard source distribution (for example, mysql-5.1.41.tar.gz).
5541
 
   You build from the same distribution as used to build MySQL on
5542
 
   Unix, Linux and other platforms. Do not use the Windows Source
5543
 
   distributions as they do not contain the necessary configuration
5544
 
   script and other files.
5545
 
 
5546
 
   Follow this procedure to build MySQL:
5547
 
 
5548
 
    1. If you are installing from a packaged source distribution,
5549
 
       create a work directory (for example, C:\workdir), and unpack
5550
 
       the source distribution there using WinZip or another Windows
5551
 
       tool that can read .zip files. This directory is the work
5552
 
       directory in the following instructions.
5553
 
 
5554
 
    2. Using a command shell, navigate to the work directory and run
5555
 
       the following command:
5556
 
C:\workdir>win\configure.js options
5557
 
       If you have associated the .js file extension with an
5558
 
       application such as a text editor, then you may need to use
5559
 
       the following command to force configure.js to be executed as
5560
 
       a script:
5561
 
C:\workdir>cscript win\configure.js options
5562
 
       These options are available for configure.js:
5563
 
 
5564
 
          + WITH_INNOBASE_STORAGE_ENGINE: Enable the InnoDB storage
5565
 
            engine.
5566
 
 
5567
 
          + WITH_PARTITION_STORAGE_ENGINE: Enable user-defined
5568
 
            partitioning.
5569
 
 
5570
 
          + WITH_ARCHIVE_STORAGE_ENGINE: Enable the ARCHIVE storage
5571
 
            engine.
5572
 
 
5573
 
          + WITH_BLACKHOLE_STORAGE_ENGINE: Enable the BLACKHOLE
5574
 
            storage engine.
5575
 
 
5576
 
          + WITH_EXAMPLE_STORAGE_ENGINE: Enable the EXAMPLE storage
5577
 
            engine.
5578
 
 
5579
 
          + WITH_FEDERATED_STORAGE_ENGINE: Enable the FEDERATED
5580
 
            storage engine.
5581
 
 
5582
 
          + WITH_NDBCLUSTER_STORAGE_ENGINE (experimental): Enable the
5583
 
            NDBCLUSTER storage engine in the MySQL server; cause
5584
 
            binaries for the MySQL Cluster management and data node,
5585
 
            management client, and other programs to be built.
5586
 
            This option is supported only in MySQL Cluster NDB 7.0
5587
 
            (NDBCLUSTER storage engine versions 6.4.0 and later)
5588
 
            using the MySQL Cluster sources. It cannot be used to
5589
 
            enable clustering support in other MySQL source trees or
5590
 
            distributions.
5591
 
 
5592
 
          + MYSQL_SERVER_SUFFIX=suffix: Server suffix, default none.
5593
 
 
5594
 
          + COMPILATION_COMMENT=comment: Server comment, default
5595
 
            "Source distribution".
5596
 
 
5597
 
          + MYSQL_TCP_PORT=port: Server port, default 3306.
5598
 
 
5599
 
          + DISABLE_GRANT_OPTIONS: Disables the --bootstrap,
5600
 
            --skip-grant-tables, and --init-file options for mysqld.
5601
 
            This option is available as of MySQL 5.1.15.
5602
 
       For example (type the command on one line):
5603
 
C:\workdir>win\configure.js WITH_INNOBASE_STORAGE_ENGINE
5604
 
             WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro
5605
 
 
5606
 
    3. From the work directory, execute the win\build-vs8.bat or
5607
 
       win\build-vs71.bat file, depending on the version of Visual
5608
 
       Studio you have installed. The script invokes CMake, which
5609
 
       generates the mysql.sln solution file.
5610
 
       You can also use win\build-vs8_x64.bat to build the 64-bit
5611
 
       version of MySQL. However, you cannot build the 64-bit version
5612
 
       with Visual Studio Express Edition. You must use Visual Studio
5613
 
       2005 (8.0) or higher.
5614
 
 
5615
 
    4. From the work directory, open the generated mysql.sln file
5616
 
       with Visual Studio and select the proper configuration using
5617
 
       the Configuration menu. The menu provides Debug, Release,
5618
 
       RelwithDebInfo, MinRelInfo options. Then select Solution >
5619
 
       Build to build the solution.
5620
 
       Remember the configuration that you use in this step. It is
5621
 
       important later when you run the test script because that
5622
 
       script needs to know which configuration you used.
5623
 
 
5624
 
    5. Test the server. The server built using the preceding
5625
 
       instructions expects that the MySQL base directory and data
5626
 
       directory are C:\mysql and C:\mysql\data by default. If you
5627
 
       want to test your server using the source tree root directory
5628
 
       and its data directory as the base directory and data
5629
 
       directory, you need to tell the server their path names. You
5630
 
       can either do this on the command line with the --basedir and
5631
 
       --datadir options, or by placing appropriate options in an
5632
 
       option file. (See Section 4.2.3.3, "Using Option Files.") If
5633
 
       you have an existing data directory elsewhere that you want to
5634
 
       use, you can specify its path name instead.
5635
 
       When the server is running in standalone fashion or as a
5636
 
       service based on your configuration, try to connect to it from
5637
 
       the mysql interactive command-line utility.
5638
 
       You can also run the standard test script, mysql-test-run.pl.
5639
 
       This script is written in Perl, so you'll need either Cygwin
5640
 
       or ActiveState Perl to run it. You may also need to install
5641
 
       the modules required by the script. To run the test script,
5642
 
       change location into the mysql-test directory under the work
5643
 
       directory, set the MTR_VS_CONFIG environment variable to the
5644
 
       configuration you selected earlier (or use the --vs-config
5645
 
       option), and invoke mysql-test-run.pl. For example (using
5646
 
       Cygwin and the bash shell):
5647
 
shell> cd mysql-test
5648
 
shell> export MTR_VS_CONFIG=debug
5649
 
shell> ./mysql-test-run.pl --force --timer
5650
 
shell> ./mysql-test-run.pl --force --timer --ps-protocol
5651
 
 
5652
 
   When you are satisfied that the programs you have built are
5653
 
   working correctly, stop the server. Now you can install the
5654
 
   distribution. One way to do this is to use the make_win_bin_dist
5655
 
   script in the scripts directory of the MySQL source distribution
5656
 
   (see Section 4.4.2, "make_win_bin_dist --- Package MySQL
5657
 
   Distribution as ZIP Archive"). This is a shell script, so you must
5658
 
   have Cygwin installed if you want to use it. It creates a Zip
5659
 
   archive of the built executables and support files that you can
5660
 
   unpack in the location at which you want to install MySQL.
5661
 
 
5662
 
   It is also possible to install MySQL by copying directories and
5663
 
   files directly:
5664
 
 
5665
 
    1. Create the directories where you want to install MySQL. For
5666
 
       example, to install into C:\mysql, use these commands:
5667
 
C:\> mkdir C:\mysql
5668
 
C:\> mkdir C:\mysql\bin
5669
 
C:\> mkdir C:\mysql\data
5670
 
C:\> mkdir C:\mysql\share
5671
 
C:\> mkdir C:\mysql\scripts
5672
 
       If you want to compile other clients and link them to MySQL,
5673
 
       you should also create several additional directories:
5674
 
C:\> mkdir C:\mysql\include
5675
 
C:\> mkdir C:\mysql\lib
5676
 
C:\> mkdir C:\mysql\lib\debug
5677
 
C:\> mkdir C:\mysql\lib\opt
5678
 
       If you want to benchmark MySQL, create this directory:
5679
 
C:\> mkdir C:\mysql\sql-bench
5680
 
       Benchmarking requires Perl support. See Section 2.15, "Perl
5681
 
       Installation Notes."
5682
 
 
5683
 
    2. From the work directory, copy into the C:\mysql directory the
5684
 
       following directories:
5685
 
C:\> cd \workdir
5686
 
C:\workdir> copy client_release\*.exe C:\mysql\bin
5687
 
C:\workdir> copy client_debug\mysqld.exe C:\mysql\bin\mysqld-debug.ex
5688
 
e
5689
 
C:\workdir> xcopy scripts\*.* C:\mysql\scripts /E
5690
 
C:\workdir> xcopy share\*.* C:\mysql\share /E
5691
 
       If you want to compile other clients and link them to MySQL,
5692
 
       you should also copy several libraries and header files:
5693
 
C:\workdir> copy lib_debug\mysqlclient.lib C:\mysql\lib\debug
5694
 
C:\workdir> copy lib_debug\libmysql.* C:\mysql\lib\debug
5695
 
C:\workdir> copy lib_debug\zlib.* C:\mysql\lib\debug
5696
 
C:\workdir> copy lib_release\mysqlclient.lib C:\mysql\lib\opt
5697
 
C:\workdir> copy lib_release\libmysql.* C:\mysql\lib\opt
5698
 
C:\workdir> copy lib_release\zlib.* C:\mysql\lib\opt
5699
 
C:\workdir> copy include\*.h C:\mysql\include
5700
 
C:\workdir> copy libmysql\libmysql.def C:\mysql\include
5701
 
       If you want to benchmark MySQL, you should also do this:
5702
 
C:\workdir> xcopy sql-bench\*.* C:\mysql\bench /E
5703
 
 
5704
 
   After installation, set up and start the server in the same way as
5705
 
   for binary Windows distributions. See Section 2.5, "Installing
5706
 
   MySQL on Windows."
5707
 
 
5708
 
2.5.11. Compiling MySQL Clients on Windows
5709
 
 
5710
 
   In your source files, you should include my_global.h before
5711
 
   mysql.h:
5712
 
#include <my_global.h>
5713
 
#include <mysql.h>
5714
 
 
5715
 
   my_global.h includes any other files needed for Windows
5716
 
   compatibility (such as windows.h) if you compile your program on
5717
 
   Windows.
5718
 
 
5719
 
   You can either link your code with the dynamic libmysql.lib
5720
 
   library, which is just a wrapper to load in libmysql.dll on
5721
 
   demand, or link with the static mysqlclient.lib library.
5722
 
 
5723
 
   The MySQL client libraries are compiled as threaded libraries, so
5724
 
   you should also compile your code to be multi-threaded.
5725
 
 
5726
 
2.6. Installing MySQL on Linux
5727
 
 
5728
 
   The following sections covers the installation of Linux using
5729
 
   RPMs. For information on using a generic binary package using tar,
5730
 
   see Section 2.2, "Installing MySQL from Generic Binaries on
5731
 
   Unix/Linux." For information on installing from source, see
5732
 
   Section 2.3, "MySQL Installation Using a Source Distribution."
5733
 
 
5734
 
   mysql.server can be found in the support-files directory under the
5735
 
   MySQL installation directory or in a MySQL source tree. You can
5736
 
   install it as /etc/init.d/mysql for automatic MySQL startup and
5737
 
   shutdown. See Section 2.13.1.2, "Starting and Stopping MySQL
5738
 
   Automatically."
5739
 
 
5740
 
2.6.1. Installing MySQL from RPM Packages on Linux
5741
 
 
5742
 
   The recommended way to install MySQL on RPM-based Linux
5743
 
   distributions is by using the RPM packages. The RPMs that we
5744
 
   provide to the community should work on all versions of Linux that
5745
 
   support RPM packages and use glibc 2.3. To obtain RPM packages,
5746
 
   see Section 2.1.3, "How to Get MySQL."
5747
 
 
5748
 
   For non-RPM Linux distributions, you can install MySQL using a
5749
 
   .tar.gz package. See Section 2.2, "Installing MySQL from Generic
5750
 
   Binaries on Unix/Linux."
5751
 
 
5752
 
   We do provide some platform-specific RPMs; the difference between
5753
 
   a platform-specific RPM and a generic RPM is that a
5754
 
   platform-specific RPM is built on the targeted platform and is
5755
 
   linked dynamically whereas a generic RPM is linked statically with
5756
 
   LinuxThreads.
5757
 
 
5758
 
Note
5759
 
 
5760
 
   RPM distributions of MySQL often are provided by other vendors. Be
5761
 
   aware that they may differ in features and capabilities from those
5762
 
   built by us, and that the instructions in this manual do not
5763
 
   necessarily apply to installing them. The vendor's instructions
5764
 
   should be consulted instead.
5765
 
 
5766
 
   In most cases, you need to install only the MySQL-server and
5767
 
   MySQL-client packages to get a functional MySQL installation. The
5768
 
   other packages are not required for a standard installation.
5769
 
 
5770
 
   RPMs for MySQL Cluster.  Beginning with MySQL 5.1.24, standard
5771
 
   MySQL server RPMs built by MySQL no longer provide support for the
5772
 
   NDBCLUSTER storage engine. MySQL Cluster users wanting to upgrade
5773
 
   MySQL 5.1.23 or earlier installations from RPMs built by MySQL
5774
 
   should upgrade to MySQL Cluster NDB 6.2 or MySQL Cluster NDB 6.3;
5775
 
   RPMs that should work with most Linux distributions are available
5776
 
   for both of these release series.
5777
 
 
5778
 
Important
5779
 
 
5780
 
   When upgrading a MySQL Cluster RPM installation, you must upgrade
5781
 
   all installed RPMs, including the Server and Client RPMs.
5782
 
 
5783
 
   For more information about installing MySQL Cluster from RPMs, see
5784
 
   Section 17.2.1, "MySQL Cluster Multi-Computer Installation."
5785
 
 
5786
 
   For upgrades, if your installation was originally produced by
5787
 
   installing multiple RPM packages, it is best to upgrade all the
5788
 
   packages, not just some. For example, if you previously installed
5789
 
   the server and client RPMs, do not upgrade just the server RPM.
5790
 
 
5791
 
   The RPM packages shown in the following list are available. The
5792
 
   names shown here use a suffix of .glibc23.i386.rpm, but particular
5793
 
   packages can have different suffixes, described later.
5794
 
 
5795
 
     * MySQL-server-VERSION.glibc23.i386.rpm
5796
 
       The MySQL server. You need this unless you only want to
5797
 
       connect to a MySQL server running on another machine.
5798
 
 
5799
 
     * MySQL-client-VERSION.glibc23.i386.rpm
5800
 
       The standard MySQL client programs. You probably always want
5801
 
       to install this package.
5802
 
 
5803
 
     * MySQL-devel-VERSION.glibc23.i386.rpm
5804
 
       The libraries and include files that are needed if you want to
5805
 
       compile other MySQL clients, such as the Perl modules.
5806
 
 
5807
 
     * MySQL-debuginfo-VERSION.glibc23.i386.rpm
5808
 
       This package contains debugging information. debuginfo RPMs
5809
 
       are never needed to use MySQL software; this is true both for
5810
 
       the server and for client programs. However, they contain
5811
 
       additional information that might be needed by a debugger to
5812
 
       analyze a crash.
5813
 
 
5814
 
     * MySQL-shared-VERSION.glibc23.i386.rpm
5815
 
       This package contains the shared libraries
5816
 
       (libmysqlclient.so*) that certain languages and applications
5817
 
       need to dynamically load and use MySQL. It contains
5818
 
       single-threaded and thread-safe libraries. If you install this
5819
 
       package, do not install the MySQL-shared-compat package.
5820
 
 
5821
 
     * MySQL-shared-compat-VERSION.glibc23.i386.rpm
5822
 
       This package includes the shared libraries for MySQL 3.23,
5823
 
       4.0, and so on, up to the current release. It contains
5824
 
       single-threaded and thread-safe libraries. Install this
5825
 
       package instead of MySQL-shared if you have applications
5826
 
       installed that are dynamically linked against older versions
5827
 
       of MySQL but you want to upgrade to the current version
5828
 
       without breaking the library dependencies.
5829
 
 
5830
 
     * MySQL-shared-compat-advanced-gpl-VERSION.glibc23.i386.rpm,
5831
 
       MySQL-shared-compat-advanced-VERSION.glibc23.i386.rpm
5832
 
       These are like the MySQL-shared-compat package, but are for
5833
 
       the "MySQL Enterprise Server - Advanced Edition" products.
5834
 
       Install these packages rather than the normal
5835
 
       MySQL-shared-compat package if you want to included shared
5836
 
       client libraries for older MySQL versions.
5837
 
 
5838
 
     * MySQL-embedded-VERSION.glibc23.i386.rpm
5839
 
       The embedded MySQL server library.
5840
 
 
5841
 
     * MySQL-ndb-management-VERSION.glibc23.i386.rpm,
5842
 
       MySQL-ndb-storage-VERSION.glibc23.i386.rpm,
5843
 
       MySQL-ndb-tools-VERSION.glibc23.i386.rpm,
5844
 
       MySQL-ndb-extra-VERSION.glibc23.i386.rpm
5845
 
       Packages that contain additional files for MySQL Cluster
5846
 
       installations.
5847
 
 
5848
 
Note
5849
 
       The MySQL-ndb-tools RPM requires a working installation of
5850
 
       perl. Prior to MySQL 5.1.18, the DBI and HTML::Template
5851
 
       packages were also required. See Section 2.15, "Perl
5852
 
       Installation Notes," and Section 17.4.21, "ndb_size.pl ---
5853
 
       NDBCLUSTER Size Requirement Estimator," for more information.
5854
 
 
5855
 
     * MySQL-test-VERSION.glibc23.i386.rpm
5856
 
       This package includes the MySQL test suite.
5857
 
 
5858
 
     * MySQL-VERSION.src.rpm
5859
 
       This contains the source code for all of the previous
5860
 
       packages. It can also be used to rebuild the RPMs on other
5861
 
       architectures (for example, Alpha or SPARC).
5862
 
 
5863
 
   The suffix of RPM package names (following the VERSION value) has
5864
 
   the following syntax:
5865
 
.PLATFORM.CPU.rpm
5866
 
 
5867
 
   The PLATFORM and CPU values indicate the type of system for which
5868
 
   the package is built. PLATFORM indicates the platform and CPU
5869
 
   indicates the processor type or family.
5870
 
 
5871
 
   All packages are dynamically linked against glibc 2.3. The
5872
 
   PLATFORM value indicates whether the package is platform
5873
 
   independent or intended for a specific platform, as shown in the
5874
 
   following table.
5875
 
   glibc23 Platform independent, should run on any Linux distribution
5876
 
   that supports glibc 2.3
5877
 
   rhel3, rhel4 Red Hat Enterprise Linux 3 or 4
5878
 
   sles9, sles10 SuSE Linux Enterprise Server 9 or 10
5879
 
 
5880
 
   In MySQL 5.1, only glibc23 packages are available currently.
5881
 
 
5882
 
   The CPU value indicates the processor type or family for which the
5883
 
   package is built.
5884
 
   i386   x86 processor, 386 and up
5885
 
   i586   x86 processor, Pentium and up
5886
 
   x86_64 64-bit x86 processor
5887
 
   ia64   Itanium (IA-64) processor
5888
 
 
5889
 
   To see all files in an RPM package (for example, a MySQL-server
5890
 
   RPM), run a command like this:
5891
 
shell> rpm -qpl MySQL-server-VERSION.glibc23.i386.rpm
5892
 
 
5893
 
   To perform a standard minimal installation, install the server and
5894
 
   client RPMs:
5895
 
shell> rpm -i MySQL-server-VERSION.glibc23.i386.rpm
5896
 
shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
5897
 
 
5898
 
   To install only the client programs, install just the client RPM:
5899
 
shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
5900
 
 
5901
 
   RPM provides a feature to verify the integrity and authenticity of
5902
 
   packages before installing them. If you would like to learn more
5903
 
   about this feature, see Section 2.1.4, "Verifying Package
5904
 
   Integrity Using MD5 Checksums or GnuPG."
5905
 
 
5906
 
   The server RPM places data under the /var/lib/mysql directory. The
5907
 
   RPM also creates a login account for a user named mysql (if one
5908
 
   does not exist) to use for running the MySQL server, and creates
5909
 
   the appropriate entries in /etc/init.d/ to start the server
5910
 
   automatically at boot time. (This means that if you have performed
5911
 
   a previous installation and have made changes to its startup
5912
 
   script, you may want to make a copy of the script so that you
5913
 
   don't lose it when you install a newer RPM.) See Section 2.13.1.2,
5914
 
   "Starting and Stopping MySQL Automatically," for more information
5915
 
   on how MySQL can be started automatically on system startup.
5916
 
 
5917
 
   If you want to install the MySQL RPM on older Linux distributions
5918
 
   that do not support initialization scripts in /etc/init.d
5919
 
   (directly or via a symlink), you should create a symbolic link
5920
 
   that points to the location where your initialization scripts
5921
 
   actually are installed. For example, if that location is
5922
 
   /etc/rc.d/init.d, use these commands before installing the RPM to
5923
 
   create /etc/init.d as a symbolic link that points there:
5924
 
shell> cd /etc
5925
 
shell> ln -s rc.d/init.d .
5926
 
 
5927
 
   However, all current major Linux distributions should support the
5928
 
   new directory layout that uses /etc/init.d, because it is required
5929
 
   for LSB (Linux Standard Base) compliance.
5930
 
 
5931
 
   If the RPM files that you install include MySQL-server, the mysqld
5932
 
   server should be up and running after installation. You should be
5933
 
   able to start using MySQL.
5934
 
 
5935
 
   If something goes wrong, you can find more information in the
5936
 
   binary installation section. See Section 2.2, "Installing MySQL
5937
 
   from Generic Binaries on Unix/Linux."
5938
 
 
5939
 
Note
5940
 
 
5941
 
   The accounts that are listed in the MySQL grant tables initially
5942
 
   have no passwords. After starting the server, you should set up
5943
 
   passwords for them using the instructions in Section 2.13,
5944
 
   "Post-Installation Setup and Testing."
5945
 
 
5946
 
   During RPM installation, a user named mysql and a group named
5947
 
   mysql are created on the system. This is done using the useradd,
5948
 
   groupadd, and usermod commands. Those commands require appropriate
5949
 
   administrative privileges, which is ensured for locally managed
5950
 
   users and groups (as listed in the /etc/passwd and /etc/group
5951
 
   files) by the RPM installation process being run by root.
5952
 
 
5953
 
   For nonlocal user management (LDAP, NIS, and so forth), the
5954
 
   administrative tools may require additional authentication (such
5955
 
   as a password), and will fail if the installing user does not
5956
 
   provide this authentication. Even if they fail, the RPM
5957
 
   installation will not abort but succeed, and this is intentional.
5958
 
   If they failed, some of the intended transfer of ownership may be
5959
 
   missing, and it is recommended that the system administrator then
5960
 
   manually ensures some appropriate user andgroup exists and
5961
 
   manually transfers ownership following the actions in the RPM spec
5962
 
   file.
5963
 
 
5964
 
2.7. Installing MySQL on Mac OS X
 
3014
   If you are running a version of Windows that supports services,
 
3015
   you can set up the MySQL server to run automatically when Windows
 
3016
   starts. See Section 2.3.5.7, "Starting MySQL Server as a Microsoft
 
3017
   Windows Service."
 
3018
 
 
3019
2.4. Installing MySQL on Mac OS X
5965
3020
 
5966
3021
   MySQL for Mac OS X is available in a number of different forms:
5967
3022
 
5968
3023
     * Native Package Installer format, which uses the native Mac OS
5969
3024
       X installer to walk you through the installation of MySQL. For
5970
 
       more information, see Section 2.7.1, "Installing MySQL Using
5971
 
       the Installation Package." You can use the package installer
5972
 
       with Mac OS X 10.3 and later, and available for both PowerPC
5973
 
       and Intel architectures, and both 32-bit and 64-bit
 
3025
       more information, see Section 2.4.2, "Installing MySQL on Mac
 
3026
       OS X Using Native Packages." You can use the package installer
 
3027
       with Mac OS X 10.3 and later, and the package is available for
 
3028
       both PowerPC and Intel architectures, and 32-bit and 64-bit
5974
3029
       architectures. There is no Universal Binary available using
5975
3030
       the package installation method. The user you use to perform
5976
3031
       the installation must have administrator privileges.
5988
3043
       A Universal Binary, incorporating both Power PC and Intel
5989
3044
       architectures and 32-bit and 64-bit binaries is available.
5990
3045
       In addition to the core installation, the Package Installer
5991
 
       also includes Section 2.7.2, "Installing the MySQL Startup
5992
 
       Item" and Section 2.7.3, "Installing and Using the MySQL
 
3046
       also includes Section 2.4.3, "Installing the MySQL Startup
 
3047
       Item" and Section 2.4.4, "Installing and Using the MySQL
5993
3048
       Preference Pane," both of which simplify the management of
5994
3049
       your installation.
5995
3050
 
5997
3052
       you want to use a more recent version than that supplied with
5998
3053
       the Mac OS X server release, you can make use of the package
5999
3054
       or tar formats. For more information on using the MySQL
6000
 
       bundled with Mac OS X, see Section 2.7.4, "Using MySQL on Mac
6001
 
       OS X Server."
 
3055
       bundled with Mac OS X, see Section 2.4.5, "Using the Bundled
 
3056
       MySQL on Mac OS X Server."
6002
3057
 
6003
3058
   For additional information on using MySQL on Mac OS X, see Section
6004
 
   2.7.5, "MySQL Installation on Mac OS X Notes."
6005
 
 
6006
 
2.7.1. Installing MySQL Using the Installation Package
 
3059
   2.4.1, "General Notes on Installing MySQL on Mac OS X."
 
3060
 
 
3061
2.4.1. General Notes on Installing MySQL on Mac OS X
 
3062
 
 
3063
   You should keep the following issues and notes in mind:
 
3064
 
 
3065
     * The default location for the MySQL Unix socket is different on
 
3066
       Mac OS X and Mac OS X Server depending on the installation
 
3067
       type you chose. The following table shows the default
 
3068
       locations by installation type.
 
3069
       Table 2.11. MySQL Unix Socket Locations on Mac OS X by
 
3070
       Installation Type
 
3071
 
 
3072
               Installation Type             Socket Location
 
3073
       Package Installer from MySQL       /tmp/mysql.sock
 
3074
       Tarball from MySQL                 /tmp/mysql.sock
 
3075
       MySQL Bundled with Mac OS X Server /var/mysql/mysql.sock
 
3076
       To prevent issues, you should either change the configuration
 
3077
       of the socket used within your application (for example,
 
3078
       changing php.ini), or you should configure the socket location
 
3079
       using a MySQL configuration file and the socket option. For
 
3080
       more information, see Section 5.1.2, "Server Command Options."
 
3081
 
 
3082
     * You may need (or want) to create a specific mysql user to own
 
3083
       the MySQL directory and data. On Mac OS X 10.4 and lower you
 
3084
       can do this by using the Netinfo Manager application, located
 
3085
       within the Utilities folder within the Applications folder. On
 
3086
       Mac OS X 10.5 and later you can do this through the Directory
 
3087
       Utility. From Mac OS X 10.5 and later (including Mac OS X
 
3088
       Server 10.5) the mysql should already exist. For use in single
 
3089
       user mode, an entry for _mysql (note the underscore prefix)
 
3090
       should already exist within the system /etc/passwd file.
 
3091
 
 
3092
     * Due to a bug in the Mac OS X package installer, you may see
 
3093
       this error message in the destination disk selection dialog:
 
3094
You cannot install this software on this disk. (null)
 
3095
       If this error occurs, click the Go Back button once to return
 
3096
       to the previous screen. Then click Continue to advance to the
 
3097
       destination disk selection again, and you should be able to
 
3098
       choose the destination disk correctly. We have reported this
 
3099
       bug to Apple and it is investigating this problem.
 
3100
 
 
3101
     * Because the MySQL package installer installs the MySQL
 
3102
       contents into a version and platform specific directory, you
 
3103
       can use this to upgrade and migrate your database between
 
3104
       versions. You will need to either copy the data directory from
 
3105
       the old version to the new version, or alternatively specify
 
3106
       an alternative datadir value to set location of the data
 
3107
       directory.
 
3108
 
 
3109
     * You might want to add aliases to your shell's resource file to
 
3110
       make it easier to access commonly used programs such as mysql
 
3111
       and mysqladmin from the command line. The syntax for bash is:
 
3112
alias mysql=/usr/local/mysql/bin/mysql
 
3113
alias mysqladmin=/usr/local/mysql/bin/mysqladmin
 
3114
       For tcsh, use:
 
3115
alias mysql /usr/local/mysql/bin/mysql
 
3116
alias mysqladmin /usr/local/mysql/bin/mysqladmin
 
3117
       Even better, add /usr/local/mysql/bin to your PATH environment
 
3118
       variable. You can do this by modifying the appropriate startup
 
3119
       file for your shell. For more information, see Section 4.2.1,
 
3120
       "Invoking MySQL Programs."
 
3121
 
 
3122
     * After you have copied over the MySQL database files from the
 
3123
       previous installation and have successfully started the new
 
3124
       server, you should consider removing the old installation
 
3125
       files to save disk space. Additionally, you should also remove
 
3126
       older versions of the Package Receipt directories located in
 
3127
       /Library/Receipts/mysql-VERSION.pkg.
 
3128
 
 
3129
2.4.2. Installing MySQL on Mac OS X Using Native Packages
6007
3130
 
6008
3131
   You can install MySQL on Mac OS X 10.3.x ("Panther") or newer
6009
3132
   using a Mac OS X binary package in PKG format instead of the
6014
3137
   The package is located inside a disk image (.dmg) file that you
6015
3138
   first need to mount by double-clicking its icon in the Finder. It
6016
3139
   should then mount the image and display its contents.
6017
 
 
6018
 
Note
6019
 
 
6020
 
   Before proceeding with the installation, be sure to shut down all
6021
 
   running MySQL server instances by either using the MySQL Manager
6022
 
   Application (on Mac OS X Server) or via mysqladmin shutdown on the
 
3140
   Note
 
3141
 
 
3142
   Before proceeding with the installation, be sure to stop all
 
3143
   running MySQL server instances by using either the MySQL Manager
 
3144
   Application (on Mac OS X Server) or mysqladmin shutdown on the
6023
3145
   command line.
6024
3146
 
6025
3147
   When installing from the package version, you should also install
6026
 
   the MySQL Preference Pane, which will allow you to control the
 
3148
   the MySQL Preference Pane, which will enable you to control the
6027
3149
   startup and execution of your MySQL server from System
6028
 
   Preferences. For more information, see Section 2.7.3, "Installing
 
3150
   Preferences. For more information, see Section 2.4.4, "Installing
6029
3151
   and Using the MySQL Preference Pane."
6030
3152
 
6031
3153
   When installing using the package installer, the files are
6032
3154
   installed into a directory within /usr/local matching the name of
6033
3155
   the installation version and platform. For example, the installer
6034
3156
   file mysql-5.1.39-osx10.5-x86_64.pkg installs MySQL into
6035
 
   /usr/local/mysql-5.1.39-osx10.5-x86_64 . The installation layout
6036
 
   of the directory is as shown in the following table:
6037
 
   Directory       Contents of Directory
6038
 
   bin             Client programs and the mysqld server
6039
 
   data            Log files, databases
6040
 
   docs            Manual in Info format
6041
 
   include         Include (header) files
6042
 
   lib             Libraries
6043
 
   man             Unix manual pages
6044
 
   mysql-test      MySQL test suite
6045
 
   scripts         Contains the mysql_install_db script
6046
 
   share/mysql     Error message files
6047
 
   sql-bench       Benchmarks
6048
 
   support-files   Scripts and sample configuration files
6049
 
   /tmp/mysql.sock The location of the MySQL Unix socket
 
3157
   /usr/local/mysql-5.1.39-osx10.5-x86_64 . The following table shows
 
3158
   the layout of the installation directory.
 
3159
 
 
3160
   Table 2.12. MySQL Installation Layout on Mac OS X
 
3161
   Directory Contents of Directory
 
3162
   bin Client programs and the mysqld server
 
3163
   data Log files, databases
 
3164
   docs Manual in Info format
 
3165
   include Include (header) files
 
3166
   lib Libraries
 
3167
   man Unix manual pages
 
3168
   mysql-test MySQL test suite
 
3169
   scripts mysql_install_db
 
3170
   share Miscellaneous support files, including error messages,
 
3171
   sample configuration files, SQL for database installation
 
3172
   sql-bench Benchmarks
 
3173
   support-files Scripts and sample configuration files
 
3174
   /tmp/mysql.sock Location of the MySQL Unix socket
6050
3175
 
6051
3176
   During the package installer process, a symbolic link from
6052
3177
   /usr/local/mysql to the version/platform specific directory
6053
3178
   created during installation will be created automatically.
6054
3179
 
6055
3180
    1. Download and open the MySQL package installer, which is
6056
 
       provided on a disk image (.dmg). Double-click to open the disk
6057
 
       image, which includes the main MySQL installation package, the
6058
 
       MySQLStartupItem.pkg installation package, and the
6059
 
       MySQL.prefPane.
 
3181
       provided on a disk image (.dmg) that includes the main MySQL
 
3182
       installation package, the MySQLStartupItem.pkg installation
 
3183
       package, and the MySQL.prefPane. Double-click the disk image
 
3184
       to open it.
6060
3185
 
6061
 
    2. Double-click on the MySQL installer package. It will be named
 
3186
    2. Double-click the MySQL installer package. It will be named
6062
3187
       according to the version of MySQL you have downloaded. For
6063
3188
       example, if you have downloaded MySQL 5.1.39, double-click
6064
3189
       mysql-5.1.39-osx10.5-x86.pkg.
6065
3190
 
6066
 
    3. You will be presented with the openin installer dialog. Click
6067
 
       Continue to begihn installation.
 
3191
    3. You will be presented with the opening installer dialog. Click
 
3192
       Continue to begin installation.
6068
3193
       MySQL Package Installer: Step 1
6069
3194
 
6070
3195
    4. A copy of the installation instructions and other important
6071
 
       information relevant to this installation are display. Click
 
3196
       information relevant to this installation are displayed. Click
6072
3197
       Continue .
6073
3198
 
6074
3199
    5. If you have downloaded the community version of MySQL, you
6075
 
       will be shown a copy of the relevent GNU General Public
 
3200
       will be shown a copy of the relevant GNU General Public
6076
3201
       License. Click Continue .
6077
3202
 
6078
3203
    6. Select the drive you want to use to install the MySQL Startup
6082
3207
 
6083
3208
    7. You will be asked to confirm the details of the installation,
6084
3209
       including the space required for the installation. To change
6085
 
       the drive on which the startup item is installed you can click
6086
 
       either Go Back or Change Install Location.... To install the
6087
 
       startup item, click Install.
 
3210
       the drive on which the startup item is installed, click either
 
3211
       Go Back or Change Install Location.... To install the startup
 
3212
       item, click Install.
6088
3213
 
6089
3214
    8. Once the installation has been completed successfully, you
6090
 
       will be given an Install Succeeded message.
6091
 
 
6092
 
   Once you have completed the basic installation, you must complete
6093
 
   the post-installation steps as specifed in Section 2.13,
6094
 
   "Post-Installation Setup and Testing."
6095
 
 
6096
 
   For convenience, you may also want to install the Section 2.7.2,
6097
 
   "Installing the MySQL Startup Item" and Section 2.7.3, "Installing
6098
 
   and Using the MySQL Preference Pane."
6099
 
 
6100
 
2.7.2. Installing the MySQL Startup Item
 
3215
       will be shown an Install Succeeded message.
 
3216
 
 
3217
   For convenience, you may also want to install the startup item and
 
3218
   preference pane. See Section 2.4.3, "Installing the MySQL Startup
 
3219
   Item," and Section 2.4.4, "Installing and Using the MySQL
 
3220
   Preference Pane."
 
3221
 
 
3222
2.4.3. Installing the MySQL Startup Item
6101
3223
 
6102
3224
   The MySQL Installation Package includes a startup item that can be
6103
 
   used to automatically startup and shutdown MySQL during boot.
 
3225
   used to automatically start and stop MySQL.
6104
3226
 
6105
3227
   To install the MySQL Startup Item:
6106
3228
 
6107
3229
    1. Download and open the MySQL package installer, which is
6108
 
       provided on a disk image (.dmg). Double-click to open the disk
6109
 
       image, which includes the main MySQL installation package, the
6110
 
       MySQLStartupItem.pkg installation package, and the
6111
 
       MySQL.prefPane.
 
3230
       provided on a disk image (.dmg) that includes the main MySQL
 
3231
       installation package, the MySQLStartupItem.pkg installation
 
3232
       package, and the MySQL.prefPane. Double-click the disk image
 
3233
       to open it.
6112
3234
 
6113
 
    2. Double-click on the MySQLStartItem.pkg file to start the
 
3235
    2. Double-click the MySQLStartItem.pkg file to start the
6114
3236
       installation process.
6115
3237
 
6116
3238
    3. You will be presented with the Install MySQL Startup Item
6119
3241
       Click Continue to continue the installation process.
6120
3242
 
6121
3243
    4. A copy of the installation instructions and other important
6122
 
       information relevant to this installation are display. Click
 
3244
       information relevant to this installation are displayed. Click
6123
3245
       Continue .
6124
3246
 
6125
3247
    5. Select the drive you want to use to install the MySQL Startup
6128
3250
       MySQL Startup Item Installer: Step 3
6129
3251
 
6130
3252
    6. You will be asked to confirm the details of the installation.
6131
 
       To change the drive on which the startup item is installed you
6132
 
       can click either Go Back or Change Install Location.... To
6133
 
       install the startup item, click Install.
 
3253
       To change the drive on which the startup item is installed,
 
3254
       click either Go Back or Change Install Location.... To install
 
3255
       the startup item, click Install.
6134
3256
 
6135
3257
    7. Once the installation has been completed successfully, you
6136
 
       will be given an Install Succeeded message.
 
3258
       will be shown an Install Succeeded message.
6137
3259
       MySQL Startup Item Installer: Step 5
6138
3260
 
6139
3261
   The Startup Item for MySQL is installed into
6140
3262
   /Library/StartupItems/MySQLCOM. The Startup Item installation adds
6141
3263
   a variable MYSQLCOM=-YES- to the system configuration file
6142
3264
   /etc/hostconfig. If you want to disable the automatic startup of
6143
 
   MySQL, simply change this variable to MYSQLCOM=-NO-.
 
3265
   MySQL, change this variable to MYSQLCOM=-NO-.
6144
3266
 
6145
 
   After the installation, you can start up MySQL by running the
6146
 
   following commands in a terminal window. You must have
6147
 
   administrator privileges to perform this task.
 
3267
   After the installation, you can start and stop MySQL by running
 
3268
   the following commands in a terminal window. You must have
 
3269
   administrator privileges to perform these tasks, and you may be
 
3270
   prompted for your password.
6148
3271
 
6149
3272
   If you have installed the Startup Item, use this command to start
6150
3273
   the server:
6151
3274
shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
6152
3275
 
6153
 
   You may be prompted for your password to complete the startup.
6154
 
 
6155
3276
   If you have installed the Startup Item, use this command to stop
6156
3277
   the server:
6157
3278
shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
6158
3279
 
6159
 
   You may be prompted for your password to complete the shutdown.
6160
 
 
6161
 
2.7.3. Installing and Using the MySQL Preference Pane
 
3280
2.4.4. Installing and Using the MySQL Preference Pane
6162
3281
 
6163
3282
   The MySQL Package installer disk image also includes a custom
6164
 
   MySQL Preference Pane that enables you to start, stop and control
 
3283
   MySQL Preference Pane that enables you to start, stop, and control
6165
3284
   automated startup during boot of your MySQL installation.
6166
3285
 
6167
3286
   To install the MySQL Preference Pane:
6168
3287
 
6169
3288
    1. Download and open the MySQL package installer package, which
6170
 
       is provided on a disk image (.dmg). Double-click to open the
6171
 
       disk image, which includes the main MySQL installation
6172
 
       package, the MySQLStartupItem.pkg installation package, and
6173
 
       the MySQL.prefPane.
 
3289
       is provided on a disk image (.dmg) that includes the main
 
3290
       MySQL installation package, the MySQLStartupItem.pkg
 
3291
       installation package, and the MySQL.prefPane. Double-click the
 
3292
       disk image to open it.
6174
3293
 
6175
 
    2. Double click on MySQL.prefPane. The MySQL System Preferences
 
3294
    2. Double-click the MySQL.prefPane. The MySQL System Preferences
6176
3295
       will open.
6177
3296
 
6178
3297
    3. If this is the first time you have installed the preference
6187
3306
       will be asked to confirm whether you want to overwrite the
6188
3307
       existing MySQL Preference Pane.
6189
3308
 
6190
 
Note
 
3309
   Note
6191
3310
 
6192
3311
   The MySQL Preference Pane only starts and stops MySQL installation
6193
3312
   installed from the MySQL package installation that have been
6196
3315
   Once the MySQL Preference Pane has been installed, you can control
6197
3316
   your MySQL server instance using the preference pane. To use the
6198
3317
   preference pane, open the System Preferences... from the Apple
6199
 
   menu. Select the MySQL preference pane by clicking on the MySQL
6200
 
   logo within the Other section of the preference panes list.
 
3318
   menu. Select the MySQL preference pane by clicking the MySQL logo
 
3319
   within the Other section of the preference panes list.
6201
3320
   MySQL Preference Pane
6202
3321
 
6203
3322
   The MySQL Preference Pane shows the current status of the MySQL
6204
3323
   server, showing stopped (in red) if the server is not running and
6205
3324
   running (in green) if the server has already been started. The
6206
 
   preference pane will also show the current setting for whether the
6207
 
   MySQL server has been set to start up automatically.
 
3325
   preference pane also shows the current setting for whether the
 
3326
   MySQL server has been set to start automatically.
6208
3327
 
6209
3328
     * To start MySQL using the preference pane: 
6210
3329
       Click Start MySQL Server. You may be prompted for the username
6213
3332
 
6214
3333
     * To stop MySQL using the preference pane: 
6215
3334
       Click Stop MySQL Server. You may be prompted for the username
6216
 
       and password of a user with administrator privileges to
6217
 
       shutdown the MySQL server.
 
3335
       and password of a user with administrator privileges to stop
 
3336
       the MySQL server.
6218
3337
 
6219
3338
     * To automatically start the MySQL server when the system boots:
6220
 
       Check the checkbox next to Automatically Start MySQL Server on
6221
 
       Startup.
6222
 
 
6223
 
     * To disable the automatic starting of the MySQL server when the
6224
 
       system boots:
6225
 
       Uncheck the checkbox next to Automatically Start MySQL Server
6226
 
       on Startup.
6227
 
 
6228
 
   You can close the System Preferences... once you have completed
6229
 
   your settings.
6230
 
 
6231
 
2.7.4. Using MySQL on Mac OS X Server
 
3339
       Check the check box next to Automatically Start MySQL Server
 
3340
       on Startup.
 
3341
 
 
3342
     * To disable automatic MySQL server startup when the system
 
3343
       boots:
 
3344
       Uncheck the check box next to Automatically Start MySQL Server
 
3345
       on Startup.
 
3346
 
 
3347
   You can close the System Preferences... window once you have
 
3348
   completed your settings.
 
3349
 
 
3350
2.4.5. Using the Bundled MySQL on Mac OS X Server
6232
3351
 
6233
3352
   If you are running Mac OS X Server, a version of MySQL should
6234
3353
   already be installed. The following table shows the versions of
6235
3354
   MySQL that ship with Mac OS X Server versions.
 
3355
 
 
3356
   Table 2.13. MySQL Versions Preinstalled with Mac OS X Server
6236
3357
   Mac OS X Server Version MySQL Version
6237
3358
   10.2-10.2.2             3.23.51
6238
3359
   10.2.3-10.2.6           3.23.53
6242
3363
   10.5.0                  5.0.45
6243
3364
   10.6.0                  5.0.82
6244
3365
 
6245
 
   The installation layout of MySQL on Mac OS X Server is as shown in
6246
 
   the table below:
6247
 
   Directory                   Contents of Directory
6248
 
   /usr/bin                    Client programs
6249
 
   /var/mysql                  Log files, databases
6250
 
   /usr/libexec                The mysqld server
6251
 
   /usr/share/man              Unix manual pages
 
3366
   The following table shows the installation layout of MySQL on Mac
 
3367
   OS X Server.
 
3368
 
 
3369
   Table 2.14. MySQL Directory Layout for Preinstalled MySQL
 
3370
   installations on Mac OS X Server
 
3371
   Directory Contents of Directory
 
3372
   /usr/bin Client programs
 
3373
   /var/mysql Log files, databases
 
3374
   /usr/libexec The mysqld server
 
3375
   /usr/share/man Unix manual pages
6252
3376
   /usr/share/mysql/mysql-test MySQL test suite
6253
 
   /usr/share/mysql            Contains the mysql_install_db script
6254
 
   /var/mysql/mysql.sock       The location of the MySQL Unix socket
6255
 
 
6256
 
Note
6257
 
 
6258
 
   The MySQL server bundled with Mac OS X Server does not include the
6259
 
   MySQL client libraries and header files required if you want to
6260
 
   access and use MySQL from a third-party driver, such as Perl DBI
6261
 
   or PHP. For more information on obtaining and installing MySQL
6262
 
   libraries, see Mac OS X Server version 10.5: MySQL libraries
6263
 
   available for download (http://support.apple.com/kb/TA25017).
6264
 
   Alternatively, you can ignore the bundled MySQL server and install
6265
 
   MySQL from the package or tarball installation.
6266
 
 
6267
 
   For more information on managing the bundled MySQL instance in Mac
6268
 
   OS X Server 10.5, see Mac OS X Server: Web Technologies
6269
 
   Administration For Version 10.5 Leopard
6270
 
   (http://images.apple.com/server/macosx/docs/Web_Technologies_Admin
6271
 
   _v10.5.pdf). For more information on managing the bundled MySQL
6272
 
   instance in Mac OS X Server 10.6, see Mac OS X Server: Web
6273
 
   Technologies Administration Version 10.6 Snow Leopard
6274
 
   (http://manuals.info.apple.com/en_US/WebTech_v10.6.pdf).
6275
 
 
6276
 
2.7.5. MySQL Installation on Mac OS X Notes
6277
 
 
6278
 
   You should keep the following issues and notes in mind:
6279
 
 
6280
 
     * The default location for the MySQL Unix socket is different on
6281
 
       Mac OS X and Mac OS X Server depending on the installation
6282
 
       type you chose. The default locations by installation are as
6283
 
       follows:
6284
 
 
6285
 
       Package Installer from MySQL       /tmp/mysql.sock
6286
 
       Tarball from MySQL                 /tmp/mysql.sock
6287
 
       MySQL Bundled with Mac OS X Server /var/mysql/mysql.sock
6288
 
       To prevent issues, you should either change the configuration
6289
 
       of the socket used within your application (for example,
6290
 
       changing php.ini), or you should configure the socket location
6291
 
       using a MySQL configuration file and the socket option. For
6292
 
       more information, see Section 5.1.2, "Server Command Options."
6293
 
 
6294
 
     * You may need (or want) to create a specific mysql user to own
6295
 
       the MySQL directory and data. On Mac OS X 10.4 and lower you
6296
 
       can do this by using the Netinfo Manager application, located
6297
 
       within the Utilities folder within the Applications folder. On
6298
 
       Mac OS X 10.5 and later you can do this through the Directory
6299
 
       Utility. From Mac OS X 10.5 and later (including Mac OS X
6300
 
       Server 10.5) the mysql should already exist. For use in single
6301
 
       user mode, an entry for _mysql (note the underscore prefix)
6302
 
       should already exist within the system /etc/passwd file.
6303
 
 
6304
 
     * Due to a bug in the Mac OS X package installer, you may see
6305
 
       this error message in the destination disk selection dialog:
6306
 
You cannot install this software on this disk. (null)
6307
 
       If this error occurs, simply click the Go Back button once to
6308
 
       return to the previous screen. Then click Continue to advance
6309
 
       to the destination disk selection again, and you should be
6310
 
       able to choose the destination disk correctly. We have
6311
 
       reported this bug to Apple and it is investigating this
6312
 
       problem.
6313
 
 
6314
 
     * Because the MySQL package installer installs the MySQL
6315
 
       contents into a version and platform specific directory, you
6316
 
       can use this to upgrade and migrate your database between
6317
 
       versions. You will need to either copy the data directory from
6318
 
       the old version to the new version, or alternatively specify
6319
 
       an alternative datadir value to set location of the data
6320
 
       directory.
6321
 
 
6322
 
     * You might want to add aliases to your shell's resource file to
6323
 
       make it easier to access commonly used programs such as mysql
6324
 
       and mysqladmin from the command line. The syntax for bash is:
6325
 
alias mysql=/usr/local/mysql/bin/mysql
6326
 
alias mysqladmin=/usr/local/mysql/bin/mysqladmin
6327
 
       For tcsh, use:
6328
 
alias mysql /usr/local/mysql/bin/mysql
6329
 
alias mysqladmin /usr/local/mysql/bin/mysqladmin
6330
 
       Even better, add /usr/local/mysql/bin to your PATH environment
6331
 
       variable. You can do this by modifying the appropriate startup
6332
 
       file for your shell. For more information, see Section 4.2.1,
6333
 
       "Invoking MySQL Programs."
6334
 
 
6335
 
     * After you have copied over the MySQL database files from the
6336
 
       previous installation and have successfully started the new
6337
 
       server, you should consider removing the old installation
6338
 
       files to save disk space. Additionally, you should also remove
6339
 
       older versions of the Package Receipt directories located in
6340
 
       /Library/Receipts/mysql-VERSION.pkg.
6341
 
 
6342
 
2.8. Installing MySQL on Solaris
 
3377
   /usr/share/mysql Miscellaneous support files, including error
 
3378
   messages, character set files, sample configuration files, SQL for
 
3379
   database installation
 
3380
   /var/mysql/mysql.sock Location of the MySQL Unix socket
 
3381
 
 
3382
Additional Resources
 
3383
 
 
3384
 
 
3385
     * For more information on managing the bundled MySQL instance in
 
3386
       Mac OS X Server 10.5, see Mac OS X Server: Web Technologies
 
3387
       Administration For Version 10.5 Leopard
 
3388
       (http://images.apple.com/server/macosx/docs/Web_Technologies_A
 
3389
       dmin_v10.5.pdf).
 
3390
 
 
3391
     * For more information on managing the bundled MySQL instance in
 
3392
       Mac OS X Server 10.6, see Mac OS X Server: Web Technologies
 
3393
       Administration Version 10.6 Snow Leopard
 
3394
       (http://manuals.info.apple.com/en_US/WebTech_v10.6.pdf).
 
3395
 
 
3396
     * The MySQL server bundled with Mac OS X Server does not include
 
3397
       the MySQL client libraries and header files required to access
 
3398
       and use MySQL from a third-party driver, such as Perl DBI or
 
3399
       PHP. For more information on obtaining and installing MySQL
 
3400
       libraries, see Mac OS X Server version 10.5: MySQL libraries
 
3401
       available for download (http://support.apple.com/kb/TA25017).
 
3402
       Alternatively, you can ignore the bundled MySQL server and
 
3403
       install MySQL from the package or tarball installation.
 
3404
 
 
3405
2.5. Installing MySQL on Linux
 
3406
 
 
3407
   Linux supports a number of different solutions for installing
 
3408
   MySQL. The recommended method is to use one of the distributions
 
3409
   from Oracle. If you choose this method, there are three options
 
3410
   available:
 
3411
 
 
3412
     * Installing from a generic binary package in .tar.gz format.
 
3413
       See Section 2.2, "Installing MySQL from Generic Binaries on
 
3414
       Unix/Linux" for more information.
 
3415
 
 
3416
     * Extracting and compiling MySQL from a source distribution. For
 
3417
       detailed instructions, see Section 2.11, "Installing MySQL
 
3418
       from Source."
 
3419
 
 
3420
     * Installing using a pre-compiled RPM package. For more
 
3421
       information on using the RPM solution, see Section 2.5.1,
 
3422
       "Installing MySQL from RPM Packages on Linux."
 
3423
 
 
3424
   As an alternative, you can use the native package manager within
 
3425
   your Linux distribution to automatically download and install
 
3426
   MySQL for you. Native package installations can take of the
 
3427
   download and dependencies required to run MySQL, but the MySQL
 
3428
   version will often be some way behind the currently available
 
3429
   release. You will also normally be unable to install developmental
 
3430
   releases, as these are not usually made available in the native
 
3431
   repository. For more information on using the native package
 
3432
   installers, see Section 2.5.2, "Installing MySQL on Linux using
 
3433
   Native Package Manager."
 
3434
   Note
 
3435
 
 
3436
   For many Linux installations, you will want to set up MySQL to be
 
3437
   started automatically when your machine starts. Many of the native
 
3438
   package installations perform this operation for you, but for
 
3439
   source, binary and RPM solutions you may need to set this up
 
3440
   separately. The required script, mysql.server, can be found in the
 
3441
   support-files directory under the MySQL installation directory or
 
3442
   in a MySQL source tree. You can install it as /etc/init.d/mysql
 
3443
   for automatic MySQL startup and shutdown. See Section 2.12.1.2,
 
3444
   "Starting and Stopping MySQL Automatically."
 
3445
 
 
3446
2.5.1. Installing MySQL from RPM Packages on Linux
 
3447
 
 
3448
   The recommended way to install MySQL on RPM-based Linux
 
3449
   distributions is by using the RPM packages. The RPMs that we
 
3450
   provide to the community should work on all versions of Linux that
 
3451
   support RPM packages and use glibc 2.3. To obtain RPM packages,
 
3452
   see Section 2.1.3, "How to Get MySQL."
 
3453
 
 
3454
   For non-RPM Linux distributions, you can install MySQL using a
 
3455
   .tar.gz package. See Section 2.2, "Installing MySQL from Generic
 
3456
   Binaries on Unix/Linux."
 
3457
 
 
3458
   Installations created from our Linux RPM distributions result in
 
3459
   files under the following system directories.
 
3460
 
 
3461
   Table 2.15. MySQL Installation Layout for Linux RPM
 
3462
   Directory Contents of Directory
 
3463
   /usr/bin Client programs and scripts
 
3464
   /usr/sbin The mysqld server
 
3465
   /var/lib/mysql Log files, databases
 
3466
   /usr/share/info Manual in Info format
 
3467
   /usr/share/man Unix manual pages
 
3468
   /usr/include/mysql Include (header) files
 
3469
   /usr/lib/mysql Libraries
 
3470
   /usr/share/mysql Miscellaneous support files, including error
 
3471
   messages, character set files, sample configuration files, SQL for
 
3472
   database installation
 
3473
   /usr/share/sql-bench Benchmarks
 
3474
   Note
 
3475
 
 
3476
   RPM distributions of MySQL are also provided by other vendors. Be
 
3477
   aware that they may differ from those built by us in features,
 
3478
   capabilities, and conventions (including communication setup), and
 
3479
   that the instructions in this manual do not necessarily apply to
 
3480
   installing them. The vendor's instructions should be consulted
 
3481
   instead.
 
3482
 
 
3483
   In most cases, you need to install only the MySQL-server and
 
3484
   MySQL-client packages to get a functional MySQL installation. The
 
3485
   other packages are not required for a standard installation.
 
3486
 
 
3487
   RPMs for MySQL Cluster.  Beginning with MySQL 5.1.24, standard
 
3488
   MySQL server RPMs built by MySQL no longer provide support for the
 
3489
   NDBCLUSTER storage engine. MySQL Cluster users should check the
 
3490
   MySQL Cluster Downloads page at
 
3491
   http://dev.mysql.com/downloads/cluster/ for RPMs that should work
 
3492
   with most Linux distributions for both of these release series.
 
3493
   Important
 
3494
 
 
3495
   When upgrading a MySQL Cluster RPM installation, you must upgrade
 
3496
   all installed RPMs, including the Server and Client RPMs.
 
3497
 
 
3498
   For more information about installing MySQL Cluster from RPMs, see
 
3499
   Section 16.2.1.2, "Installing MySQL Cluster from RPM."
 
3500
 
 
3501
   For upgrades, if your installation was originally produced by
 
3502
   installing multiple RPM packages, it is best to upgrade all the
 
3503
   packages, not just some. For example, if you previously installed
 
3504
   the server and client RPMs, do not upgrade just the server RPM.
 
3505
 
 
3506
   The RPM packages shown in the following list are available. The
 
3507
   names shown here use a suffix of .glibc23.i386.rpm, but particular
 
3508
   packages can have different suffixes, described later.
 
3509
 
 
3510
     * MySQL-server-VERSION.glibc23.i386.rpm
 
3511
       The MySQL server. You need this unless you only want to
 
3512
       connect to a MySQL server running on another machine.
 
3513
 
 
3514
     * MySQL-client-VERSION.glibc23.i386.rpm
 
3515
       The standard MySQL client programs. You probably always want
 
3516
       to install this package.
 
3517
 
 
3518
     * MySQL-devel-VERSION.glibc23.i386.rpm
 
3519
       The libraries and include files that are needed if you want to
 
3520
       compile other MySQL clients, such as the Perl modules.
 
3521
 
 
3522
     * MySQL-debuginfo-VERSION.glibc23.i386.rpm
 
3523
       This package contains debugging information. It is specific to
 
3524
       Red Hat Enterprise Linux. debuginfo RPMs are never needed to
 
3525
       use MySQL software; this is true both for the server and for
 
3526
       client programs. However, they contain additional information
 
3527
       that might be needed by a debugger to analyze a crash.
 
3528
 
 
3529
     * MySQL-shared-VERSION.glibc23.i386.rpm
 
3530
       This package contains the shared libraries
 
3531
       (libmysqlclient.so*) that certain languages and applications
 
3532
       need to dynamically load and use MySQL. It contains
 
3533
       single-threaded and thread-safe libraries. If you install this
 
3534
       package, do not install the MySQL-shared-compat package.
 
3535
 
 
3536
     * MySQL-shared-compat-VERSION.glibc23.i386.rpm
 
3537
       This package includes the shared libraries for older releases,
 
3538
       up to the current release. It contains single-threaded and
 
3539
       thread-safe libraries. Install this package instead of
 
3540
       MySQL-shared if you have applications installed that are
 
3541
       dynamically linked against older versions of MySQL but you
 
3542
       want to upgrade to the current version without breaking the
 
3543
       library dependencies.
 
3544
 
 
3545
     * MySQL-shared-compat-advanced-gpl-VERSION.glibc23.i386.rpm,
 
3546
       MySQL-shared-compat-advanced-VERSION.glibc23.i386.rpm
 
3547
       These are like the MySQL-shared-compat package, but are for
 
3548
       the "MySQL Enterprise Server - Advanced Edition" products.
 
3549
       Install these packages rather than the normal
 
3550
       MySQL-shared-compat package if you want to included shared
 
3551
       client libraries for older MySQL versions.
 
3552
 
 
3553
     * MySQL-embedded-VERSION.glibc23.i386.rpm
 
3554
       The embedded MySQL server library.
 
3555
 
 
3556
     * MySQL-ndb-management-VERSION.glibc23.i386.rpm,
 
3557
       MySQL-ndb-storage-VERSION.glibc23.i386.rpm,
 
3558
       MySQL-ndb-tools-VERSION.glibc23.i386.rpm,
 
3559
       MySQL-ndb-extra-VERSION.glibc23.i386.rpm
 
3560
       Packages that contain additional files for MySQL Cluster
 
3561
       installations.
 
3562
       Note
 
3563
       The MySQL-ndb-tools RPM requires a working installation of
 
3564
       perl. Prior to MySQL 5.1.18, the DBI and HTML::Template
 
3565
       packages were also required. See Section 2.15, "Perl
 
3566
       Installation Notes," and Section 16.4.21, "ndb_size.pl ---
 
3567
       NDBCLUSTER Size Requirement Estimator," for more information.
 
3568
 
 
3569
     * MySQL-test-VERSION.glibc23.i386.rpm
 
3570
       This package includes the MySQL test suite.
 
3571
 
 
3572
     * MySQL-VERSION.src.rpm
 
3573
       This contains the source code for all of the previous
 
3574
       packages. It can also be used to rebuild the RPMs on other
 
3575
       architectures (for example, Alpha or SPARC).
 
3576
 
 
3577
   The suffix of RPM package names (following the VERSION value) has
 
3578
   the following syntax:
 
3579
.PLATFORM.CPU.rpm
 
3580
 
 
3581
   The PLATFORM and CPU values indicate the type of system for which
 
3582
   the package is built. PLATFORM indicates the platform and CPU
 
3583
   indicates the processor type or family.
 
3584
 
 
3585
   All packages are dynamically linked against glibc 2.3. The
 
3586
   PLATFORM value indicates whether the package is platform
 
3587
   independent or intended for a specific platform, as shown in the
 
3588
   following table.
 
3589
 
 
3590
   Table 2.16. MySQL Linux Installation Packages
 
3591
   PLATFORM Value Intended Use
 
3592
   glibc23 Platform independent, should run on any Linux distribution
 
3593
   that supports glibc 2.3
 
3594
   rhel4, rhel5 Red Hat Enterprise Linux 4 or 5
 
3595
   sles10, sles11 SuSE Linux Enterprise Server 10 or 11
 
3596
 
 
3597
   In MySQL 5.1, only glibc23 packages are available currently.
 
3598
 
 
3599
   The CPU value indicates the processor type or family for which the
 
3600
   package is built.
 
3601
 
 
3602
   Table 2.17. MySQL Installation Packages for Linux CPU Identifier
 
3603
      CPU Value      Intended Processor Type or Family
 
3604
   i386, i586, i686 Pentium processor or better, 32 bit
 
3605
   x86_64           64-bit x86 processor
 
3606
   ia64             Itanium (IA-64) processor
 
3607
 
 
3608
   To see all files in an RPM package (for example, a MySQL-server
 
3609
   RPM), run a command like this:
 
3610
shell> rpm -qpl MySQL-server-VERSION.glibc23.i386.rpm
 
3611
 
 
3612
   To perform a standard minimal installation, install the server and
 
3613
   client RPMs:
 
3614
shell> rpm -i MySQL-server-VERSION.glibc23.i386.rpm
 
3615
shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
 
3616
 
 
3617
   To install only the client programs, install just the client RPM:
 
3618
shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
 
3619
 
 
3620
   RPM provides a feature to verify the integrity and authenticity of
 
3621
   packages before installing them. If you would like to learn more
 
3622
   about this feature, see Section 2.1.4, "Verifying Package
 
3623
   Integrity Using MD5 Checksums or GnuPG."
 
3624
 
 
3625
   The server RPM places data under the /var/lib/mysql directory. The
 
3626
   RPM also creates a login account for a user named mysql (if one
 
3627
   does not exist) to use for running the MySQL server, and creates
 
3628
   the appropriate entries in /etc/init.d/ to start the server
 
3629
   automatically at boot time. (This means that if you have performed
 
3630
   a previous installation and have made changes to its startup
 
3631
   script, you may want to make a copy of the script so that you do
 
3632
   not lose it when you install a newer RPM.) See Section 2.12.1.2,
 
3633
   "Starting and Stopping MySQL Automatically," for more information
 
3634
   on how MySQL can be started automatically on system startup.
 
3635
 
 
3636
   In MySQL 5.1.49 and later, during an upgrade installation using
 
3637
   the RPM packages, if the MySQL server is running when the upgrade
 
3638
   occurs, the MySQL server is stopped, the upgrade occurs, and the
 
3639
   MySQL server is restarted. If the MySQL server is not already
 
3640
   running when the RPM upgrade occurs, the MySQL server is not
 
3641
   started at the end of the installation.
 
3642
 
 
3643
   If something goes wrong, you can find more information in the
 
3644
   binary installation section. See Section 2.2, "Installing MySQL
 
3645
   from Generic Binaries on Unix/Linux."
 
3646
   Note
 
3647
 
 
3648
   The accounts that are listed in the MySQL grant tables initially
 
3649
   have no passwords. After starting the server, you should set up
 
3650
   passwords for them using the instructions in Section 2.12,
 
3651
   "Postinstallation Setup and Testing."
 
3652
 
 
3653
   During RPM installation, a user named mysql and a group named
 
3654
   mysql are created on the system. This is done using the useradd,
 
3655
   groupadd, and usermod commands. Those commands require appropriate
 
3656
   administrative privileges, which is required for locally managed
 
3657
   users and groups (as listed in the /etc/passwd and /etc/group
 
3658
   files) by the RPM installation process being run by root.
 
3659
 
 
3660
   If you log in as the mysql user, you may find that MySQL displays
 
3661
   "Invalid (old?) table or database name" errors that mention
 
3662
   .mysqlgui, lost+found, .mysqlgui, .bash_history, .fonts.cache-1,
 
3663
   .lesshst, .mysql_history, .profile, .viminfo, and similar files
 
3664
   created by MySQL or operating system utilities. You can safely
 
3665
   ignore these error messages or remove the files or directories
 
3666
   that cause them if you do not need them.
 
3667
 
 
3668
   For nonlocal user management (LDAP, NIS, and so forth), the
 
3669
   administrative tools may require additional authentication (such
 
3670
   as a password), and will fail if the installing user does not
 
3671
   provide this authentication. Even if they fail, the RPM
 
3672
   installation will not abort but succeed, and this is intentional.
 
3673
   If they failed, some of the intended transfer of ownership may be
 
3674
   missing, and it is recommended that the system administrator then
 
3675
   manually ensures some appropriate user and group exists and
 
3676
   manually transfers ownership following the actions in the RPM spec
 
3677
   file.
 
3678
 
 
3679
2.5.2. Installing MySQL on Linux using Native Package Manager
 
3680
 
 
3681
   Many Linux distributions include a version of the MySQL server,
 
3682
   client tools, and development components into the standard package
 
3683
   management system built into distributions such as Fedora, Debian,
 
3684
   Ubuntu, and Gentoo. This section provides basic instructions for
 
3685
   installing MySQL using these systems.
 
3686
   Important
 
3687
 
 
3688
   Native package installations can take care of the download and
 
3689
   dependencies required to run MySQL, but the MySQL version will
 
3690
   often be some way behind the currently available release. You will
 
3691
   also normally be unable to install developmental releases, as
 
3692
   these are not usually made available in the native repository.
 
3693
 
 
3694
   Distribution specific instructions are shown below:
 
3695
 
 
3696
     * Red Hat Linux, Fedora, CentOS
 
3697
       For Red Hat and similar distributions, the MySQL distribution
 
3698
       is divided into a number of separate packages, mysql for the
 
3699
       client tools, mysql-server for the server and associated
 
3700
       tools, and mysql-libs for the libraries. The libraries are
 
3701
       required if you want to provide connectivity from different
 
3702
       languages and environments such as Perl, Python and others.
 
3703
       To install, use the yum command to specify the packages that
 
3704
       you want to install. For example:
 
3705
root-shell> yum install mysql mysql-server mysql-libs mysql-server
 
3706
Loaded plugins: presto, refresh-packagekit
 
3707
Setting up Install Process
 
3708
Resolving Dependencies
 
3709
--> Running transaction check
 
3710
---> Package mysql.x86_64 0:5.1.48-2.fc13 set to be updated
 
3711
---> Package mysql-libs.x86_64 0:5.1.48-2.fc13 set to be updated
 
3712
---> Package mysql-server.x86_64 0:5.1.48-2.fc13 set to be updated
 
3713
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5
 
3714
.1.48-2.fc13.x86_64
 
3715
--> Running transaction check
 
3716
---> Package perl-DBD-MySQL.x86_64 0:4.017-1.fc13 set to be updated
 
3717
--> Finished Dependency Resolution
 
3718
 
 
3719
Dependencies Resolved
 
3720
 
 
3721
=====================================================================
 
3722
===========
 
3723
 Package               Arch          Version               Repository
 
3724
      Size
 
3725
=====================================================================
 
3726
===========
 
3727
Installing:
 
3728
 mysql                 x86_64        5.1.48-2.fc13         updates
 
3729
     889 k
 
3730
 mysql-libs            x86_64        5.1.48-2.fc13         updates
 
3731
     1.2 M
 
3732
 mysql-server          x86_64        5.1.48-2.fc13         updates
 
3733
     8.1 M
 
3734
Installing for dependencies:
 
3735
 perl-DBD-MySQL        x86_64        4.017-1.fc13          updates
 
3736
     136 k
 
3737
 
 
3738
Transaction Summary
 
3739
=====================================================================
 
3740
===========
 
3741
Install       4 Package(s)
 
3742
Upgrade       0 Package(s)
 
3743
 
 
3744
Total download size: 10 M
 
3745
Installed size: 30 M
 
3746
Is this ok [y/N]: y
 
3747
Downloading Packages:
 
3748
Setting up and reading Presto delta metadata
 
3749
Processing delta metadata
 
3750
Package(s) data still to download: 10 M
 
3751
(1/4): mysql-5.1.48-2.fc13.x86_64.rpm                    | 889 kB
 
3752
 00:04
 
3753
(2/4): mysql-libs-5.1.48-2.fc13.x86_64.rpm               | 1.2 MB
 
3754
 00:06
 
3755
(3/4): mysql-server-5.1.48-2.fc13.x86_64.rpm             | 8.1 MB
 
3756
 00:40
 
3757
(4/4): perl-DBD-MySQL-4.017-1.fc13.x86_64.rpm            | 136 kB
 
3758
 00:00
 
3759
---------------------------------------------------------------------
 
3760
-----------
 
3761
Total                                           201 kB/s |  10 MB
 
3762
 00:52
 
3763
Running rpm_check_debug
 
3764
Running Transaction Test
 
3765
Transaction Test Succeeded
 
3766
Running Transaction
 
3767
  Installing     : mysql-libs-5.1.48-2.fc13.x86_64
 
3768
       1/4
 
3769
  Installing     : mysql-5.1.48-2.fc13.x86_64
 
3770
       2/4
 
3771
  Installing     : perl-DBD-MySQL-4.017-1.fc13.x86_64
 
3772
       3/4
 
3773
  Installing     : mysql-server-5.1.48-2.fc13.x86_64
 
3774
       4/4
 
3775
 
 
3776
Installed:
 
3777
  mysql.x86_64 0:5.1.48-2.fc13            mysql-libs.x86_64 0:5.1.48-
 
3778
2.fc13
 
3779
  mysql-server.x86_64 0:5.1.48-2.fc13
 
3780
 
 
3781
Dependency Installed:
 
3782
  perl-DBD-MySQL.x86_64 0:4.017-1.fc13
 
3783
 
 
3784
 
 
3785
Complete!
 
3786
       MySQL and the MySQL server should now be installed. A sample
 
3787
       configuration file is installed into /etc/my.cnf. An init
 
3788
       script, to start and stop the server, will have been installed
 
3789
       into /etc/init.d/mysqld. To start the MySQL server use
 
3790
       service:
 
3791
root-shell> service mysqld start
 
3792
       To enable the server to be started and stopped automatically
 
3793
       during boot, use chkconfig:
 
3794
root-shell> chkconfig --levels 235 mysqld on
 
3795
       Which enables the MySQL server to be started (and stopped)
 
3796
       automatically at the specified the run levels.
 
3797
       The database tables will have been automatically created for
 
3798
       you, if they do not already exist. You should, however, run
 
3799
       mysql_secure_installation to set the root passwords on your
 
3800
       server.
 
3801
 
 
3802
     * Debian, Ubuntu, Kubuntu
 
3803
       On Debian and related distributions, there are two packages,
 
3804
       mysql-client and mysql-server, for the client and server
 
3805
       components respectively. You should specify an explicit
 
3806
       version, for example mysql-client-5.1, to ensure that you
 
3807
       install the version of MySQL that you want.
 
3808
       To download and install, including any dependencies, use the
 
3809
       apt-get command, specifying the packages that you want to
 
3810
       install.
 
3811
       Note
 
3812
       Before installing, make sure that you update your apt-get
 
3813
       index files to ensure you are downloading the latest available
 
3814
       version.
 
3815
       A sample installation of the MySQL packages might look like
 
3816
       this (some sections trimmed for clarity):
 
3817
root-shell> apt-get install mysql-client-5.1 mysql-server-5.1
 
3818
Reading package lists... Done
 
3819
Building dependency tree
 
3820
Reading state information... Done
 
3821
The following packages were automatically installed and are no longer
 
3822
 required:
 
3823
  linux-headers-2.6.28-11 linux-headers-2.6.28-11-generic
 
3824
Use 'apt-get autoremove' to remove them.
 
3825
The following extra packages will be installed:
 
3826
  bsd-mailx libdbd-mysql-perl libdbi-perl libhtml-template-perl
 
3827
  libmysqlclient15off libmysqlclient16 libnet-daemon-perl libplrpc-pe
 
3828
rl mailx
 
3829
  mysql-common postfix
 
3830
Suggested packages:
 
3831
  dbishell libipc-sharedcache-perl tinyca procmail postfix-mysql post
 
3832
fix-pgsql
 
3833
  postfix-ldap postfix-pcre sasl2-bin resolvconf postfix-cdb
 
3834
The following NEW packages will be installed
 
3835
  bsd-mailx libdbd-mysql-perl libdbi-perl libhtml-template-perl
 
3836
  libmysqlclient15off libmysqlclient16 libnet-daemon-perl libplrpc-pe
 
3837
rl mailx
 
3838
  mysql-client-5.1 mysql-common mysql-server-5.1 postfix
 
3839
0 upgraded, 13 newly installed, 0 to remove and 182 not upgraded.
 
3840
Need to get 1907kB/25.3MB of archives.
 
3841
After this operation, 59.5MB of additional disk space will be used.
 
3842
Do you want to continue [Y/n]? Y
 
3843
Get: 1 http://gb.archive.ubuntu.com jaunty-updates/main mysql-common
 
3844
5.1.30really5.0.75-0ubuntu10.5 [63.6kB]
 
3845
Get: 2 http://gb.archive.ubuntu.com jaunty-updates/main libmysqlclien
 
3846
t15off 5.1.30really5.0.75-0ubuntu10.5 [1843kB]
 
3847
Fetched 1907kB in 9s (205kB/s)
 
3848
 
 
3849
Preconfiguring packages ...
 
3850
Selecting previously deselected package mysql-common.
 
3851
(Reading database ... 121260 files and directories currently installe
 
3852
d.)
 
3853
...
 
3854
Processing 1 added doc-base file(s)...
 
3855
Registering documents with scrollkeeper...
 
3856
Setting up libnet-daemon-perl (0.43-1) ...
 
3857
Setting up libplrpc-perl (0.2020-1) ...
 
3858
Setting up libdbi-perl (1.607-1) ...
 
3859
Setting up libmysqlclient15off (5.1.30really5.0.75-0ubuntu10.5) ...
 
3860
 
 
3861
Setting up libdbd-mysql-perl (4.008-1) ...
 
3862
Setting up libmysqlclient16 (5.1.31-1ubuntu2) ...
 
3863
 
 
3864
Setting up mysql-client-5.1 (5.1.31-1ubuntu2) ...
 
3865
 
 
3866
Setting up mysql-server-5.1 (5.1.31-1ubuntu2) ...
 
3867
 
 
3868
 * Stopping MySQL database server mysqld
 
3869
   ...done.
 
3870
100825 11:46:15  InnoDB: Started; log sequence number 0 46409
 
3871
100825 11:46:15  InnoDB: Starting shutdown...
 
3872
100825 11:46:17  InnoDB: Shutdown completed; log sequence number 0 46
 
3873
409
 
3874
100825 11:46:17 [Warning] Forcing shutdown of 1 plugins
 
3875
 
 
3876
 * Starting MySQL database server mysqld
 
3877
   ...done.
 
3878
 
 
3879
 * Checking for corrupt, not cleanly closed and upgrade needing table
 
3880
s.
 
3881
...
 
3882
Processing triggers for libc6 ...
 
3883
ldconfig deferred processing now taking place
 
3884
       Note
 
3885
       The apt-get command will install a number of packages,
 
3886
       including the MySQL server, in order to provide the typical
 
3887
       tools and application environment. This can mean that you
 
3888
       install a large number of packages in addition to the main
 
3889
       MySQL package.
 
3890
       During installation, the initial database will be created, and
 
3891
       you will be prompted for the MySQL root password (and
 
3892
       confirmation). A configuration file will have been created in
 
3893
       /etc/mysql/my.cnf. An init script will have been created in
 
3894
       /etc/init.d/mysql.
 
3895
       The server will already be started. You can manually start and
 
3896
       stop the server using:
 
3897
root-shell> service mysql [start|stop]
 
3898
       The service will automatically be added to the 2, 3 and 4 run
 
3899
       levels, with stop scripts in the single, shutdown and restart
 
3900
       levels.
 
3901
 
 
3902
     * Gentoo Linux
 
3903
       As a source-based distribution, installing MySQL on Gentoo
 
3904
       involves downloading the source, patching the Gentoo
 
3905
       specifics, and then compiling the MySQL server and installing
 
3906
       it. This process is handled automatically by the emerge
 
3907
       command. Depending on the version of MySQL that you want to
 
3908
       install, you may need to unmask the specific version that you
 
3909
       want for your chosen platform.
 
3910
       The MySQL server and client tools are provided within a single
 
3911
       package, dev-db/mysql. You can obtain a list of the versions
 
3912
       available to install by looking at the portage directory for
 
3913
       the package:
 
3914
root-shell> ls /usr/portage/dev-db/mysql/mysql-5.1*
 
3915
mysql-5.1.39-r1.ebuild
 
3916
mysql-5.1.44-r1.ebuild
 
3917
mysql-5.1.44-r2.ebuild
 
3918
mysql-5.1.44-r3.ebuild
 
3919
mysql-5.1.44.ebuild
 
3920
mysql-5.1.45-r1.ebuild
 
3921
mysql-5.1.45.ebuild
 
3922
mysql-5.1.46.ebuild
 
3923
       To install a specific MySQL version, you must specify the
 
3924
       entire atom. For example:
 
3925
root-shell> emerge =dev-db/mysql-5.1.46
 
3926
       A simpler alternative is to use the virtual/mysql-5.1 package,
 
3927
       which will install the latest version:
 
3928
root-shell> emerge =virtual/mysql-5.1
 
3929
       If the package is masked (because it is not tested or
 
3930
       certified for the current platform), use the ACCEPT_KEYWORDS
 
3931
       environment variable. For example:
 
3932
root-shell> ACCEPT_KEYWORDS="~x86" emerge =virtual/mysql-5.1
 
3933
       After installation, you should create a new database using
 
3934
       mysql_install_db, and set the password for the root user on
 
3935
       MySQL. You can use the configuration interface to set the
 
3936
       password and create the initial database:
 
3937
root-shell> emerge --config =dev-db/mysql-5.1.46
 
3938
       A sample configuration file will have been created for you in
 
3939
       /etc/mysql/my.cnf, and an init script will have been created
 
3940
       in /etc/init.d/mysql.
 
3941
       To enable MySQL to start automatically at the normal (default)
 
3942
       run levels, you can use:
 
3943
root-shell> rc-update add default mysql
 
3944
 
 
3945
2.6. Installing MySQL on Solaris and OpenSolaris
 
3946
 
 
3947
   MySQL on Solaris and OpenSolaris is available in a number of
 
3948
   different formats.
 
3949
 
 
3950
     * For information on installing using the native Solaris PKG
 
3951
       format, see Section 2.6.1, "Installing MySQL on Solaris using
 
3952
       a Solaris PKG."
 
3953
 
 
3954
     * On OpenSolaris, the standard package repositories include
 
3955
       MySQL packages specially built for OpenSolaris that include
 
3956
       entries for the Service Management Framework (SMF) to enable
 
3957
       control of the installation using the SMF administration
 
3958
       commands. For more information, see Section 2.6.2, "Installing
 
3959
       MySQL on OpenSolaris using IPS."
 
3960
 
 
3961
     * To use a standard tar binary installation, use the notes
 
3962
       provided in Section 2.2, "Installing MySQL from Generic
 
3963
       Binaries on Unix/Linux." Check the notes and hints at the end
 
3964
       of this section for Solaris specific notes that you may need
 
3965
       before or after installation.
 
3966
 
 
3967
     * For information on installing MySQL on Solaris or OpenSolaris
 
3968
       using a source distribution, first check the Solaris advice,
 
3969
       Section 2.11.8, "Notes on Installing MySQL on Solaris from
 
3970
       Source." For detailed instructions on installing from source,
 
3971
       see Section 2.11, "Installing MySQL from Source."
6343
3972
 
6344
3973
   To obtain a binary MySQL distribution for Solaris in tarball or
6345
3974
   PKG format, http://dev.mysql.com/downloads/mysql/5.1.html.
6346
3975
 
6347
 
   If you install MySQL using a binary tarball distribution on
6348
 
   Solaris, you may run into trouble even before you get the MySQL
6349
 
   distribution unpacked, as the Solaris tar cannot handle long file
6350
 
   names. This means that you may see errors when you try to unpack
6351
 
   MySQL.
6352
 
 
6353
 
   If this occurs, you must use GNU tar (gtar) to unpack the
6354
 
   distribution.
6355
 
 
6356
 
   You can install MySQL on Solaris using a binary package in PKG
6357
 
   format instead of the binary tarball distribution. Before
6358
 
   installing using the binary PKG format, you should create the
6359
 
   mysql user and group, for example:
 
3976
   Additional notes to be aware of when installing and using MySQL on
 
3977
   Solaris:
 
3978
 
 
3979
     * If you want to use MySQL with the mysql user and group, use
 
3980
       the groupadd and useradd commands:
6360
3981
groupadd mysql
6361
3982
useradd -g mysql mysql
6362
3983
 
6363
 
   Some basic PKG-handling commands follow:
6364
 
 
6365
 
     * To add a package:
6366
 
pkgadd -d package_name.pkg
6367
 
 
6368
 
     * To remove a package:
6369
 
pkgrm package_name
6370
 
 
6371
 
     * To get a full list of installed packages:
6372
 
pkginfo
6373
 
 
6374
 
     * To get detailed information for a package:
6375
 
pkginfo -l package_name
6376
 
 
6377
 
     * To list the files belonging to a package:
6378
 
pkgchk -v package_name
6379
 
 
6380
 
     * To get packaging information for an arbitrary file:
6381
 
pkgchk -l -p file_name
6382
 
 
6383
 
2.8.1. Solaris Notes
6384
 
 
6385
 
   For information about installing MySQL on Solaris using PKG
6386
 
   distributions, see Section 2.8, "Installing MySQL on Solaris."
6387
 
 
6388
 
   On Solaris, you may run into trouble even before you get the MySQL
6389
 
   distribution unpacked, as the Solaris tar cannot handle long file
6390
 
   names. This means that you may see errors when you try to unpack
6391
 
   MySQL.
6392
 
 
6393
 
   If this occurs, you must use GNU tar (gtar) to unpack the
6394
 
   distribution.
6395
 
 
6396
 
   If you have an UltraSPARC system, you can get 4% better
6397
 
   performance by adding -mcpu=v8 -Wa,-xarch=v8plusa to the CFLAGS
6398
 
   and CXXFLAGS environment variables.
6399
 
 
6400
 
   If you have Sun's Forte 5.0 (or newer) compiler, you can run
6401
 
   configure like this:
6402
 
CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt" \
6403
 
CXX=CC CXXFLAGS="-noex -mt" \
6404
 
./configure --prefix=/usr/local/mysql --enable-assembler
6405
 
 
6406
 
   To create a 64-bit binary with Sun's Forte compiler, use the
6407
 
   following configuration options:
6408
 
CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt -xarch=v9" \
6409
 
CXX=CC CXXFLAGS="-noex -mt -xarch=v9" ASFLAGS="-xarch=v9" \
6410
 
./configure --prefix=/usr/local/mysql --enable-assembler
6411
 
 
6412
 
   To create a 64-bit Solaris binary using gcc, add -m64 to CFLAGS
6413
 
   and CXXFLAGS and remove --enable-assembler from the configure
6414
 
   line.
6415
 
 
6416
 
   In the MySQL benchmarks, we obtained a 4% speed increase on
6417
 
   UltraSPARC when using Forte 5.0 in 32-bit mode, as compared to
6418
 
   using gcc 3.2 with the -mcpu flag.
6419
 
 
6420
 
   If you create a 64-bit mysqld binary, it is 4% slower than the
6421
 
   32-bit binary, but can handle more threads and memory.
6422
 
 
6423
 
   When using Solaris 10 for x86_64, you should mount any file
6424
 
   systems on which you intend to store InnoDB files with the
6425
 
   forcedirectio option. (By default mounting is done without this
6426
 
   option.) Failing to do so will cause a significant drop in
6427
 
   performance when using the InnoDB storage engine on this platform.
6428
 
 
6429
 
   If you get a problem with fdatasync or sched_yield, you can fix
6430
 
   this by adding LIBS=-lrt to the configure line
6431
 
 
6432
 
   Solaris does not provide static versions of all system libraries
6433
 
   (libpthreads and libdl), so you cannot compile MySQL with
6434
 
   --static. If you try to do so, you get one of the following
6435
 
   errors:
6436
 
ld: fatal: library -ldl: not found
6437
 
undefined reference to `dlopen'
6438
 
cannot find -lrt
6439
 
 
6440
 
   If you link your own MySQL client programs, you may see the
6441
 
   following error at runtime:
6442
 
ld.so.1: fatal: libmysqlclient.so.#:
6443
 
open failed: No such file or directory
6444
 
 
6445
 
   This problem can be avoided by one of the following methods:
6446
 
 
6447
 
     * Link clients with the -Wl,r/full/path/to/libmysqlclient.so
6448
 
       flag rather than with -Lpath).
6449
 
 
6450
 
     * Copy libmysqclient.so to /usr/lib.
6451
 
 
6452
 
     * Add the path name of the directory where libmysqlclient.so is
6453
 
       located to the LD_RUN_PATH environment variable before running
6454
 
       your client.
6455
 
 
6456
 
   If you have problems with configure trying to link with -lz when
6457
 
   you don't have zlib installed, you have two options:
6458
 
 
6459
 
     * If you want to be able to use the compressed communication
6460
 
       protocol, you need to get and install zlib from ftp.gnu.org.
6461
 
 
6462
 
     * Run configure with the --with-named-z-libs=no option when
6463
 
       building MySQL.
6464
 
 
6465
 
   If you are using gcc and have problems with loading user-defined
6466
 
   functions (UDFs) into MySQL, try adding -lgcc to the link line for
6467
 
   the UDF.
6468
 
 
6469
 
   If you would like MySQL to start automatically, you can copy
6470
 
   support-files/mysql.server to /etc/init.d and create a symbolic
6471
 
   link to it named /etc/rc3.d/S99mysql.server.
6472
 
 
6473
 
   If too many processes try to connect very rapidly to mysqld, you
6474
 
   should see this error in the MySQL log:
 
3984
     * If you install MySQL using a binary tarball distribution on
 
3985
       Solaris, you may run into trouble even before you get the
 
3986
       MySQL distribution unpacked, as the Solaris tar cannot handle
 
3987
       long file names. This means that you may see errors when you
 
3988
       try to unpack MySQL.
 
3989
       If this occurs, you must use GNU tar (gtar) to unpack the
 
3990
       distribution. In Solaris 10 and OpenSolaris gtar is normally
 
3991
       located in /usr/sfw/bin/gtar, but may not be included in the
 
3992
       default path definition.
 
3993
 
 
3994
     * When using Solaris 10 for x86_64, you should mount any file
 
3995
       systems on which you intend to store InnoDB files with the
 
3996
       forcedirectio option. (By default mounting is done without
 
3997
       this option.) Failing to do so will cause a significant drop
 
3998
       in performance when using the InnoDB storage engine on this
 
3999
       platform.
 
4000
 
 
4001
     * If you would like MySQL to start automatically, you can copy
 
4002
       support-files/mysql.server to /etc/init.d and create a
 
4003
       symbolic link to it named /etc/rc3.d/S99mysql.server.
 
4004
 
 
4005
     * If too many processes try to connect very rapidly to mysqld,
 
4006
       you should see this error in the MySQL log:
6475
4007
Error in accept: Protocol error
6476
 
 
6477
 
   You might try starting the server with the --back_log=50 option as
6478
 
   a workaround for this. (Use -O back_log=50 before MySQL 4.)
6479
 
 
6480
 
   To configure the generation of core files on Solaris you should
6481
 
   use the coreadm command. Because of the security implications of
6482
 
   generating a core on a setuid() application, by default, Solaris
6483
 
   does not support core files on setuid() programs. However, you can
6484
 
   modify this behavior using coreadm. If you enable setuid() core
6485
 
   files for the current user, they will be generated using the mode
6486
 
   600 and owned by the superuser.
6487
 
 
6488
 
2.9. Installing MySQL on i5/OS
 
4008
       You might try starting the server with the --back_log=50
 
4009
       option as a workaround for this.
 
4010
 
 
4011
     * To configure the generation of core files on Solaris you
 
4012
       should use the coreadm command. Because of the security
 
4013
       implications of generating a core on a setuid() application,
 
4014
       by default, Solaris does not support core files on setuid()
 
4015
       programs. However, you can modify this behavior using coreadm.
 
4016
       If you enable setuid() core files for the current user, they
 
4017
       will be generated using the mode 600 and owned by the
 
4018
       superuser.
 
4019
 
 
4020
2.6.1. Installing MySQL on Solaris using a Solaris PKG
 
4021
 
 
4022
   You can install MySQL on Solaris and OpenSolaris using a binary
 
4023
   package using the native Solaris PKG format instead of the binary
 
4024
   tarball distribution.
 
4025
 
 
4026
   To use this package, download the corresponding
 
4027
   mysql-VERSION-solaris10-PLATFORM.pkg.gz file, then decompress it.
 
4028
   For example:
 
4029
shell> gunzip mysql-5.1.62-solaris10-x86_64.pkg.gz
 
4030
 
 
4031
   To install a new package, use pkgadd and follow the onscreen
 
4032
   prompts. You must have root privileges to perform this operation:
 
4033
shell> pkgadd -d mysql-5.1.62-solaris10-x86_64.pkg
 
4034
 
 
4035
The following packages are available:
 
4036
  1  mysql     MySQL Community Server (GPL)
 
4037
               (i86pc) 5.1.62
 
4038
 
 
4039
Select package(s) you wish to process (or 'all' to process
 
4040
all packages). (default: all) [?,??,q]:
 
4041
 
 
4042
   The PKG installer installs all of the files and tools needed, and
 
4043
   then initializes your database if one does not exist. To complete
 
4044
   the installation, you should set the root password for MySQL as
 
4045
   provided in the instructions at the end of the installation.
 
4046
   Alternatively, you can run the mysql_secure_installation script
 
4047
   that comes with the installation.
 
4048
 
 
4049
   The default installation directory is /opt/mysql. You can only
 
4050
   change the root path of the installation when using pkgadd, which
 
4051
   can be used to install MySQL in a different Solaris zone. If you
 
4052
   need to install in a specific directory, use the binary tar file.
 
4053
 
 
4054
   The pkg installer copies a suitable startup script for MySQL into
 
4055
   /etc/init.d/mysql. To enable MySQL to startup and shutdown
 
4056
   automatically, you should create a link between this file and the
 
4057
   init script directories. For example, to ensure safe startup and
 
4058
   shutdown of MySQL you could use the following commands to add the
 
4059
   right links:
 
4060
shell> ln /etc/init.d/mysql /etc/rc3.d/S91mysql
 
4061
shell> ln /etc/init.d/mysql /etc/rc0.d/K02mysql
 
4062
 
 
4063
   To remove MySQL, the installed package name is mysql. You can use
 
4064
   this in combination with the pkgrm command to remove the
 
4065
   installation.
 
4066
 
 
4067
   To upgrade when using the Solaris package file format, you must
 
4068
   remove the existing installation before installing the updated
 
4069
   package. Removal of the package does not delete the existing
 
4070
   database information, only the server, binaries and support files.
 
4071
   The typical upgrade sequence is therefore:
 
4072
shell> mysqladmin shutdown
 
4073
shell> pkgrm mysql
 
4074
shell> pkgadd -d mysql-5.1.62-solaris10-x86_64.pkg
 
4075
shell> mysql_upgrade
 
4076
shell> mysqld_safe &
 
4077
 
 
4078
   You should check the notes in Section 2.13, "Upgrading or
 
4079
   Downgrading MySQL" before performing any upgrade.
 
4080
 
 
4081
2.6.2. Installing MySQL on OpenSolaris using IPS
 
4082
 
 
4083
   OpenSolaris includes standard packages for MySQL in the core
 
4084
   repository. The MySQL packages are based on a specific release of
 
4085
   MySQL and updated periodically. For the latest release you must
 
4086
   use either the native Solaris PKG, tar, or source installations.
 
4087
   The native OpenSolaris packages include SMF files so that you can
 
4088
   easily control your MySQL installation, including automatic
 
4089
   startup and recovery, using the native service management tools.
 
4090
 
 
4091
   To install MySQL on OpenSolaris, use the pkg command. You will
 
4092
   need to be logged in as root, or use the pfexec tool, as shown in
 
4093
   the example below:
 
4094
shell> pfexec pkg install SUNWmysql51
 
4095
 
 
4096
   The package set installs three individual packages,
 
4097
   SUNWmysql51lib, which contains the MySQL client libraries;
 
4098
   SUNWmysql51r which contains the root components, including SMF and
 
4099
   configuration files; and SUNWmysql51u which contains the scripts,
 
4100
   binary tools and other files. You can install these packages
 
4101
   individually if you only need the corresponding components.
 
4102
 
 
4103
   The MySQL files are installed into /usr/mysql which symbolic links
 
4104
   for the sub directories (bin, lib, etc.) to a version specific
 
4105
   directory. For MySQL 5.1, the full installation is located in
 
4106
   /usr/mysql/5.1. The default data directory is /var/mysql/5.1/data.
 
4107
   The configuration file is installed in /etc/mysql/5.1/my.cnf. This
 
4108
   layout permits multiple versions of MySQL to be installed, without
 
4109
   overwriting the data and binaries from other versions.
 
4110
 
 
4111
   Once installed, you must run mysql_install_db to initialize the
 
4112
   database, and use the mysql_secure_installation to secure your
 
4113
   installation.
 
4114
 
 
4115
Using SMF to manage your MySQL installation
 
4116
 
 
4117
   Once installed, you can start and stop your MySQL server using the
 
4118
   installed SMF configuration. The service name is mysql, or if you
 
4119
   have multiple versions installed, you should use the full version
 
4120
   name, for example mysql:version_51. To start and enable MySQL to
 
4121
   be started at boot time:
 
4122
shell> svcadm enable mysql
 
4123
 
 
4124
   To disable MySQL from starting during boot time, and shut the
 
4125
   MySQL server down if it is running, use:
 
4126
shell> svcadm disable mysql
 
4127
 
 
4128
   To restart MySQL, for example after a configuration file changes,
 
4129
   use the restart option:
 
4130
shell> svcadm restart mysql
 
4131
 
 
4132
   You can also use SMF to configure the data directory and enable
 
4133
   full 64-bit mode. For example, to set the data directory used by
 
4134
   MySQL:
 
4135
shell> svccfg
 
4136
svc:> select mysql:version_51
 
4137
svc:/application/database/mysql:version_51> setprop mysql/data=/data0
 
4138
/mysql
 
4139
 
 
4140
 
 
4141
   By default, the 32-bit binaries are used. To enable the 64-bit
 
4142
   server on 64-bit platforms, set the enable_64bit parameter. For
 
4143
   example:
 
4144
svc:/application/database/mysql:version_51> setprop mysql/enable_64bi
 
4145
t=1
 
4146
 
 
4147
   You need to refresh the SMF after settings these options:
 
4148
shell> svcadm refresh mysql
 
4149
 
 
4150
2.7. Installing MySQL on IBM AIX
 
4151
 
 
4152
   MySQL for IBM AIX is available in a number of different forms:
 
4153
 
 
4154
     * Using a binary tarball distribution provided at
 
4155
       http://dev.mysql.com/downloads/. Please read the general notes
 
4156
       on AIX installation before continuing. For more information on
 
4157
       binary installations, see Section 2.2, "Installing MySQL from
 
4158
       Generic Binaries on Unix/Linux."
 
4159
 
 
4160
     * Using a source tarball and compiling MySQL. Please read the
 
4161
       general notes on AIX installation before continuing. You
 
4162
       should also check the instructions on building on AIX from
 
4163
       source. For general information on building from source, see
 
4164
       Section 2.11, "Installing MySQL from Source."
 
4165
 
 
4166
2.7.1. General Notes on Installing MySQL on AIX
 
4167
 
 
4168
   General notes on using MySQL on IBM AIX:
 
4169
 
 
4170
     * If you have problems with threads on AIX 5.3, you should
 
4171
       upgrade AIX 5.3 to technology level 7 (5300-07).
 
4172
 
 
4173
2.8. Installing MySQL on HP-UX
 
4174
 
 
4175
   MySQL for HP-UX is available in a number of different forms:
 
4176
 
 
4177
     * Using a DEPOT distribution provided at
 
4178
       http://dev.mysql.com/downloads/. Please read the general notes
 
4179
       on HP-UX installation before continuing. For more information
 
4180
       on DEPOT installations, see Section 2.8.2, "Installing MySQL
 
4181
       on HP-UX using DEPOT."
 
4182
 
 
4183
     * Using a binary tarball distribution provided at
 
4184
       http://dev.mysql.com/downloads/. Please read the general notes
 
4185
       on HP-UX installation before continuing. For more information
 
4186
       on binary installations, see Section 2.2, "Installing MySQL
 
4187
       from Generic Binaries on Unix/Linux."
 
4188
 
 
4189
     * Using a source tarball and compiling MySQL. Please read the
 
4190
       general notes on HP-UX installation before continuing. You
 
4191
       should also check the instructions on building on HP-UX from
 
4192
       source. For general information on building from source, see
 
4193
       Section 2.11, "Installing MySQL from Source."
 
4194
 
 
4195
2.8.1. General Notes on Installing MySQL on HP-UX
 
4196
 
 
4197
   Some additional notes on installing and using MySQL on HP-UX:
 
4198
 
 
4199
     * If you install MySQL using a binary tarball distribution on
 
4200
       HP-UX, you may run into trouble even before you get the MySQL
 
4201
       distribution unpacked, as the HP-UX tar cannot handle long
 
4202
       file names. This means that you may see errors when you try to
 
4203
       unpack MySQL.
 
4204
       If this occurs, you must use GNU tar (gtar) to unpack the
 
4205
       distribution.
 
4206
 
 
4207
     * Because of some critical bugs in the standard HP-UX libraries,
 
4208
       you should install the following patches before trying to run
 
4209
       MySQL on HP-UX 11.0:
 
4210
PHKL_22840 Streams cumulative
 
4211
PHNE_22397 ARPA cumulative
 
4212
       This solves the problem of getting EWOULDBLOCK from recv() and
 
4213
       EBADF from accept() in threaded applications.
 
4214
 
 
4215
2.8.2. Installing MySQL on HP-UX using DEPOT
 
4216
 
 
4217
   The HP-UX DEPOT format packages can be installed using the
 
4218
   swinstall command. You should install the ncurses and zlib
 
4219
   libraries before installing the MySQL DEPOT package. You can use
 
4220
   the free software depothelper tool to install these packages and
 
4221
   any dependencies for you automatically.
 
4222
 
 
4223
   To install using the MySQL DEPOT packages, follow this guide:
 
4224
 
 
4225
    1. Download the MySQL DEPOT package from
 
4226
       http://dev.mysql.com/downloads/. You must decompress the
 
4227
       package before installation:
 
4228
root-shell> gunzip mysql-5.1.48-hpux11.31-ia64-64bit.depot.gz
 
4229
 
 
4230
    2. Install the DEPOT package using swinstall:
 
4231
root-shell> swinstall -s mysql-5.1.49-hpux11.31-ia64-64bit.depot
 
4232
       MySQL will be installed into a directory matching the depot
 
4233
       package name, within /usr/local. For convenience, you may want
 
4234
       to create a symbolic link to the installed directory, for
 
4235
       example:
 
4236
root-shell> ln -s mysql-5.1.49-hpux11.31-ia64-64bit mysql
 
4237
 
 
4238
    3. Your package is now installed. You should complete the
 
4239
       configuration of MySQL by creating a user and group:
 
4240
root-shell> /usr/sbin/groupadd mysql
 
4241
root-shell> /usr/sbin/useradd -g mysql -d /var/lib/mysql/ -s /bin/fal
 
4242
se mysql
 
4243
 
 
4244
    4. Create the standard database using the new user/group you have
 
4245
       created, and set the permissions:
 
4246
root-shell> cd /usr/local/
 
4247
root-shell> scripts/mysql_install_db --user=mysql
 
4248
root-shell> chown -R root .
 
4249
root-shell> chown -R mysql data
 
4250
 
 
4251
    5. Finally, secure your new installation by setting the root
 
4252
       passwords, and then start your MySQL server using the mysql
 
4253
       user:
 
4254
root-shell> mysql_secure_installation
 
4255
root-shell> mysqld_safe --user=mysql &
 
4256
 
 
4257
2.9. Installing MySQL on FreeBSD
 
4258
 
 
4259
   This section provides information about installing MySQL on
 
4260
   variants of FreeBSD Unix.
 
4261
 
 
4262
   You can install MySQL on FreeBSD by using the binary distribution
 
4263
   provided by Oracle. For more information, see Section 2.2,
 
4264
   "Installing MySQL from Generic Binaries on Unix/Linux."
 
4265
 
 
4266
   The easiest (and preferred) way to install MySQL is to use the
 
4267
   mysql-server and mysql-client ports available at
 
4268
   http://www.freebsd.org/. Using these ports gives you the following
 
4269
   benefits:
 
4270
 
 
4271
     * A working MySQL with all optimizations enabled that are known
 
4272
       to work on your version of FreeBSD.
 
4273
 
 
4274
     * Automatic configuration and build.
 
4275
 
 
4276
     * Startup scripts installed in /usr/local/etc/rc.d.
 
4277
 
 
4278
     * The ability to use pkg_info -L to see which files are
 
4279
       installed.
 
4280
 
 
4281
     * The ability to use pkg_delete to remove MySQL if you no longer
 
4282
       want it on your machine.
 
4283
 
 
4284
   The MySQL build process requires GNU make (gmake) to work. If GNU
 
4285
   make is not available, you must install it first before compiling
 
4286
   MySQL.
 
4287
 
 
4288
   To install using the ports system:
 
4289
# cd /usr/ports/databases/mysql51-server
 
4290
# make
 
4291
...
 
4292
# cd /usr/ports/databases/mysql51-client
 
4293
# make
 
4294
...
 
4295
 
 
4296
   The standard port installation places the server into
 
4297
   /usr/local/libexec/mysqld, with the startup script for the MySQL
 
4298
   server placed in /usr/local/etc/rc.d/mysql-server.
 
4299
 
 
4300
   Some additional notes on the BSD implementation:
 
4301
 
 
4302
     * To remove MySQL after installation using the ports system:
 
4303
# cd /usr/ports/databases/mysql51-server
 
4304
# make deinstall
 
4305
...
 
4306
# cd /usr/ports/databases/mysql51-client
 
4307
# make deinstall
 
4308
...
 
4309
 
 
4310
     * If you get problems with the current date in MySQL, setting
 
4311
       the TZ variable should help. See Section 2.14, "Environment
 
4312
       Variables."
 
4313
 
 
4314
2.10. Installing MySQL on i5/OS
6489
4315
 
6490
4316
   The i5/OS POWER MySQL package was created in cooperation with IBM.
6491
4317
   MySQL works within the Portable Application Solution Environment
6506
4332
   starting installation. See i5/OS Installation Notes.
6507
4333
 
6508
4334
   Before Installation:
6509
 
 
6510
 
Note
 
4335
   Note
6511
4336
 
6512
4337
   The installation package will use an existing configuration if you
6513
4338
   have previously installed MySQL (which is identified by looking
6550
4375
CRTSAVF FILE(QGPL/MYSQLINST) TESXT('MySQL Save file')
6551
4376
 
6552
4377
    2. Download the MySQL installation save file in 32-bit
6553
 
       (mysql-5.1.39-i5os-power-32bit.savf) or 64-bit
6554
 
       (mysql-5.1.39-i5os-power-64bit.savf) from MySQL Downloads
 
4378
       (mysql-5.1.62-i5os-power-32bit.savf) or 64-bit
 
4379
       (mysql-5.1.62-i5os-power-64bit.savf) from MySQL Downloads
6555
4380
       (http://dev.mysql.com/downloads).
6556
4381
 
6557
4382
    3. You need to FTP the downloaded .savf file directly into the
6560
4385
       System i machine:
6561
4386
ftp> bin
6562
4387
ftp> cd qgpl
6563
 
ftp> put mysql-5.1.39-i5os-power.savf mysqlinst
 
4388
ftp> put mysql-5.1.62-i5os-power.savf mysqlinst
6564
4389
 
6565
4390
    4. Log into the System i server using a user in the *SECOFR
6566
4391
       class, such as the QSECOFR user ID.
6569
4394
       .savf save file:
6570
4395
RSTLIB MYSQLINST DEV(*SAVF) SAVF(QGPL/MYSQLINST) MBROPT(*ALL) ALWOBJD
6571
4396
IF(*ALL)
6572
 
 
6573
 
Note
 
4397
       Note
6574
4398
       You can ignore the security changes-type message at the bottom
6575
4399
       of the installation panel.
6576
4400
 
6598
4422
          + USRPRF(MYSQL) sets the user profile that will own the
6599
4423
            files that are installed. The profile will be created if
6600
4424
            it does not already exist.
6601
 
 
6602
 
Note
 
4425
            Note
6603
4426
            You should choose an appropriate user for using the MySQL
6604
4427
            server installation. The user will be used whenever you
6605
4428
            need to do any administration on the MySQL server.
6617
4440
       installation.
6618
4441
       Once the installation has been completed, you will get a
6619
4442
       notice advising you to set the password for the root user. For
6620
 
       more information, Section 2.13, "Post-Installation Setup and
 
4443
       more information, Section 2.12, "Postinstallation Setup and
6621
4444
       Testing."
6622
4445
 
6623
4446
    8. Once the installation has completed, you can delete the
6626
4449
 
6627
4450
   Upgrading an existing MySQL instance
6628
4451
 
6629
 
   You need to execute the upgrade command, MYSQLINST/UPGMYSQL. You
6630
 
   must specify 6 parameters to perform an upgrade:
6631
 
 
6632
 
     * DIR('/QOpenSys/usr/local/') --- sets the installation location
 
4452
   You need to execute the upgrade command, MYSQLINST/UPGMYSQL.
 
4453
   Note
 
4454
 
 
4455
   You cannot use MYSQLINST/UPGMYSQL to upgrade between major
 
4456
   versions of MySQL (for example from 5.0 to 5.1). For information
 
4457
   and advice on migrating between major versions you can use the
 
4458
   advice provided in Section 2.13.1.1, "Upgrading from MySQL 5.0 to
 
4459
   5.1."
 
4460
 
 
4461
   You must specify 6 parameters to perform an upgrade:
 
4462
 
 
4463
     * DIR('/QOpenSys/usr/local/'): Sets the installation location
6633
4464
       for the MySQL files. The directory will be created if it does
6634
4465
       not already exist. This is the directory that the MySQL server
6635
4466
       will be installed into, inside a directory with a name
6636
 
       matching the version and release. For example if installing
6637
 
       MySQL 5.1.39 with the DIR set to /QOpenSys/usr/local/ would
6638
 
       result in /QOpenSys/usr/local/mysql-5.1.39-i5os-power64 and a
 
4467
       matching the version and release. For example, if installing
 
4468
       MySQL 5.1.62 with the DIR set to /QOpenSys/usr/local/ would
 
4469
       result in /QOpenSys/usr/local/mysql-5.1.62-i5os-power64 and a
6639
4470
       symbolic link to this directory will be created in
6640
4471
       /QOpenSys/usr/local/mysql.
6641
4472
 
6642
 
     * DATADIR('/QOpenSys/mysql/data') --- sets the location of the
 
4473
     * DATADIR('/QOpenSys/mysql/data'): Sets the location of the
6643
4474
       directory that will be upgraded.
6644
4475
 
6645
 
     * USRPRF('MYSQL') --- sets the user profile that will own the
6646
 
       files that are installed. The profile will be created if it
6647
 
       does not already exist; if it is created as part of the
6648
 
       upgrade process, it will be disabled initially. You may wish
6649
 
       to enable this user profile so that it can be used to start
6650
 
       the MySQL server later. It is best practice to use the one
6651
 
       previously created during the first installation.
6652
 
 
6653
 
     * MYSQLUSR('root user') --- any user account in the current
6654
 
       MySQL server with SUPER privileges.
6655
 
 
6656
 
     * PASSWORD('root user password') --- the password for the above
 
4476
     * USRPRF('MYSQL'): Sets the user profile that will own the files
 
4477
       that are installed. The profile will be created if it does not
 
4478
       already exist; if it is created as part of the upgrade
 
4479
       process, it will be disabled initially. You may wish to enable
 
4480
       this user profile so that it can be used to start the MySQL
 
4481
       server later. It is best practice to use the one previously
 
4482
       created during the first installation.
 
4483
 
 
4484
     * MYSQLUSR('root user'): Any user account in the current MySQL
 
4485
       server with SUPER privileges.
 
4486
 
 
4487
     * PASSWORD('root user password'): The password for the above
6657
4488
       account. This is necessary as the upgrade starts the MySQL
6658
4489
       server to upgrade the tables and the password is need to be
6659
4490
       able to shutdown the MySQL server.
6660
4491
 
6661
 
     * CURINST('path to previous install') --- the full path to the
 
4492
     * CURINST('path to previous install'): The full path to the
6662
4493
       installation that is being upgraded. For example an
6663
4494
       installation in /QOpenSys/usr/local/ will be
6664
 
       /QOpenSys/usr/local/msyql-5.1.30-i5os-power64. Failure to
 
4495
       /QOpenSys/usr/local/mysql-5.1.62-i5os-power64. Failure to
6665
4496
       specify this option may result in corruption of your existing
6666
4497
       data files.
6667
4498
 
6669
4500
MYSQLINST/UPGMYSQL DIR('/QOpenSys/usr/local/') DATADIR('/QOpenSys/mys
6670
4501
ql/data') Ā»
6671
4502
     USERPRF(MYSQL) MYSQLUSR('root') PASSWORD('root') CURINST('/QOpen
6672
 
Sys/usr/local/mysql-5.1.30-i5os-power64')
 
4503
Sys/usr/local/mysql-5.1.62-i5os-power64')
6673
4504
 
6674
4505
   You should receive a Program Message indicating UPGRADE
6675
4506
   SUCCESSFUL! upon completion or an error message if there is a
6680
4511
 
6681
4512
    1. Log into the System i server using the user profile create or
6682
4513
       specified during installation. By default, this is MYSQL.
6683
 
 
6684
 
Note
 
4514
       Note
6685
4515
       You should start mysqld_safe using a user that in the PASE
6686
4516
       environment has the id=0 (the equivalent of the standard Unix
6687
4517
       root user). If you do not use a user with this ID then the
6704
4534
     from /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data
6705
4535
 
6706
4536
   If you are having problems starting MySQL server, see Section
6707
 
   2.13.1.3, "Starting and Troubleshooting the MySQL Server."
 
4537
   2.12.1.3, "Starting and Troubleshooting the MySQL Server."
6708
4538
 
6709
4539
   To stop MySQL:
6710
4540
 
6743
4573
       (5799-PTL). See
6744
4574
       http://www-03.ibm.com/servers/enable/site/porting/tools/.
6745
4575
 
6746
 
2.10. Installing MySQL on FreeBSD
6747
 
 
6748
 
   This section provides information about using MySQL on variants of
6749
 
   FreeBSD Unix.
6750
 
 
6751
 
   The easiest (and preferred) way to install MySQL is to use the
6752
 
   mysql-server and mysql-client ports available at
6753
 
   http://www.freebsd.org/. Using these ports gives you the following
6754
 
   benefits:
6755
 
 
6756
 
     * A working MySQL with all optimizations enabled that are known
6757
 
       to work on your version of FreeBSD.
6758
 
 
6759
 
     * Automatic configuration and build.
6760
 
 
6761
 
     * Startup scripts installed in /usr/local/etc/rc.d.
6762
 
 
6763
 
     * The ability to use pkg_info -L to see which files are
6764
 
       installed.
6765
 
 
6766
 
     * The ability to use pkg_delete to remove MySQL if you no longer
6767
 
       want it on your machine.
6768
 
 
6769
 
   The MySQL build process requires GNU make (gmake) to work. If GNU
6770
 
   make is not available, you must install it first before compiling
6771
 
   MySQL.
6772
 
 
6773
 
   The recommended way to compile and install MySQL on FreeBSD with
6774
 
   gcc (2.95.2 and up) is:
6775
 
CC=gcc CFLAGS="-O2 -fno-strength-reduce" \
6776
 
    CXX=gcc CXXFLAGS="-O2 -fno-rtti -fno-exceptions \
6777
 
    -felide-constructors -fno-strength-reduce" \
6778
 
    ./configure --prefix=/usr/local/mysql --enable-assembler
6779
 
gmake
6780
 
gmake install
6781
 
cd /usr/local/mysql
6782
 
bin/mysql_install_db --user=mysql
6783
 
bin/mysqld_safe &
6784
 
 
6785
 
   FreeBSD is known to have a very low default file handle limit. See
6786
 
   Section B.5.2.18, "'File' Not Found and Similar Errors." Start the
6787
 
   server by using the --open-files-limit option for mysqld_safe, or
6788
 
   raise the limits for the mysqld user in /etc/login.conf and
6789
 
   rebuild it with cap_mkdb /etc/login.conf. Also be sure that you
6790
 
   set the appropriate class for this user in the password file if
6791
 
   you are not using the default (use chpass mysqld-user-name). See
6792
 
   Section 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
6793
 
 
6794
 
   In current versions of FreeBSD (at least 4.x and greater), you may
6795
 
   increase the limit on the amount of memory available for a process
6796
 
   by adding the following entries to the /boot/loader.conf file and
6797
 
   rebooting the machine (these are not settings that can be changed
6798
 
   at run time with the sysctl command):
6799
 
kern.maxdsiz="1073741824" # 1GB
6800
 
kern.dfldsiz="1073741824" # 1GB
6801
 
kern.maxssiz="134217728" # 128MB
6802
 
 
6803
 
   For older versions of FreeBSD, you must recompile your kernel to
6804
 
   change the maximum data segment size for a process. In this case,
6805
 
   you should look at the MAXDSIZ option in the LINT config file for
6806
 
   more information.
6807
 
 
6808
 
   If you get problems with the current date in MySQL, setting the TZ
6809
 
   variable should help. See Section 2.14, "Environment Variables."
6810
 
 
6811
 
2.11. Installing MySQL on HP-UX
6812
 
 
6813
 
   If you install MySQL using a binary tarball distribution on HP-UX,
6814
 
   you may run into trouble even before you get the MySQL
6815
 
   distribution unpacked, as the HP-UX tar cannot handle long file
6816
 
   names. This means that you may see errors when you try to unpack
6817
 
   MySQL.
6818
 
 
6819
 
   If this occurs, you must use GNU tar (gtar) to unpack the
6820
 
   distribution.
6821
 
 
6822
 
   Because of some critical bugs in the standard HP-UX libraries, you
6823
 
   should install the following patches before trying to run MySQL on
6824
 
   HP-UX 11.0:
6825
 
PHKL_22840 Streams cumulative
6826
 
PHNE_22397 ARPA cumulative
6827
 
 
6828
 
   This solves the problem of getting EWOULDBLOCK from recv() and
6829
 
   EBADF from accept() in threaded applications.
6830
 
 
6831
 
   If you are using gcc 2.95.1 on an unpatched HP-UX 11.x system, you
6832
 
   may get the following error:
6833
 
In file included from /usr/include/unistd.h:11,
6834
 
                 from ../include/global.h:125,
6835
 
                 from mysql_priv.h:15,
6836
 
                 from item.cc:19:
6837
 
/usr/include/sys/unistd.h:184: declaration of C function ...
6838
 
/usr/include/sys/pthread.h:440: previous declaration ...
6839
 
In file included from item.h:306,
6840
 
                 from mysql_priv.h:158,
6841
 
                 from item.cc:19:
6842
 
 
6843
 
   The problem is that HP-UX does not define pthreads_atfork()
6844
 
   consistently. It has conflicting prototypes in
6845
 
   /usr/include/sys/unistd.h:184 and /usr/include/sys/pthread.h:440.
6846
 
 
6847
 
   One solution is to copy /usr/include/sys/unistd.h into
6848
 
   mysql/include and edit unistd.h and change it to match the
6849
 
   definition in pthread.h. Look for this line:
6850
 
extern int pthread_atfork(void (*prepare)(), void (*parent)(),
6851
 
                                          void (*child)());
6852
 
 
6853
 
   Change it to look like this:
6854
 
extern int pthread_atfork(void (*prepare)(void), void (*parent)(void)
6855
 
,
6856
 
                                          void (*child)(void));
6857
 
 
6858
 
   After making the change, the following configure line should work:
6859
 
CFLAGS="-fomit-frame-pointer -O3 -fpic" CXX=gcc \
6860
 
CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -O3" \
6861
 
./configure --prefix=/usr/local/mysql --disable-shared
6862
 
 
6863
 
   If you are using HP-UX compiler, you can use the following command
6864
 
   (which has been tested with cc B.11.11.04):
6865
 
CC=cc CXX=aCC CFLAGS=+DD64 CXXFLAGS=+DD64 ./configure \
6866
 
    --with-extra-character-set=complex
6867
 
 
6868
 
   You can ignore any errors of the following type:
6869
 
aCC: warning 901: unknown option: `-3': use +help for online
6870
 
documentation
6871
 
 
6872
 
   If you get the following error from configure, verify that you
6873
 
   don't have the path to the K&R compiler before the path to the
6874
 
   HP-UX C and C++ compiler:
6875
 
checking for cc option to accept ANSI C... no
6876
 
configure: error: MySQL requires an ANSI C compiler (and a C++ compil
6877
 
er).
6878
 
Try gcc. See the Installation chapter in the Reference Manual.
6879
 
 
6880
 
   Another reason for not being able to compile is that you didn't
6881
 
   define the +DD64 flags as just described.
6882
 
 
6883
 
   Another possibility for HP-UX 11 is to use the MySQL binaries
6884
 
   provided at http://dev.mysql.com/downloads/, which we have built
6885
 
   and tested ourselves. We have also received reports that the HP-UX
6886
 
   10.20 binaries supplied by MySQL can be run successfully on HP-UX
6887
 
   11. If you encounter problems, you should be sure to check your
6888
 
   HP-UX patch level.
6889
 
 
6890
 
2.12. Installing MySQL on AIX
6891
 
 
6892
 
   Automatic detection of xlC is missing from Autoconf, so a number
6893
 
   of variables need to be set before running configure. The
6894
 
   following example uses the IBM compiler:
 
4576
2.11. Installing MySQL from Source
 
4577
 
 
4578
   Building MySQL from the source code enables you to customize build
 
4579
   parameters, compiler optimizations, and installation location. For
 
4580
   a list of systems on which MySQL is known to run, see Section
 
4581
   2.1.1, "Operating Systems Supported by MySQL Community Server."
 
4582
 
 
4583
   Before you proceed with an installation from source, check whether
 
4584
   we produce a precompiled binary distribution for your platform and
 
4585
   whether it works for you. We put a great deal of effort into
 
4586
   ensuring that our binaries are built with the best possible
 
4587
   options for optimal performance. Instructions for installing
 
4588
   binary distributions are available in Section 2.2, "Installing
 
4589
   MySQL from Generic Binaries on Unix/Linux."
 
4590
 
 
4591
   To obtain a source distribution for MySQL, see Section 2.1.3, "How
 
4592
   to Get MySQL." MySQL source distributions are available as
 
4593
   compressed tar files, Zip archives, or RPM packages. Distribution
 
4594
   files have names of the form mysql-VERSION.tar.gz,
 
4595
   mysql-VERSION.zip, or mysql-VERSION.rpm, where VERSION is a number
 
4596
   like 5.1.62.
 
4597
 
 
4598
   To perform a MySQL installation using the source code:
 
4599
 
 
4600
     * To build MySQL from source on Unix-like systems, including
 
4601
       Linux, commercial Unix, BSD, Mac OS X and others using a
 
4602
       .tar.gz or RPM-based source code distribution, see Section
 
4603
       2.11.2, "Installing MySQL from a Standard Source
 
4604
       Distribution."
 
4605
 
 
4606
     * To build MySQL from source on Windows (Windows XP or newer
 
4607
       required), see Section 2.11.7, "Installing MySQL from Source
 
4608
       on Windows."
 
4609
 
 
4610
     * For information on building from one of our development trees,
 
4611
       see Section 2.11.3, "Installing MySQL from a Development
 
4612
       Source Tree."
 
4613
 
 
4614
     * For information on using the configure command to specify the
 
4615
       source build parameters, including links to platform specific
 
4616
       parameters that you might need, see Section 2.11.4, "MySQL
 
4617
       Source-Configuration Options."
 
4618
 
 
4619
   To install MySQL from source, your system must have the following
 
4620
   tools:
 
4621
 
 
4622
     * GNU gunzip to uncompress the distribution and a reasonable tar
 
4623
       to unpack it (if you use a .tar.gz distribution), or WinZip or
 
4624
       another tool that can read .zip files (if you use a .zip
 
4625
       distribution).
 
4626
       GNU tar is known to work. The standard tar provided with some
 
4627
       operating systems is not able to unpack the long file names in
 
4628
       the MySQL distribution. You should download and install GNU
 
4629
       tar, or if available, use a preinstalled version of GNU tar.
 
4630
       Usually this is available as gnutar, gtar, or as tar within a
 
4631
       GNU or Free Software directory, such as /usr/sfw/bin or
 
4632
       /usr/local/bin. GNU tar is available from
 
4633
       http://www.gnu.org/software/tar/.
 
4634
 
 
4635
     * A working ANSI C++ compiler. GCC 3.4.6 or later, Sun Studio 10
 
4636
       or later, Visual Studio 2005 or later, and many current
 
4637
       vendor-supplied compilers are known to work.
 
4638
 
 
4639
     * A good make program. Although some platforms come with their
 
4640
       own make implementations, it is highly recommended that you
 
4641
       use GNU make 3.75 or newer. It may already be available on
 
4642
       your system as gmake. GNU make is available from
 
4643
       http://www.gnu.org/software/make/.
 
4644
 
 
4645
     * libtool 1.5, available from
 
4646
       http://www.gnu.org/software/libtool/. 1.5.24 or later is
 
4647
       recommended.
 
4648
 
 
4649
   If you run into problems and need to file a bug report, please use
 
4650
   the instructions in Section 1.7, "How to Report Bugs or Problems."
 
4651
 
 
4652
2.11.1. MySQL Layout for Source Installation
 
4653
 
 
4654
   By default, when you install MySQL after compiling it from a
 
4655
   source distribution, the installation step installs files under
 
4656
   /usr/local. Components are installed in the directories shown in
 
4657
   the following table. To configure particular installation
 
4658
   locations, use the options described at Section 2.11.4, "MySQL
 
4659
   Source-Configuration Options."
 
4660
 
 
4661
   Table 2.18. MySQL Layout for Installation from Source
 
4662
   Directory Contents of Directory
 
4663
   bin Client programs and scripts
 
4664
   include/mysql Include (header) files
 
4665
   Docs Manual in Info format
 
4666
   man Unix manual pages
 
4667
   lib/mysql Libraries
 
4668
   libexec The mysqld server
 
4669
   share/mysql Miscellaneous support files, including error messages,
 
4670
   sample configuration files, SQL for database installation
 
4671
   sql-bench Benchmarks
 
4672
   var Log files, databases
 
4673
 
 
4674
   Within its installation directory, the layout of a source
 
4675
   installation differs from that of a binary installation in the
 
4676
   following ways:
 
4677
 
 
4678
     * The mysqld server is installed in the libexec directory rather
 
4679
       than in the bin directory.
 
4680
 
 
4681
     * The data directory is var rather than data.
 
4682
 
 
4683
     * mysql_install_db is installed in the bin directory rather than
 
4684
       in the scripts directory.
 
4685
 
 
4686
     * The header file and library directories are include/mysql and
 
4687
       lib/mysql rather than include and lib.
 
4688
 
 
4689
2.11.2. Installing MySQL from a Standard Source Distribution
 
4690
 
 
4691
   To install MySQL from source, first configure, build, and install
 
4692
   from a source package. Then follow the same postinstallation setup
 
4693
   sequence as for a binary installation.
 
4694
 
 
4695
   If you start from a source RPM, use the following command to make
 
4696
   a binary RPM that you can install. If you do not have rpmbuild,
 
4697
   use rpm instead.
 
4698
shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm
 
4699
 
 
4700
   The result is one or more binary RPM packages that you install as
 
4701
   indicated in Section 2.5.1, "Installing MySQL from RPM Packages on
 
4702
   Linux."
 
4703
 
 
4704
   The sequence for installation from a compressed tar file source
 
4705
   distribution is similar to the process for installing from a
 
4706
   generic binary distribution that is detailed in Section 2.2,
 
4707
   "Installing MySQL from Generic Binaries on Unix/Linux." For a
 
4708
   MySQL .tar.gz source distribution, the basic installation command
 
4709
   sequence looks like this:
 
4710
# Preconfiguration setup
 
4711
shell> groupadd mysql
 
4712
shell> useradd -g mysql mysql
 
4713
# Beginning of source-build specific instructions
 
4714
shell> tar zxvf mysql-VERSION.tar.gz
 
4715
shell> cd mysql-VERSION
 
4716
shell> ./configure --prefix=/usr/local/mysql
 
4717
shell> make
 
4718
shell> make install
 
4719
# End of source-build specific instructions
 
4720
# Postinstallation setup
 
4721
shell> cd /usr/local/mysql
 
4722
shell> chown -R mysql .
 
4723
shell> chgrp -R mysql .
 
4724
shell> bin/mysql_install_db --user=mysql
 
4725
shell> chown -R root .
 
4726
shell> chown -R mysql var
 
4727
# Next command is optional
 
4728
shell> cp support-files/my-medium.cnf /etc/my.cnf
 
4729
shell> bin/mysqld_safe --user=mysql &
 
4730
# Next command is optional
 
4731
shell> cp support-files/mysql.server /etc/init.d/mysql.server
 
4732
 
 
4733
   A more detailed version of the source-build specific instructions
 
4734
   is shown following. Perform the following steps as the mysql user,
 
4735
   except as noted.
 
4736
   Note
 
4737
 
 
4738
   The procedure shown here does not set up any passwords for MySQL
 
4739
   accounts. After following the procedure, proceed to Section 2.12,
 
4740
   "Postinstallation Setup and Testing," for postinstallation setup
 
4741
   and testing.
 
4742
 
 
4743
    1. Set up the mysql user and group that will be used to run and
 
4744
       execute the MySQL server and own the database directory. For
 
4745
       details, see Creating a mysql System User and Group, in
 
4746
       Section 2.2, "Installing MySQL from Generic Binaries on
 
4747
       Unix/Linux."
 
4748
 
 
4749
    2. Pick the directory under which you want to unpack the
 
4750
       distribution and change location into it.
 
4751
 
 
4752
    3. Obtain a distribution file using the instructions in Section
 
4753
       2.1.3, "How to Get MySQL."
 
4754
 
 
4755
    4. Unpack the distribution into the current directory. tar can
 
4756
       uncompress and unpack the distribution if it has z option
 
4757
       support:
 
4758
shell> tar zxvf /path/to/mysql-VERSION.tar.gz
 
4759
       This command creates a directory named mysql-VERSION.
 
4760
       If your tar does not have z option support, use gunzip to
 
4761
       unpack the distribution and tar to unpack it:
 
4762
shell> gunzip < /path/to/mysql-VERSION.tar.gz | tar xvf -
 
4763
 
 
4764
    5. Change location into the top-level directory of the unpacked
 
4765
       distribution:
 
4766
shell> cd mysql-VERSION
 
4767
 
 
4768
    6. Configure the source directory:
 
4769
shell> ./configure --prefix=/usr/local/mysql
 
4770
       When you run configure, you might want to specify other
 
4771
       options. For example, if you need to debug mysqld or a MySQL
 
4772
       client, run configure with the --with-debug option, and then
 
4773
       recompile and link your clients with the new client library.
 
4774
       See MySQL Internals: Porting
 
4775
       (http://forge.mysql.com/wiki/MySQL_Internals_Porting).
 
4776
       Run ./configure --help for a list of options. Section 2.11.4,
 
4777
       "MySQL Source-Configuration Options," discusses some of the
 
4778
       more useful options.
 
4779
       If configure fails and you are going to send mail to a MySQL
 
4780
       mailing list to ask for assistance, please include any lines
 
4781
       from config.log that you think can help solve the problem.
 
4782
       Also include the last couple of lines of output from
 
4783
       configure. To file a bug report, please use the instructions
 
4784
       in Section 1.7, "How to Report Bugs or Problems."
 
4785
 
 
4786
    7. Compile the source distribution:
 
4787
shell> make
 
4788
       Use gmake instead on systems where you are using GNU make and
 
4789
       it has been installed as gmake.
 
4790
       If the compile fails, see Section 2.11.5, "Dealing with
 
4791
       Problems Compiling MySQL," for help.
 
4792
 
 
4793
    8. Install the distribution:
 
4794
shell> make install
 
4795
       You might need to run this command as root.
 
4796
 
 
4797
   The remainder of the installation process, including setting up
 
4798
   the configuration file, creating the core databases, and starting
 
4799
   the MySQL server, are identical to the remainder of the process as
 
4800
   shown in Generic Binary Install.
 
4801
 
 
4802
   After everything has been installed, test the distribution. To
 
4803
   start the MySQL server, use the following command:
 
4804
shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &
 
4805
 
 
4806
   If you run the command as root, you should use the --user option
 
4807
   as shown. The option value is the name of the login account that
 
4808
   you created in the first step to use for running the server. If
 
4809
   you run the mysqld_safe command while logged in as that user, you
 
4810
   can omit the --user option.
 
4811
 
 
4812
   If the command fails immediately and prints mysqld ended, look for
 
4813
   information in the error log (which by default is the
 
4814
   host_name.err file in the data directory).
 
4815
 
 
4816
   For more information about mysqld_safe, see Section 4.3.2,
 
4817
   "mysqld_safe --- MySQL Server Startup Script."
 
4818
 
 
4819
   To make it more convenient to invoke programs installed in
 
4820
   /usr/local/mysql/bin, you can add that directory to your PATH
 
4821
   environment variable setting. That enables you to run a program by
 
4822
   typing only its name, not its entire path name. See Section 4.2.4,
 
4823
   "Setting Environment Variables."
 
4824
   Note
 
4825
 
 
4826
   The accounts that are listed in the MySQL grant tables initially
 
4827
   have no passwords. After starting the server, you should set up
 
4828
   passwords for them using the instructions in Section 2.12,
 
4829
   "Postinstallation Setup and Testing."
 
4830
 
 
4831
2.11.3. Installing MySQL from a Development Source Tree
 
4832
 
 
4833
   This section discusses how to install MySQL from the latest
 
4834
   development source code. Development trees have not necessarily
 
4835
   received the same level of testing as standard release
 
4836
   distributions, so this installation method is usually required
 
4837
   only if you need the most recent code changes. Do not use a
 
4838
   development tree for production systems. If your goal is simply to
 
4839
   get MySQL up and running on your system, you should use a standard
 
4840
   release distribution (either a binary or source distribution). See
 
4841
   Section 2.1.3, "How to Get MySQL."
 
4842
 
 
4843
   To obtain the source tree, you must have Bazaar installed. The
 
4844
   Bazaar VCS Web site (http://bazaar-vcs.org) has instructions for
 
4845
   downloading and installing Bazaar on different platforms. Bazaar
 
4846
   is supported on any platform that supports Python, and is
 
4847
   therefore compatible with any Linux, Unix, Windows, or Mac OS X
 
4848
   host.
 
4849
 
 
4850
   MySQL development projects are hosted on Launchpad
 
4851
   (http://launchpad.net/). MySQL projects, including MySQL Server,
 
4852
   MySQL Workbench, and others are available from the Oracle/MySQL
 
4853
   Engineering (http://launchpad.net/~mysql) page. For the
 
4854
   repositories related only to MySQL Server, see the MySQL Server
 
4855
   (http://launchpad.net/mysql-server) page.
 
4856
 
 
4857
   For information about using Bazaar with MySQL, see
 
4858
   http://forge.mysql.com/wiki/MySQL_Bazaar_Howto.
 
4859
 
 
4860
   To build under Unix/Linux, you must have the following tools
 
4861
   installed:
 
4862
 
 
4863
     * A good make program. Although some platforms come with their
 
4864
       own make implementations, it is highly recommended that you
 
4865
       use GNU make 3.75 or newer. It may already be available on
 
4866
       your system as gmake. GNU make is available from
 
4867
       http://www.gnu.org/software/make/.
 
4868
 
 
4869
     * autoconf 2.58 (or newer), available from
 
4870
       http://www.gnu.org/software/autoconf/.
 
4871
 
 
4872
     * automake 1.8.1, available from
 
4873
       http://www.gnu.org/software/automake/.
 
4874
 
 
4875
     * libtool 1.5, available from
 
4876
       http://www.gnu.org/software/libtool/. 1.5.24 or later is
 
4877
       recommended.
 
4878
 
 
4879
     * m4, available from http://www.gnu.org/software/m4/.
 
4880
 
 
4881
     * bison, available from http://www.gnu.org/software/bison/. You
 
4882
       should use the latest version of bison where possible.
 
4883
       Versions 1.75 and 2.1 are known to work. There have been
 
4884
       reported problems with bison 1.875. If you experience
 
4885
       problems, upgrade to a later, rather than earlier, version.
 
4886
 
 
4887
   To build under Windows you must have Microsoft Visual C++ 2005
 
4888
   Express Edition, Visual Studio .Net 2003 (7.1), or Visual Studio
 
4889
   2005 (8.0) compiler system.
 
4890
 
 
4891
   Once the necessary tools are installed, create a local branch of
 
4892
   the MySQL development tree on your machine using this procedure:
 
4893
 
 
4894
    1. To obtain a copy of the MySQL source code, you must create a
 
4895
       new Bazaar branch. If you do not already have a Bazaar
 
4896
       repository directory set up, you must initialize a new
 
4897
       directory:
 
4898
shell> mkdir mysql-server
 
4899
shell> bzr init-repo --trees mysql-server
 
4900
       This is a one-time operation.
 
4901
 
 
4902
    2. Assuming that you have an initialized repository directory,
 
4903
       you can branch from the public MySQL server repositories to
 
4904
       create a local source tree. To create a branch of a specific
 
4905
       version:
 
4906
shell> cd mysql-server
 
4907
shell> bzr branch lp:mysql-server/5.1 mysql-5.1
 
4908
       This is a one-time operation per source tree. You can branch
 
4909
       the source trees for several versions of MySQL under the
 
4910
       mysql-server directory.
 
4911
 
 
4912
    3. The initial download will take some time to complete,
 
4913
       depending on the speed of your connection. Please be patient.
 
4914
       Once you have downloaded the first tree, additional trees
 
4915
       should take significantly less time to download.
 
4916
 
 
4917
    4. When building from the Bazaar branch, you may want to create a
 
4918
       copy of your active branch so that you can make configuration
 
4919
       and other changes without affecting the original branch
 
4920
       contents. You can achieve this by branching from the original
 
4921
       branch:
 
4922
shell> bzr branch mysql-5.1 mysql-5.1-build
 
4923
 
 
4924
    5. To obtain changes made after you have set up the branch
 
4925
       initially, update it using the pull option periodically. Use
 
4926
       this command in the top-level directory of the local copy:
 
4927
shell> bzr pull
 
4928
       To examine the changeset comments for the tree, use the log
 
4929
       option to bzr:
 
4930
shell> bzr log
 
4931
       You can also browse changesets, comments, and source code
 
4932
       online at the Launchpad MySQL Server
 
4933
       (http://launchpad.net/mysql-server) page.
 
4934
       If you see diffs (changes) or code that you have a question
 
4935
       about, do not hesitate to send email to the MySQL internals
 
4936
       mailing list. See Section 1.6.1, "MySQL Mailing Lists." If you
 
4937
       think you have a better idea on how to do something, send an
 
4938
       email message to the list with a patch.
 
4939
 
 
4940
   After you have the local branch, you can build MySQL server from
 
4941
   the source code. On Windows, the build process is different from
 
4942
   Unix/Linux: see Section 2.11.7, "Installing MySQL from Source on
 
4943
   Windows."
 
4944
 
 
4945
   On Unix/Linux, use the autoconf system to create the configure
 
4946
   script so that you can configure the build environment before
 
4947
   building. The following example shows the typical commands
 
4948
   required to build MySQL from a source tree.
 
4949
 
 
4950
    1. Change location to the top-level directory of the source tree;
 
4951
       replace mysql-5.1 with the appropriate directory name.
 
4952
shell> cd mysql-5.1
 
4953
 
 
4954
    2. Prepare the source tree for configuration.
 
4955
       Prior to MySQL 5.1.12, you must separately configure the
 
4956
       InnoDB storage engine. Run the following command from the main
 
4957
       source directory:
 
4958
shell> (cd storage/innobase; autoreconf --force --install)
 
4959
       You can omit the previous command for MySQL 5.1.12 and later,
 
4960
       or if you do not require InnoDB support.
 
4961
       Prepare the remainder of the source tree:
 
4962
shell> autoreconf --force --install
 
4963
       As an alternative to the preceding autoreconf command, you can
 
4964
       use BUILD/autorun.sh, which acts as a shortcut for the
 
4965
       following sequence of commands:
 
4966
shell> aclocal; autoheader
 
4967
shell> libtoolize --automake --force
 
4968
shell> automake --force --add-missing; autoconf
 
4969
       If you get some strange errors during this stage, verify that
 
4970
       you have the correct version of libtool installed.
 
4971
 
 
4972
    3. Configure the source tree and compile MySQL:
 
4973
shell> ./configure  # Add your favorite options here
 
4974
shell> make
 
4975
       For a description of some configure options, see Section
 
4976
       2.11.4, "MySQL Source-Configuration Options."
 
4977
       A collection of configuration scripts is located in the BUILD/
 
4978
       subdirectory. For example, you may find it more convenient to
 
4979
       use the BUILD/compile-pentium-debug script than the preceding
 
4980
       set of shell commands. To compile on a different architecture,
 
4981
       modify the script by removing flags that are Pentium-specific,
 
4982
       or use another script that may be more appropriate. These
 
4983
       scripts are provided on an "as-is" basis. They are not
 
4984
       supported and their contents may change from release to
 
4985
       release.
 
4986
 
 
4987
    4. When the build is done, run make install. Be careful with this
 
4988
       on a production machine; the installation command may
 
4989
       overwrite your live release installation. If you already have
 
4990
       MySQL installed and do not want to overwrite it, run
 
4991
       ./configure with values for the --prefix, --with-tcp-port, and
 
4992
       --with-unix-socket-path options different from those used by
 
4993
       your production server. For additional information about
 
4994
       preventing multiple servers from interfering with each other,
 
4995
       see Section 5.6, "Running Multiple MySQL Instances on One
 
4996
       Machine."
 
4997
 
 
4998
    5. Play hard with your new installation. For example, try to make
 
4999
       new features crash. Start by running make test. See Section
 
5000
       21.1.2, "The MySQL Test Suite."
 
5001
 
 
5002
    6. If you have gotten to the make stage, but the distribution
 
5003
       does not compile, please enter the problem into our bugs
 
5004
       database using the instructions given in Section 1.7, "How to
 
5005
       Report Bugs or Problems." If you have installed the latest
 
5006
       versions of the required tools, and they crash trying to
 
5007
       process our configuration files, please report that also.
 
5008
       However, if you get a command not found error or a similar
 
5009
       problem for required tools, do not report it. Instead, make
 
5010
       sure that all the required tools are installed and that your
 
5011
       PATH variable is set correctly so that your shell can find
 
5012
       them.
 
5013
 
 
5014
2.11.4. MySQL Source-Configuration Options
 
5015
 
 
5016
   The configure script provides a great deal of control over how you
 
5017
   configure a MySQL source distribution. Typically, you do this
 
5018
   using options on the configure command line. For a full list of
 
5019
   options supported by configure, run this command:
 
5020
shell> ./configure --help
 
5021
 
 
5022
   You can also affect configure using certain environment variables.
 
5023
   See Section 2.14, "Environment Variables."
 
5024
 
 
5025
   The following table shows the available configure options.
 
5026
 
 
5027
   Table 2.19. MySQL Source-Configuration Option Reference
 
5028
   (configure)
 
5029
   Formats Description Default Introduced Removed
 
5030
   --bindir=DIR User executables EPREFIX/bin
 
5031
   --build=BUILD Configure for building on BUILD guessed
 
5032
   --cache-file=FILE Cache test results in FILE disabled
 
5033
   -C Alias for `--cache-file=config.cache'
 
5034
   --config-cache
 
5035
   --datadir=DIR Read-only architecture-independent data PREFIX/share
 
5036
 
 
5037
   --disable-FEATURE Do not include FEATURE
 
5038
   --disable-community-features Disable additional features provided
 
5039
   by the community 5.1.28
 
5040
   --disable-dependency-tracking Disable dependency tracking
 
5041
   --disable-grant-options Disable GRANT options
 
5042
   --disable-largefile Omit support for large files
 
5043
   --disable-libtool-lock Disable libtool lock
 
5044
   --disable-thread-safe-client Compile the client without threads
 
5045
   5.1.7
 
5046
   --enable-FEATURE Enable FEATURE
 
5047
   --enable-assembler Use assembler versions of some string functions
 
5048
   if available
 
5049
   --enable-debug-sync Compile in Debug Sync facility 5.1.41
 
5050
   --enable-dependency-tracking Do not reject slow dependency
 
5051
   extractors
 
5052
   --enable-fast-install Optimize for fast installation yes
 
5053
   --enable-local-infile Enable LOCAL for LOAD DATA INFILE disabled
 
5054
 
 
5055
   --enable-profiling Build a version with query profiling code
 
5056
   5.1.24
 
5057
   --enable-shared Build shared libraries yes
 
5058
   --enable-static Build static libraries yes
 
5059
   --enable-thread-safe-client Compile the client with threads
 
5060
   5.1.6
 
5061
   --exec-prefix=EPREFIX Install architecture-dependent files in
 
5062
   EPREFIX
 
5063
   -h Display this help and exit
 
5064
   --help
 
5065
   --help=short Display options specific to this package
 
5066
   --help=recursive Display the short help of all the included
 
5067
   packages
 
5068
   --host=HOST Cross-compile to build programs to run on HOST
 
5069
   --includedir=DIR C header files PREFIX/include
 
5070
   --infodir=DIR Info documentation PREFIX/info
 
5071
   --libdir=DIR Object code libraries EPREFIX/lib
 
5072
   --libexecdir=DIR Program executables EPREFIX/libexec
 
5073
   --localstatedir=DIR Modifiable single-machine data PREFIX/var
 
5074
   --mandir=DIR man documentation PREFIX/man
 
5075
   -n Do not create output files
 
5076
   --no-create
 
5077
   --oldincludedir=DIR C header files for non-gcc /usr/include
 
5078
   --prefix=PREFIX Install architecture-independent files in PREFIX
 
5079
 
 
5080
   --program-prefix=PREFIX Prepend PREFIX to installed program names
 
5081
 
 
5082
   --program-suffix=SUFFIX Append SUFFIX to installed program names
 
5083
 
 
5084
   --program-transform-name=PROGRAM run sed PROGRAM on installed
 
5085
   program names
 
5086
   -q Do not print `checking...' messages
 
5087
   --quiet
 
5088
   --sbindir=DIR System administrative executables EPREFIX/sbin
 
5089
   --sharedstatedir=DIR Modifiable architecture-independent data
 
5090
   PREFIX/com
 
5091
   --srcdir=DIR Find the sources in DIR configure directory or ..
 
5092
   --sysconfdir=DIR Read-only single-machine data PREFIX/etc
 
5093
   --target=TARGET Configure for building compilers for TARGET
 
5094
   -V Display version information and exit
 
5095
   --version
 
5096
   --with-PACKAGE Use PACKAGE
 
5097
   --with-archive-storage-engine Enable the Archive Storage Engine no
 
5098
     5.1.9
 
5099
   --with-atomic-ops Implement atomic operations using pthread
 
5100
   rwlocks or atomic CPU instructions for multi-processor 5.1.12
 
5101
   --with-berkeley-db Use BerkeleyDB located in DIR no   5.1.11
 
5102
   --with-berkeley-db-includes Find Berkeley DB headers in DIR
 
5103
   5.1.11
 
5104
   --with-berkeley-db-libs Find Berkeley DB libraries in DIR   5.1.11
 
5105
   --with-big-tables Support tables with more than 4 G rows even on
 
5106
   32 bit platforms
 
5107
   --with-blackhole-storage-engine Enable the Blackhole Storage
 
5108
   Engine no   5.1.9
 
5109
   --with-charset Default character set
 
5110
   --with-client-ldflags Extra linking arguments for clients
 
5111
   --with-collation Default collation
 
5112
   --with-comment Comment about compilation environment
 
5113
   --with-csv-storage-engine Enable the CSV Storage Engine yes
 
5114
   5.1.9
 
5115
   --with-darwin-mwcc Use Metrowerks CodeWarrior wrappers on OS
 
5116
   X/Darwin
 
5117
   --with-debug Add debug code 5.1.7
 
5118
   --with-debug=full Add debug code (adds memory checker, very slow)
 
5119
 
 
5120
   --with-embedded-privilege-control Build parts to check user's
 
5121
   privileges (only affects embedded library)
 
5122
   --with-embedded-server Build the embedded server
 
5123
   --with-error-inject Enable error injection in MySQL Server 5.1.11
 
5124
 
 
5125
   --with-example-storage-engine Enable the Example Storage Engine no
 
5126
     5.1.9
 
5127
   --with-extra-charsets Use charsets in addition to default
 
5128
   --with-fast-mutexes Compile with fast mutexes enabled 5.1.5
 
5129
   --with-federated-storage-engine Enable federated storage engine no
 
5130
   5.1.3 5.1.9
 
5131
   --with-gnu-ld Assume the C compiler uses GNU ld no
 
5132
   --with-innodb Enable innobase storage engine no 5.1.3 5.1.9
 
5133
   --with-lib-ccflags Extra CC options for libraries
 
5134
   --with-libwrap=DIR Compile in libwrap (tcp_wrappers) support
 
5135
   --with-low-memory Try to use less memory to compile to avoid
 
5136
   memory limitations
 
5137
   --with-machine-type Set the machine type, like "powerpc"
 
5138
   --with-max-indexes=N Sets the maximum number of indexes per table
 
5139
   64
 
5140
   --with-mysqld-ldflags Extra linking arguments for mysqld
 
5141
   --with-mysqld-libs Extra libraries to link with for mysqld
 
5142
   --with-mysqld-user What user the mysqld daemon shall be run as
 
5143
   --with-mysqlmanager Build the mysqlmanager binary Build if server
 
5144
   is built
 
5145
   --with-named-curses-libs Use specified curses libraries
 
5146
   --with-named-thread-libs Use specified thread libraries
 
5147
   --with-ndb-ccflags Extra CC options for ndb compile
 
5148
   --with-ndb-docs Include the NDB Cluster ndbapi and mgmapi
 
5149
   documentation
 
5150
   --with-ndb-port Port for NDB Cluster management server
 
5151
   --with-ndb-port-base Port for NDB Cluster management server
 
5152
   --with-ndb-sci=DIR Provide MySQL with a custom location of sci
 
5153
   library
 
5154
   --with-ndb-test Include the NDB Cluster ndbapi test programs
 
5155
   --with-ndbcluster Include the NDB Cluster table handler no   5.1.9
 
5156
   --with-openssl=DIR Include the OpenSSL support   5.1.9
 
5157
   --with-openssl-includes Find OpenSSL headers in DIR   5.1.9
 
5158
   --with-openssl-libs Find OpenSSL libraries in DIR   5.1.9
 
5159
   --with-other-libc=DIR Link against libc and other standard
 
5160
   libraries installed in the specified nonstandard location
 
5161
   --with-pic Try to use only PIC/non-PIC objects Use both
 
5162
   --with-plugin-PLUGIN Forces the named plugin to be linked into
 
5163
   mysqld statically 5.1.11
 
5164
   --with-plugins Plugins to include in mysqld none 5.1.11
 
5165
   --with-pstack Use the pstack backtrace library   5.1.54
 
5166
   --with-pthread Force use of pthread library
 
5167
   --with-row-based-replication Include row-based replication 5.1.5
 
5168
   5.1.6
 
5169
   --with-server-suffix Append value to the version string
 
5170
   --with-ssl=DIR Include SSL support 5.1.11
 
5171
   --with-system-type Set the system type, like "sun-solaris10"
 
5172
   --with-tags Include additional configurations automatic
 
5173
   --with-tcp-port Which port to use for MySQL services 3306
 
5174
   --with-unix-socket-path Where to put the unix-domain socket
 
5175
   --with-yassl Include the yaSSL support   5.1.9
 
5176
   --with-zlib-dir=no|bundled|DIR Provide MySQL with a custom
 
5177
   location of compression library
 
5178
   --without-PACKAGE Do not use PACKAGE
 
5179
   --without-bench Skip building of the benchmark suite   5.1.11
 
5180
   --without-debug Build a production version without debugging code
 
5181
     5.1.6
 
5182
   --without-docs Skip building of the documentation
 
5183
   --without-extra-tools Skip building utilities in the tools
 
5184
   directory   5.1.9
 
5185
   --without-geometry Do not build geometry-related parts
 
5186
   --without-libedit Use system libedit instead of bundled copy
 
5187
   --without-man Skip building of the man pages
 
5188
   --without-ndb-binlog Disable ndb binlog 5.1.6
 
5189
   --without-ndb-debug Disable special ndb debug features
 
5190
   --without-plugin-PLUGIN Exclude PLUGIN 5.1.11
 
5191
   --without-query-cache Do not build query cache
 
5192
   --without-readline Use system readline instead of bundled copy
 
5193
   --without-row-based-replication Don't include row-based
 
5194
   replication 5.1.7 5.1.14
 
5195
   --without-server Only build the client
 
5196
   --without-uca Skip building of the national Unicode collations
 
5197
 
 
5198
   If you are using a version of gcc recent enough to understand the
 
5199
   -fno-exceptions option, it is very important that you use this
 
5200
   option. Otherwise, you may compile a binary that crashes randomly.
 
5201
   Also use -felide-constructors and -fno-rtti along with
 
5202
   -fno-exceptions. When in doubt, do the following:
 
5203
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
 
5204
       -fno-exceptions -fno-rtti" ./configure \
 
5205
       --prefix=/usr/local/mysql --enable-assembler \
 
5206
       --with-mysqld-ldflags=-all-static
 
5207
 
 
5208
   On most systems, this gives you a fast and stable binary.
 
5209
 
 
5210
   When compiling from source, you should also be aware of any
 
5211
   platform specific considerations that may influence and impact the
 
5212
   build process. Knowing and applying this information will help to
 
5213
   ensure you get the best performance and most stable binary for
 
5214
   your chosen platform. For more information, use the following
 
5215
   sections:
 
5216
 
 
5217
     * Section 2.11.9, "Notes on Installing MySQL on AIX from Source"
 
5218
 
 
5219
     * Section 2.11.10, "Notes on Installing MySQL on HP-UX from
 
5220
       Source"
 
5221
 
 
5222
     * Section 2.11.8, "Notes on Installing MySQL on Solaris from
 
5223
       Source"
 
5224
 
 
5225
   Some of the configure options available are described here. For
 
5226
   options that may be of use if you have difficulties building
 
5227
   MySQL, see Section 2.11.5, "Dealing with Problems Compiling
 
5228
   MySQL."
 
5229
 
 
5230
   Many options configure compile-time defaults that can be
 
5231
   overridden at server startup. For example, the --prefix,
 
5232
   --with-tcp-port, and with-unix-socket-path options that configure
 
5233
   the default installation base directory location, TCP/IP port
 
5234
   number, and Unix socket file can be changed at server startup with
 
5235
   the --basedir, --port, and --socket options for mysqld.
 
5236
 
 
5237
     * To compile just the MySQL client libraries and client programs
 
5238
       and not the server, use the --without-server option:
 
5239
shell> ./configure --without-server
 
5240
       If you have no C++ compiler, some client programs such as
 
5241
       mysql cannot be compiled because they require C++. In this
 
5242
       case, you can remove the code in configure that tests for the
 
5243
       C++ compiler and then run ./configure with the
 
5244
       --without-server option. The compile step should still try to
 
5245
       build all clients, but you can ignore any warnings about files
 
5246
       such as mysql.cc. (If make stops, try make -k to tell it to
 
5247
       continue with the rest of the build even if errors occur.)
 
5248
 
 
5249
     * To build the embedded MySQL library (libmysqld.a), use the
 
5250
       --with-embedded-server option.
 
5251
 
 
5252
     * To place your log files and database directories elsewhere
 
5253
       than under /usr/local/var, use a configure command something
 
5254
       like one of these:
 
5255
shell> ./configure --prefix=/usr/local/mysql
 
5256
shell> ./configure --prefix=/usr/local \
 
5257
           --localstatedir=/usr/local/mysql/data
 
5258
       The first command changes the installation prefix so that
 
5259
       everything is installed under /usr/local/mysql rather than the
 
5260
       default of /usr/local. The second command preserves the
 
5261
       default installation prefix, but overrides the default
 
5262
       location for database directories (normally /usr/local/var)
 
5263
       and changes it to /usr/local/mysql/data.
 
5264
       You can also specify the installation directory and data
 
5265
       directory locations at server startup time by using the
 
5266
       --basedir and --datadir options. These can be given on the
 
5267
       command line or in an MySQL option file, although it is more
 
5268
       common to use an option file. See Section 4.2.3.3, "Using
 
5269
       Option Files."
 
5270
 
 
5271
     * The --with-tcp-port option specifies the port number on which
 
5272
       the server listens for TCP/IP connections. The default is port
 
5273
       3306. To listen on a different port, use a configure command
 
5274
       like this:
 
5275
shell> ./configure --with-tcp-port=3307
 
5276
 
 
5277
     * On Unix, if you want the MySQL socket file location to be
 
5278
       somewhere other than the default location (normally in the
 
5279
       directory /tmp or /var/run), use a configure command like
 
5280
       this:
 
5281
shell> ./configure \
 
5282
           --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
 
5283
       The socket file name must be an absolute path name. You can
 
5284
       also change the location of mysql.sock at server startup by
 
5285
       using a MySQL option file. See Section C.5.4.5, "How to
 
5286
       Protect or Change the MySQL Unix Socket File."
 
5287
 
 
5288
     * To compile statically linked programs (for example, to make a
 
5289
       binary distribution, to get better performance, or to work
 
5290
       around problems with some Red Hat Linux distributions), run
 
5291
       configure like this:
 
5292
shell> ./configure --with-client-ldflags=-all-static \
 
5293
           --with-mysqld-ldflags=-all-static
 
5294
 
 
5295
     * If you are using gcc and do not have libg++ or libstdc++
 
5296
       installed, you can tell configure to use gcc as your C++
 
5297
       compiler:
 
5298
shell> CC=gcc CXX=gcc ./configure
 
5299
       When you use gcc as your C++ compiler, it does not attempt to
 
5300
       link in libg++ or libstdc++. This may be a good thing to do
 
5301
       even if you have those libraries installed. Some versions of
 
5302
       them have caused strange problems for MySQL users in the past.
 
5303
       In most cases, you can get a reasonably optimized MySQL binary
 
5304
       by using the following options on the configure line:
 
5305
--prefix=/usr/local/mysql --enable-assembler \
 
5306
--with-mysqld-ldflags=-all-static
 
5307
       The full configure line would, in other words, be something
 
5308
       like the following for all recent gcc versions:
 
5309
CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
 
5310
-felide-constructors -fno-exceptions -fno-rtti" ./configure \
 
5311
--prefix=/usr/local/mysql --enable-assembler \
 
5312
--with-mysqld-ldflags=-all-static
 
5313
       The binaries we provide on the MySQL Web site at
 
5314
       http://dev.mysql.com/downloads/ are all compiled with full
 
5315
       optimization and should work well for most users. See Section
 
5316
       2.2, "Installing MySQL from Generic Binaries on Unix/Linux."
 
5317
 
 
5318
     * If the build fails and produces errors about your compiler or
 
5319
       linker not being able to create the shared library
 
5320
       libmysqlclient.so.N (where N is a version number), you can
 
5321
       work around this problem by giving the --disable-shared option
 
5322
       to configure. In this case, configure does not build a shared
 
5323
       libmysqlclient.so.N library.
 
5324
 
 
5325
     * By default, MySQL uses the latin1 (cp1252 West European)
 
5326
       character set. To change the default set, use the
 
5327
       --with-charset option:
 
5328
shell> ./configure --with-charset=CHARSET
 
5329
       CHARSET may be one of binary, armscii8, ascii, big5, cp1250,
 
5330
       cp1251, cp1256, cp1257, cp850, cp852, cp866, cp932, dec8,
 
5331
       eucjpms, euckr, gb2312, gbk, geostd8, greek, hebrew, hp8,
 
5332
       keybcs2, koi8r, koi8u, latin1, latin2, latin5, latin7, macce,
 
5333
       macroman, sjis, swe7, tis620, ucs2, ujis, utf8. (Additional
 
5334
       character sets might be available. Check the output from
 
5335
       ./configure --help for the current list.)
 
5336
       The default collation may also be specified. MySQL uses the
 
5337
       latin1_swedish_ci collation by default. To change this, use
 
5338
       the --with-collation option:
 
5339
shell> ./configure --with-collation=COLLATION
 
5340
       To change both the character set and the collation, use both
 
5341
       the --with-charset and --with-collation options. The collation
 
5342
       must be a legal collation for the character set. (Use the SHOW
 
5343
       COLLATION statement to determine which collations are
 
5344
       available for each character set.)
 
5345
       With the configure option --with-extra-charsets=LIST, you can
 
5346
       define which additional character sets should be compiled into
 
5347
       the server. LIST is one of the following:
 
5348
 
 
5349
          + A list of character set names separated by spaces
 
5350
 
 
5351
          + complex to include all character sets that can't be
 
5352
            dynamically loaded
 
5353
 
 
5354
          + all to include all character sets into the binaries
 
5355
       Clients that want to convert characters between the server and
 
5356
       the client should use the SET NAMES statement. See Section
 
5357
       9.1.4, "Connection Character Sets and Collations."
 
5358
 
 
5359
     * To configure MySQL with debugging code, use the --with-debug
 
5360
       option:
 
5361
shell> ./configure --with-debug
 
5362
       This causes a safe memory allocator to be included that can
 
5363
       find some errors and that provides output about what is
 
5364
       happening. See MySQL Internals: Porting
 
5365
       (http://forge.mysql.com/wiki/MySQL_Internals_Porting).
 
5366
       As of MySQL 5.1.12, using --with-debug to configure MySQL with
 
5367
       debugging support enables you to use the
 
5368
       --debug="d,parser_debug" option when you start the server.
 
5369
       This causes the Bison parser that is used to process SQL
 
5370
       statements to dump a parser trace to the server's standard
 
5371
       error output. Typically, this output is written to the error
 
5372
       log.
 
5373
 
 
5374
     * To cause the Debug Sync facility to be compiled into the
 
5375
       server, use the --enable-debug-sync option. This facility is
 
5376
       used for testing and debugging. When compiled in, Debug Sync
 
5377
       is disabled by default at runtime. To enable it, start mysqld
 
5378
       with the --debug-sync-timeout=N option, where N is a timeout
 
5379
       value greater than 0. (The default value is 0, which disables
 
5380
       Debug Sync.) N becomes the default timeout for individual
 
5381
       synchronization points.
 
5382
       Debug Sync is also compiled in if you configure with the
 
5383
       --with-debug option (which implies --enable-debug-sync),
 
5384
       unless you also use the --disable-debug-sync option.
 
5385
       For a description of the Debug Sync facility and how to use
 
5386
       synchronization points, see MySQL Internals: Test
 
5387
       Synchronization
 
5388
       (http://forge.mysql.com/wiki/MySQL_Internals_Test_Synchronizat
 
5389
       ion).
 
5390
       The --enable-debug-sync and --disable-debug-sync options were
 
5391
       added in MySQL 5.1.41.
 
5392
 
 
5393
     * If your client programs are using threads, you must compile a
 
5394
       thread-safe version of the MySQL client library with the
 
5395
       --enable-thread-safe-client configure option. This creates a
 
5396
       libmysqlclient_r library with which you should link your
 
5397
       threaded applications. See Section 20.9.16.2, "How to Write a
 
5398
       Threaded Client."
 
5399
 
 
5400
     * Some features require that the server be built with
 
5401
       compression library support, such as the COMPRESS() and
 
5402
       UNCOMPRESS() functions, and compression of the client/server
 
5403
       protocol. The --with-zlib-dir=no|bundled|DIR option provides
 
5404
       control over compression library support. The value no
 
5405
       explicitly disables compression support. bundled causes the
 
5406
       zlib library bundled in the MySQL sources to be used. A DIR
 
5407
       path name specifies the directory in which to find the
 
5408
       compression library sources.
 
5409
 
 
5410
     * It is possible to build MySQL with large table support using
 
5411
       the --with-big-tables option.
 
5412
       This option causes the variables that store table row counts
 
5413
       to be declared as unsigned long long rather than unsigned
 
5414
       long. This enables tables to hold up to approximately
 
5415
       1.844E+19 ((2^32)^2) rows rather than 2^32 (~4.295E+09) rows.
 
5416
       Previously it was necessary to pass -DBIG_TABLES to the
 
5417
       compiler manually in order to enable this feature.
 
5418
 
 
5419
     * Run configure with the --disable-grant-options option to cause
 
5420
       the --bootstrap, --skip-grant-tables, and --init-file options
 
5421
       for mysqld to be disabled. For Windows, the configure.js
 
5422
       script recognizes the DISABLE_GRANT_OPTIONS flag, which has
 
5423
       the same effect. The capability is available as of MySQL
 
5424
       5.1.15.
 
5425
 
 
5426
     * This option allows MySQL Community Server features to be
 
5427
       enabled. Additional options may be required for individual
 
5428
       features, such as --enable-profiling to enable statement
 
5429
       profiling. This option was added in MySQL 5.1.24. It is
 
5430
       enabled by default as of MySQL 5.1.28; to disable it, use
 
5431
       --disable-community-features.
 
5432
 
 
5433
     * When given with --enable-community-features, the
 
5434
       --enable-profiling option enables the statement profiling
 
5435
       capability exposed by the SHOW PROFILE and SHOW PROFILES
 
5436
       statements. (See Section 12.7.5.33, "SHOW PROFILES Syntax.")
 
5437
       This option was added in MySQL 5.1.24. It is enabled by
 
5438
       default as of MySQL 5.1.28; to disable it, use
 
5439
       --disable-profiling.
 
5440
 
 
5441
     * See Section 2.1, "General Installation Guidance," for options
 
5442
       that pertain to particular operating systems.
 
5443
 
 
5444
     * See Section 5.5.6.2, "Using SSL Connections," for options that
 
5445
       pertain to configuring MySQL to support secure (encrypted)
 
5446
       connections.
 
5447
 
 
5448
     * Several configure options apply to plugin selection and
 
5449
       building:
 
5450
--with-plugins=PLUGIN[,PLUGIN]...
 
5451
--with-plugins=GROUP
 
5452
--with-plugin-PLUGIN
 
5453
--without-plugin-PLUGIN
 
5454
       PLUGIN is an individual plugin name such as csv or archive.
 
5455
       As shorthand, GROUP is a configuration group name such as none
 
5456
       (select no plugins) or all (select all plugins).
 
5457
       You can build a plugin as static (compiled into the server) or
 
5458
       dynamic (built as a dynamic library that must be installed
 
5459
       using the INSTALL PLUGIN statement or the --plugin-load option
 
5460
       before it can be used). Some plugins might not support static
 
5461
       or dynamic build.
 
5462
       configure --help shows the following information pertaining to
 
5463
       plugins:
 
5464
 
 
5465
          + The plugin-related options
 
5466
 
 
5467
          + The names of all available plugins
 
5468
 
 
5469
          + For each plugin, a description of its purpose, which
 
5470
            build types it supports (static or dynamic), and which
 
5471
            plugin groups it is a part of.
 
5472
       --with-plugins can take a list of one or more plugin names
 
5473
       separated by commas, or a plugin group name. The named plugins
 
5474
       are configured to be built as static plugins.
 
5475
       --with-plugin-PLUGIN configures the given plugin to be built
 
5476
       as a static plugin.
 
5477
       --without-plugin-PLUGIN disables the given plugin from being
 
5478
       built.
 
5479
       If a plugin is named both with a --with and --without option,
 
5480
       the result is undefined.
 
5481
       For any plugin that is not explicitly selected or disabled, it
 
5482
       is selected to be built dynamically if it supports dynamic
 
5483
       build, and not built if it does not support dynamic build.
 
5484
       (Thus, in the case that no plugin options are given, all
 
5485
       plugins that support dynamic build are selected to be built as
 
5486
       dynamic plugins. Plugins that do not support dynamic build are
 
5487
       not built.)
 
5488
 
 
5489
2.11.5. Dealing with Problems Compiling MySQL
 
5490
 
 
5491
   All MySQL programs compile cleanly for us with no warnings on
 
5492
   Solaris or Linux using gcc. On other systems, warnings may occur
 
5493
   due to differences in system include files. For other problems,
 
5494
   check the following list.
 
5495
 
 
5496
   The solution to many problems involves reconfiguring. If you do
 
5497
   need to reconfigure, take note of the following:
 
5498
 
 
5499
     * If configure is run after it has previously been run, it may
 
5500
       use information that was gathered during its previous
 
5501
       invocation. This information is stored in config.cache. When
 
5502
       configure starts up, it looks for that file and reads its
 
5503
       contents if it exists, on the assumption that the information
 
5504
       is still correct. That assumption is invalid when you
 
5505
       reconfigure.
 
5506
 
 
5507
     * Each time you run configure, you must run make again to
 
5508
       recompile. However, you may want to remove old object files
 
5509
       from previous builds first because they were compiled using
 
5510
       different configuration options.
 
5511
 
 
5512
   To prevent old configuration information or object files from
 
5513
   being used, run these commands before re-running configure:
 
5514
shell> rm config.cache
 
5515
shell> make clean
 
5516
 
 
5517
   Alternatively, you can run make distclean.
 
5518
 
 
5519
   The following list describes some of the problems that have been
 
5520
   found to occur most often when compiling MySQL:
 
5521
 
 
5522
     * If you get errors such as the ones shown here when compiling
 
5523
       sql_yacc.cc, you probably have run out of memory or swap
 
5524
       space:
 
5525
Internal compiler error: program cc1plus got fatal signal 11
 
5526
Out of virtual memory
 
5527
Virtual memory exhausted
 
5528
       The problem is that gcc requires a huge amount of memory to
 
5529
       compile sql_yacc.cc with inline functions. Try running
 
5530
       configure with the --with-low-memory option:
 
5531
shell> ./configure --with-low-memory
 
5532
       This option causes -fno-inline to be added to the compile line
 
5533
       if you are using gcc and -O0 if you are using something else.
 
5534
       You should try the --with-low-memory option even if you have
 
5535
       so much memory and swap space that you think you can't
 
5536
       possibly have run out. This problem has been observed to occur
 
5537
       even on systems with generous hardware configurations, and the
 
5538
       --with-low-memory option usually fixes it.
 
5539
 
 
5540
     * By default, configure picks c++ as the compiler name and GNU
 
5541
       c++ links with -lg++. If you are using gcc, that behavior can
 
5542
       cause problems during configuration such as this:
 
5543
configure: error: installation or configuration problem:
 
5544
C++ compiler cannot create executables.
 
5545
       You might also observe problems during compilation related to
 
5546
       g++, libg++, or libstdc++.
 
5547
       One cause of these problems is that you may not have g++, or
 
5548
       you may have g++ but not libg++, or libstdc++. Take a look at
 
5549
       the config.log file. It should contain the exact reason why
 
5550
       your C++ compiler did not work. To work around these problems,
 
5551
       you can use gcc as your C++ compiler. Try setting the
 
5552
       environment variable CXX to "gcc -O3". For example:
 
5553
shell> CXX="gcc -O3" ./configure
 
5554
       This works because gcc compiles C++ source files as well as
 
5555
       g++ does, but does not link in libg++ or libstdc++ by default.
 
5556
       Another way to fix these problems is to install g++, libg++,
 
5557
       and libstdc++. However, do not use libg++ or libstdc++ with
 
5558
       MySQL because this only increases the binary size of mysqld
 
5559
       without providing any benefits. Some versions of these
 
5560
       libraries have also caused strange problems for MySQL users in
 
5561
       the past.
 
5562
 
 
5563
     * To define flags to be used by your C or C++ compilers, specify
 
5564
       them using the CFLAGS and CXXFLAGS environment variables. You
 
5565
       can also specify the compiler names this way using CC and CXX.
 
5566
       For example:
 
5567
shell> CC=gcc
 
5568
shell> CFLAGS=-O3
 
5569
shell> CXX=gcc
 
5570
shell> CXXFLAGS=-O3
 
5571
shell> export CC CFLAGS CXX CXXFLAGS
 
5572
       To see what flags you might need to specify, invoke
 
5573
       mysql_config with the --cflags option.
 
5574
 
 
5575
     * If you get errors such as those shown here when compiling
 
5576
       mysqld, configure did not correctly detect the type of the
 
5577
       last argument to accept(), getsockname(), or getpeername():
 
5578
cxx: Error: mysqld.cc, line 645: In this statement, the referenced
 
5579
     type of the pointer value ''length'' is ''unsigned long'',
 
5580
     which is not compatible with ''int''.
 
5581
new_sock = accept(sock, (struct sockaddr *)&cAddr, &length);
 
5582
       To fix this, edit the config.h file (which is generated by
 
5583
       configure). Look for these lines:
 
5584
/* Define as the base type of the last arg to accept */
 
5585
#define SOCKET_SIZE_TYPE XXX
 
5586
       Change XXX to size_t or int, depending on your operating
 
5587
       system. (You must do this each time you run configure because
 
5588
       configure regenerates config.h.)
 
5589
 
 
5590
     * If your compile fails with errors such as any of the
 
5591
       following, you must upgrade your version of make to GNU make:
 
5592
make: Fatal error in reader: Makefile, line 18:
 
5593
Badly formed macro assignment
 
5594
       Or:
 
5595
make: file `Makefile' line 18: Must be a separator (:
 
5596
       Or:
 
5597
pthread.h: No such file or directory
 
5598
       Solaris and FreeBSD are known to have troublesome make
 
5599
       programs.
 
5600
       GNU make 3.75 is known to work.
 
5601
 
 
5602
     * The sql_yacc.cc file is generated from sql_yacc.yy. Normally,
 
5603
       the build process does not need to create sql_yacc.cc because
 
5604
       MySQL comes with a pregenerated copy. However, if you do need
 
5605
       to re-create it, you might encounter this error:
 
5606
"sql_yacc.yy", line xxx fatal: default action causes potential...
 
5607
       This is a sign that your version of yacc is deficient. You
 
5608
       probably need to install bison (the GNU version of yacc) and
 
5609
       use that instead.
 
5610
       Versions of bison older than 1.75 may report this error:
 
5611
sql_yacc.yy:#####: fatal error: maximum table size (32767) exceeded
 
5612
       The maximum table size is not actually exceeded; the error is
 
5613
       caused by bugs in older versions of bison.
 
5614
 
 
5615
     * On Debian Linux 3.0, you need to install gawk instead of the
 
5616
       default mawk.
 
5617
 
 
5618
     * If you get a compilation error on Linux (for example, SuSE
 
5619
       Linux 8.1 or Red Hat Linux 7.3) similar to the following one,
 
5620
       you probably do not have g++ installed:
 
5621
libmysql.c:1329: warning: passing arg 5 of `gethostbyname_r' from
 
5622
incompatible pointer type
 
5623
libmysql.c:1329: too few arguments to function `gethostbyname_r'
 
5624
libmysql.c:1329: warning: assignment makes pointer from integer
 
5625
without a cast
 
5626
make[2]: *** [libmysql.lo] Error 1
 
5627
       By default, the configure script attempts to determine the
 
5628
       correct number of arguments by using g++ (the GNU C++
 
5629
       compiler). This test yields incorrect results if g++ is not
 
5630
       installed. There are two ways to work around this problem:
 
5631
 
 
5632
          + Make sure that the GNU C++ g++ is installed. On some
 
5633
            Linux distributions, the required package is called gpp;
 
5634
            on others, it is named gcc-c++.
 
5635
 
 
5636
          + Use gcc as your C++ compiler by setting the CXX
 
5637
            environment variable to gcc:
 
5638
export CXX="gcc"
 
5639
       You must run configure again after making either of those
 
5640
       changes.
 
5641
 
 
5642
   For information about acquiring or updating tools, see the system
 
5643
   requirements in Section 2.11, "Installing MySQL from Source."
 
5644
 
 
5645
2.11.6. Compiling and Linking an Optimized mysqld Server
 
5646
 
 
5647
   Most of the following tests were performed on Linux with the MySQL
 
5648
   benchmarks, but they should give some indication for other
 
5649
   operating systems and workloads.
 
5650
 
 
5651
   You obtain the fastest executables when you link with -static.
 
5652
 
 
5653
   By using better compiler and compilation options, you can obtain a
 
5654
   10% to 30% speed increase in applications. This is particularly
 
5655
   important if you compile the MySQL server yourself.
 
5656
 
 
5657
   When we tested both the Cygnus CodeFusion and Fujitsu compilers,
 
5658
   neither was sufficiently bug-free to enable MySQL to be compiled
 
5659
   with optimizations enabled.
 
5660
 
 
5661
   The standard MySQL binary distributions are compiled with support
 
5662
   for all character sets. When you compile MySQL yourself, include
 
5663
   support only for the character sets that you are going to use.
 
5664
   This is controlled by the --with-charset option to configure.
 
5665
 
 
5666
   Here is a list of some measurements that we have made:
 
5667
 
 
5668
     * If you link dynamically (without -static), the result is 13%
 
5669
       slower on Linux. Note that you still can use a dynamically
 
5670
       linked MySQL library for your client applications. It is the
 
5671
       server that is most critical for performance.
 
5672
 
 
5673
     * For a connection from a client to a server running on the same
 
5674
       host, if you connect using TCP/IP rather than a Unix socket
 
5675
       file, performance is 7.5% slower. (On Unix, if you connect to
 
5676
       the host name localhost, MySQL uses a socket file by default.)
 
5677
 
 
5678
     * For TCP/IP connections from a client to a server, connecting
 
5679
       to a remote server on another host is 8% to 11% slower than
 
5680
       connecting to a server on the same host, even for connections
 
5681
       faster than 100Mb/s Ethernet.
 
5682
 
 
5683
     * When running our benchmark tests using secure connections (all
 
5684
       data encrypted with internal SSL support) performance was 55%
 
5685
       slower than with unencrypted connections.
 
5686
 
 
5687
     * On a Sun UltraSPARC-IIe, a server compiled with Forte 5.0 is
 
5688
       4% faster than one compiled with gcc 3.2.
 
5689
 
 
5690
     * On a Sun UltraSPARC-IIe, a server compiled with Forte 5.0 is
 
5691
       4% faster in 32-bit mode than in 64-bit mode.
 
5692
 
 
5693
     * Compiling on Linux-x86 using gcc without frame pointers
 
5694
       (-fomit-frame-pointer or -fomit-frame-pointer -ffixed-ebp)
 
5695
       makes mysqld 1% to 4% faster.
 
5696
 
 
5697
2.11.7. Installing MySQL from Source on Windows
 
5698
 
 
5699
   These instructions describe how to build binaries from source for
 
5700
   MySQL 5.1 on Windows. Instructions are provided for building
 
5701
   binaries from a standard source distribution or from the Bazaar
 
5702
   tree that contains the latest development source.
 
5703
   Note
 
5704
 
 
5705
   The instructions here are strictly for users who want to test
 
5706
   MySQL on Microsoft Windows from the latest source distribution or
 
5707
   from the Bazaar tree. For production use, we do not advise using a
 
5708
   MySQL server built by yourself from source. Normally, it is best
 
5709
   to use precompiled binary distributions of MySQL that are built
 
5710
   specifically for optimal performance on Windows by Oracle
 
5711
   Corporation. Instructions for installing binary distributions are
 
5712
   available in Section 2.3, "Installing MySQL on Microsoft Windows."
 
5713
 
 
5714
   To build MySQL on Windows from source, you must satisfy the
 
5715
   following system, compiler, and resource requirements:
 
5716
 
 
5717
     * Windows 2000, Windows XP, or newer version.
 
5718
       Windows Vista is supported when using Visual Studio 2005
 
5719
       provided you have installed the following updates:
 
5720
 
 
5721
          + Microsoft Visual Studio 2005 Professional Edition - ENU
 
5722
            Service Pack 1 (KB926601)
 
5723
            (http://support.microsoft.com/?kbid=926601)
 
5724
 
 
5725
          + Security Update for Microsoft Visual Studio 2005
 
5726
            Professional Edition - ENU (KB937061)
 
5727
            (http://support.microsoft.com/?kbid=937061)
 
5728
 
 
5729
          + Update for Microsoft Visual Studio 2005 Professional
 
5730
            Edition - ENU (KB932232)
 
5731
            (http://support.microsoft.com/?kbid=932232)
 
5732
 
 
5733
     * CMake, which can be downloaded from http://www.cmake.org.
 
5734
       After installing, modify your PATH environment variable to
 
5735
       include the directory where cmake is located.
 
5736
 
 
5737
     * Microsoft Visual C++ 2005 Express Edition, Visual Studio .Net
 
5738
       2003 (7.1), or Visual Studio 2005 (8.0) compiler system.
 
5739
 
 
5740
     * If you are using Visual C++ 2005 Express Edition, you must
 
5741
       also install an appropriate Platform SDK. More information and
 
5742
       links to downloads for various Windows platforms is available
 
5743
       from
 
5744
       http://www.microsoft.com/downloads/details.aspx?familyid=0baf2
 
5745
       b35-c656-4969-ace8-e4c0c0716adb.
 
5746
 
 
5747
     * If you are compiling from a Bazaar tree or making changes to
 
5748
       the parser, you need bison for Windows, which can be
 
5749
       downloaded from
 
5750
       http://gnuwin32.sourceforge.net/packages/bison.htm. Download
 
5751
       the package labeled "Complete package, excluding sources".
 
5752
       After installing the package, modify your PATH environment
 
5753
       variable to include the directory where bison is located.
 
5754
       Note
 
5755
       On Windows, the default location for bison is the C:\Program
 
5756
       Files\GnuWin32 directory. Some utilities, including m4, may
 
5757
       fail to find bison because of the space in the directory name.
 
5758
       You can resolve this by installing into a directory that does
 
5759
       not contain a space; for example C:\GnuWin32.
 
5760
 
 
5761
     * Cygwin might be necessary if you want to run the test script
 
5762
       or package the compiled binaries and support files into a Zip
 
5763
       archive. (Cygwin is needed only to test or package the
 
5764
       distribution, not to build it.) Cygwin is available from
 
5765
       http://cygwin.com.
 
5766
 
 
5767
     * 3GB to 5GB of disk space.
 
5768
 
 
5769
   You also need a MySQL source distribution for Windows, which can
 
5770
   be obtained two ways:
 
5771
 
 
5772
     * Obtain a source distribution packaged by Oracle Corporation.
 
5773
       These are available from http://dev.mysql.com/downloads/.
 
5774
 
 
5775
     * Package a source distribution yourself from the latest Bazaar
 
5776
       developer source tree. For instructions on pulling the latest
 
5777
       source files, see Section 2.11.3, "Installing MySQL from a
 
5778
       Development Source Tree."
 
5779
 
 
5780
   If you find something not working as expected, or you have
 
5781
   suggestions about ways to improve the current build process on
 
5782
   Windows, please send a message to the win32 mailing list. See
 
5783
   Section 1.6.1, "MySQL Mailing Lists."
 
5784
   Note
 
5785
 
 
5786
   To compile from the source code on Windows you must use the
 
5787
   standard source distribution (for example, mysql-5.1.62.zip) or
 
5788
   mysql-5.1.62.tar.gz). You build from the same distribution as used
 
5789
   to build MySQL on Unix, Linux and other platforms. Do not use the
 
5790
   Windows Source distributions as they do not contain the necessary
 
5791
   configuration script and other files.
 
5792
 
 
5793
   Follow this procedure to build MySQL:
 
5794
 
 
5795
    1. If you are installing from a packaged source distribution,
 
5796
       create a work directory (for example, C:\workdir), and unpack
 
5797
       the source distribution there using WinZip or another Windows
 
5798
       tool that can read .zip files. This directory is the work
 
5799
       directory in the following instructions.
 
5800
       Note
 
5801
       Commands that are located in the win directory should be
 
5802
       executed from the top-level source directory. Do not change
 
5803
       location into the win directory, as the commands will not
 
5804
       execute correctly.
 
5805
 
 
5806
    2. Start a command shell. If you have not configured the PATH and
 
5807
       other environment variables for all command shells, you may be
 
5808
       able to start a command shell from the Start Menu within the
 
5809
       Windows Visual Studio menu that contains the necessary
 
5810
       environment changes.
 
5811
 
 
5812
    3. Within the command shell, navigate to the work directory and
 
5813
       run the following command:
 
5814
C:\workdir>win\configure.js options
 
5815
       If you have associated the .js file extension with an
 
5816
       application such as a text editor, then you may need to use
 
5817
       the following command to force configure.js to be executed as
 
5818
       a script:
 
5819
C:\workdir>cscript win\configure.js options
 
5820
       These options are available for configure.js:
 
5821
 
 
5822
          + WITH_INNOBASE_STORAGE_ENGINE: Enable the InnoDB storage
 
5823
            engine.
 
5824
 
 
5825
          + WITH_PARTITION_STORAGE_ENGINE: Enable user-defined
 
5826
            partitioning.
 
5827
 
 
5828
          + WITH_ARCHIVE_STORAGE_ENGINE: Enable the ARCHIVE storage
 
5829
            engine.
 
5830
 
 
5831
          + WITH_BLACKHOLE_STORAGE_ENGINE: Enable the BLACKHOLE
 
5832
            storage engine.
 
5833
 
 
5834
          + WITH_EXAMPLE_STORAGE_ENGINE: Enable the EXAMPLE storage
 
5835
            engine.
 
5836
 
 
5837
          + WITH_FEDERATED_STORAGE_ENGINE: Enable the FEDERATED
 
5838
            storage engine.
 
5839
 
 
5840
          + WITH_NDBCLUSTER_STORAGE_ENGINE: Enable the NDBCLUSTER
 
5841
            storage engine in the MySQL server; cause binaries for
 
5842
            the MySQL Cluster management and data node, management
 
5843
            client, and other programs to be built.
 
5844
            This option is supported only in MySQL Cluster NDB 7.0
 
5845
            and later (NDBCLUSTER storage engine versions 6.4.0 and
 
5846
            later) using the MySQL Cluster sources. It cannot be used
 
5847
            to enable clustering support in other MySQL source trees
 
5848
            or distributions.
 
5849
 
 
5850
          + MYSQL_SERVER_SUFFIX=suffix: Server suffix, default none.
 
5851
 
 
5852
          + COMPILATION_COMMENT=comment: Server comment, default
 
5853
            "Source distribution".
 
5854
 
 
5855
          + MYSQL_TCP_PORT=port: Server port, default 3306.
 
5856
 
 
5857
          + DISABLE_GRANT_OPTIONS: Disables the --bootstrap,
 
5858
            --skip-grant-tables, and --init-file options for mysqld.
 
5859
            This option is available as of MySQL 5.1.15.
 
5860
       For example (type the command on one line):
 
5861
C:\workdir>win\configure.js WITH_INNOBASE_STORAGE_ENGINE
 
5862
             WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro
 
5863
 
 
5864
    4. From the work directory, execute the win\build-vs9.bat
 
5865
       (Windows Visual Studio 2008), win\build-vs8.bat (Windows
 
5866
       Visual Studio 2005), or win\build-vs71.bat (Windows Visual
 
5867
       Studio 2003) script, depending on the version of Visual Studio
 
5868
       you have installed. The script invokes CMake, which generates
 
5869
       the mysql.sln solution file.
 
5870
       You can also use the corresponding 64-bit file (for example
 
5871
       win\build-vs8_x64.bat or win\build-vs9_x64.bat) to build the
 
5872
       64-bit version of MySQL. However, you cannot build the 64-bit
 
5873
       version with Visual Studio Express Edition. You must use
 
5874
       Visual Studio 2005 (8.0) or higher.
 
5875
 
 
5876
    5. From the work directory, open the generated mysql.sln file
 
5877
       with Visual Studio and select the proper configuration using
 
5878
       the Configuration menu. The menu provides Debug, Release,
 
5879
       RelwithDebInfo, MinRelInfo options. Then select Solution >
 
5880
       Build to build the solution.
 
5881
       Remember the configuration that you use in this step. It is
 
5882
       important later when you run the test script because that
 
5883
       script needs to know which configuration you used.
 
5884
 
 
5885
    6. Test the server. The server built using the preceding
 
5886
       instructions expects that the MySQL base directory and data
 
5887
       directory are C:\mysql and C:\mysql\data by default. If you
 
5888
       want to test your server using the source tree root directory
 
5889
       and its data directory as the base directory and data
 
5890
       directory, you need to tell the server their path names. You
 
5891
       can either do this on the command line with the --basedir and
 
5892
       --datadir options, or by placing appropriate options in an
 
5893
       option file. (See Section 4.2.3.3, "Using Option Files.") If
 
5894
       you have an existing data directory elsewhere that you want to
 
5895
       use, you can specify its path name instead.
 
5896
       When the server is running in standalone fashion or as a
 
5897
       service based on your configuration, try to connect to it from
 
5898
       the mysql interactive command-line utility.
 
5899
       You can also run the standard test script, mysql-test-run.pl.
 
5900
       This script is written in Perl, so you'll need either Cygwin
 
5901
       or ActiveState Perl to run it. You may also need to install
 
5902
       the modules required by the script. To run the test script,
 
5903
       change location into the mysql-test directory under the work
 
5904
       directory, set the MTR_VS_CONFIG environment variable to the
 
5905
       configuration you selected earlier (or use the --vs-config
 
5906
       option), and invoke mysql-test-run.pl. For example (using
 
5907
       Cygwin and the bash shell):
 
5908
shell> cd mysql-test
 
5909
shell> export MTR_VS_CONFIG=debug
 
5910
shell> ./mysql-test-run.pl --force --timer
 
5911
shell> ./mysql-test-run.pl --force --timer --ps-protocol
 
5912
 
 
5913
   When you are satisfied that the programs you have built are
 
5914
   working correctly, stop the server. Now you can install the
 
5915
   distribution. One way to do this is to use the make_win_bin_dist
 
5916
   script in the scripts directory of the MySQL source distribution
 
5917
   (see Section 4.4.2, "make_win_bin_dist --- Package MySQL
 
5918
   Distribution as Zip Archive"). This is a shell script, so you must
 
5919
   have Cygwin installed if you want to use it. It creates a Zip
 
5920
   archive of the built executables and support files that you can
 
5921
   unpack in the location at which you want to install MySQL.
 
5922
 
 
5923
   It is also possible to install MySQL by copying directories and
 
5924
   files directly:
 
5925
 
 
5926
    1. Create the directories where you want to install MySQL. For
 
5927
       example, to install into C:\mysql, use these commands:
 
5928
C:\> mkdir C:\mysql
 
5929
C:\> mkdir C:\mysql\bin
 
5930
C:\> mkdir C:\mysql\data
 
5931
C:\> mkdir C:\mysql\share
 
5932
C:\> mkdir C:\mysql\scripts
 
5933
       If you want to compile other clients and link them to MySQL,
 
5934
       you should also create several additional directories:
 
5935
C:\> mkdir C:\mysql\include
 
5936
C:\> mkdir C:\mysql\lib
 
5937
C:\> mkdir C:\mysql\lib\debug
 
5938
C:\> mkdir C:\mysql\lib\opt
 
5939
       If you want to benchmark MySQL, create this directory:
 
5940
C:\> mkdir C:\mysql\sql-bench
 
5941
       Benchmarking requires Perl support for MySQL. See Section
 
5942
       2.15, "Perl Installation Notes."
 
5943
 
 
5944
    2. From the work directory, copy into the C:\mysql directory the
 
5945
       following files and directories:
 
5946
C:\> cd \workdir
 
5947
C:\workdir> mkdir C:\mysql
 
5948
C:\workdir> mkdir C:\mysql\bin
 
5949
C:\workdir> copy client\Release\*.exe C:\mysql\bin
 
5950
C:\workdir> copy sql\Release\mysqld.exe C:\mysql\bin\mysqld.exe
 
5951
C:\workdir> xcopy scripts\*.* C:\mysql\scripts /E
 
5952
C:\workdir> xcopy share\*.* C:\mysql\share /E
 
5953
       If you want to compile other clients and link them to MySQL,
 
5954
       you should also copy several libraries and header files:
 
5955
C:\workdir> copy lib\Release\mysqlclient.lib C:\mysql\lib\debug
 
5956
C:\workdir> copy lib\Release\libmysql.* C:\mysql\lib\debug
 
5957
C:\workdir> copy lib\Release\zlib.* C:\mysql\lib\debug
 
5958
C:\workdir> copy lib\Release\mysqlclient.lib C:\mysql\lib\opt
 
5959
C:\workdir> copy lib\Release\libmysql.* C:\mysql\lib\opt
 
5960
C:\workdir> copy lib\Release\zlib.* C:\mysql\lib\opt
 
5961
C:\workdir> copy include\*.h C:\mysql\include
 
5962
C:\workdir> copy libmysql\libmysql.def C:\mysql\include
 
5963
       Note
 
5964
       If you have compiled a Debug solution, rather than a Release
 
5965
       solution, install it by replacing Release with Debug in the
 
5966
       source file names just shown.
 
5967
       If you want to benchmark MySQL, you should also do this:
 
5968
C:\workdir> xcopy sql-bench\*.* C:\mysql\bench /E
 
5969
 
 
5970
   After installation, set up and start the server in the same way as
 
5971
   for binary Windows distributions. This includes creating the
 
5972
   system tables by running mysql_install_db. For more information,
 
5973
   see Section 2.3, "Installing MySQL on Microsoft Windows."
 
5974
 
 
5975
2.11.8. Notes on Installing MySQL on Solaris from Source
 
5976
 
 
5977
   When building MySQL on Solaris you can use either the Sun Studio
 
5978
   or GNU cc compilers. For more information on specific notes and
 
5979
   environments, use the following hints.
 
5980
 
 
5981
     * When building you should ensure that your PATH variable
 
5982
       includes the necessary tools, including ar for building
 
5983
       libraries. Some tools are located in /usr/ccs/bin.
 
5984
 
 
5985
     * When running configure, you should specify the C and C++
 
5986
       compiler explicitly to ensure that the right C compiler
 
5987
       combination is used:
 
5988
CC=gcc CXX=g++ ./configure
 
5989
 
 
5990
     * For detailed information on performance tuning your MySQL
 
5991
       installation for Solaris, you can use the information from
 
5992
       Krish Shankar
 
5993
       (http://blogs.sun.com/krishs/entry/sun_studio_compiler_options
 
5994
       _for) and the Sun Solaris MySQL Performance Tuning
 
5995
       (http://developers.sun.com/solaris/articles/mysql_perf_tune.ht
 
5996
       ml) pages.
 
5997
 
 
5998
     * If you have an UltraSPARC system, you can get 4% better
 
5999
       performance by adding -mcpu=v8 -Wa,-xarch=v8plusa to the
 
6000
       CFLAGS and CXXFLAGS environment variables.
 
6001
 
 
6002
     * If you have Sun's Forte 5.00 (or newer) or Sun Studio
 
6003
       compiler, you can run configure like this:
 
6004
CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt" \
 
6005
CXX=CC CXXFLAGS="-noex -mt" \
 
6006
./configure --prefix=/usr/local/mysql --enable-assembler
 
6007
 
 
6008
     * To create a 64-bit SPARC binary with Sun's Forte or Sun Studio
 
6009
       compiler, use the following configuration options:
 
6010
CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt -xarch=v9" \
 
6011
CXX=CC CXXFLAGS="-noex -mt -xarch=v9" ASFLAGS="-xarch=v9" \
 
6012
./configure --prefix=/usr/local/mysql --enable-assembler
 
6013
       To create a 64-bit Solaris binary using gcc, add -m64 to
 
6014
       CFLAGS and CXXFLAGS and remove --enable-assembler from the
 
6015
       configure line.
 
6016
       In the MySQL benchmarks, we obtained a 4% speed increase on
 
6017
       UltraSPARC when using Forte 5.0 in 32-bit mode, as compared to
 
6018
       using gcc 3.2 with the -mcpu flag.
 
6019
       If you create a 64-bit mysqld binary, it is 4% slower than the
 
6020
       32-bit binary, but can handle more threads and memory.
 
6021
 
 
6022
     * If you get a problem with fdatasync or sched_yield, you can
 
6023
       fix this by adding LIBS=-lrt to the configure line
 
6024
 
 
6025
     * Solaris does not provide static versions of all system
 
6026
       libraries (libpthreads and libdl), so you cannot compile MySQL
 
6027
       with --static. If you try to do so, you get one of the
 
6028
       following errors:
 
6029
ld: fatal: library -ldl: not found
 
6030
undefined reference to `dlopen'
 
6031
cannot find -lrt
 
6032
 
 
6033
     * If you link your own MySQL client programs, you may see the
 
6034
       following error at runtime:
 
6035
ld.so.1: fatal: libmysqlclient.so.#:
 
6036
open failed: No such file or directory
 
6037
       To avoid this problem, use one of the following methods:
 
6038
 
 
6039
          + Use the crle tool to add the directory containing the
 
6040
            libmysqlclient library file to the list of standard
 
6041
            library directories. You need administrator privileges to
 
6042
            do this. Make sure you update the library information,
 
6043
            rather than replace it with the new path. For example,
 
6044
            the following command adds the directory to the list of
 
6045
            standard directories searched for libraries.
 
6046
crle -u -l /usr/local/mysql/lib
 
6047
            For 64-bit libraries, add the -64 option:
 
6048
crle -64 -u -l /usr/local/mysql/lib
 
6049
 
 
6050
          + Link clients with the
 
6051
            -Wl,r/full/path/to/libmysqlclient.so flag rather than
 
6052
            with -Lpath).
 
6053
 
 
6054
          + Copy libmysqclient.so to /usr/lib.
 
6055
 
 
6056
          + Add the path name of the directory where
 
6057
            libmysqlclient.so is located to the LD_RUN_PATH
 
6058
            environment variable before running your client.
 
6059
 
 
6060
     * If you have problems with configure trying to link with -lz
 
6061
       when you do not have zlib installed, you have two options:
 
6062
 
 
6063
          + If you want to be able to use the compressed
 
6064
            communication protocol, obtain and install zlib from
 
6065
            ftp.gnu.org.
 
6066
 
 
6067
          + To build without zlib, run configure with the
 
6068
            --with-named-z-libs=no option when building MySQL.
 
6069
 
 
6070
     * If you are using gcc and have problems with loading
 
6071
       user-defined functions (UDFs) into MySQL, try adding -lgcc to
 
6072
       the link line for the UDF.
 
6073
 
 
6074
2.11.9. Notes on Installing MySQL on AIX from Source
 
6075
 
 
6076
   General notes on building MySQL from source on IBM AIX:
 
6077
 
 
6078
     * Automatic xlC detection is missing from Autoconf, so a number
 
6079
       of variables need to be set before running configure. The
 
6080
       following example uses the IBM compiler:
6895
6081
export CC="xlc_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192 "
6896
6082
export CXX="xlC_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192"
6897
6083
export CFLAGS="-I /usr/local/include"
6905
6091
                --libexecdir='/usr/local/bin' \
6906
6092
                --enable-thread-safe-client \
6907
6093
                --enable-large-files
6908
 
 
6909
 
   The preceding options are used to compile the MySQL distribution
6910
 
   that can be found at http://www-frec.bull.com/.
6911
 
 
6912
 
   If you change the -O3 to -O2 in the preceding configure line, you
6913
 
   must also remove the -qstrict option. This is a limitation in the
6914
 
   IBM C compiler.
6915
 
 
6916
 
   If you are using gcc to compile MySQL, you must use the
6917
 
   -fno-exceptions flag, because the exception handling in gcc is not
6918
 
   thread-safe! There are also some known problems with IBM's
6919
 
   assembler that may cause it to generate bad code when used with
6920
 
   gcc.
6921
 
 
6922
 
   Use the following configure line with gcc 2.95 on AIX:
6923
 
CC="gcc -pipe -mcpu=power -Wa,-many" \
6924
 
CXX="gcc -pipe -mcpu=power -Wa,-many" \
6925
 
CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" \
6926
 
./configure --prefix=/usr/local/mysql --with-low-memory
6927
 
 
6928
 
   The -Wa,-many option is necessary for the compile to be
6929
 
   successful. IBM is aware of this problem but is in no hurry to fix
6930
 
   it because of the workaround that is available. We don't know if
6931
 
   the -fno-exceptions is required with gcc 2.95, but because MySQL
6932
 
   doesn't use exceptions and the option generates faster code, you
6933
 
   should always use it with gcc.
6934
 
 
6935
 
   If you get a problem with assembler code, try changing the
6936
 
   -mcpu=xxx option to match your CPU. Typically power2, power, or
6937
 
   powerpc may need to be used. Alternatively, you might need to use
6938
 
   604 or 604e. We are not positive but suspect that power would
6939
 
   likely be safe most of the time, even on a power2 machine.
6940
 
 
6941
 
   If you don't know what your CPU is, execute a uname -m command. It
6942
 
   produces a string that looks like 000514676700, with a format of
6943
 
   xxyyyyyymmss where xx and ss are always 00, yyyyyy is a unique
6944
 
   system ID and mm is the ID of the CPU Planar. A chart of these
6945
 
   values can be found at
6946
 
   http://www16.boulder.ibm.com/pseries/en_US/cmds/aixcmds5/uname.htm
6947
 
   .
6948
 
 
6949
 
   This gives you a machine type and a machine model you can use to
6950
 
   determine what type of CPU you have.
6951
 
 
6952
 
   If you have problems with threads on AIX 5.3, you should upgrade
6953
 
   AIX 5.3 to technology level 7 (5300-07).
6954
 
 
6955
 
   If you have problems with signals (MySQL dies unexpectedly under
6956
 
   high load), you may have found an OS bug with threads and signals.
6957
 
   In this case, you can tell MySQL not to use signals by configuring
6958
 
   as follows:
 
6094
       The preceding options are used to compile the MySQL
 
6095
       distribution that can be found at http://www-frec.bull.com/.
 
6096
 
 
6097
     * If you change the -O3 to -O2 in the preceding configure line,
 
6098
       you must also remove the -qstrict option. This is a limitation
 
6099
       in the IBM C compiler.
 
6100
 
 
6101
     * If you compile MySQL with gcc, you must use the
 
6102
       -fno-exceptions flag because the exception handling in gcc is
 
6103
       not thread-safe. There are also some known problems with IBM's
 
6104
       assembler that may cause it to generate bad code when used
 
6105
       with gcc.
 
6106
 
 
6107
     * If you have problems with signals (MySQL dies unexpectedly
 
6108
       under high load), you may have found an OS bug with threads
 
6109
       and signals. In this case, you can tell MySQL not to use
 
6110
       signals by configuring as follows:
6959
6111
CFLAGS=-DDONT_USE_THR_ALARM CXX=gcc \
6960
6112
CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti \
6961
6113
-DDONT_USE_THR_ALARM" \
6962
6114
./configure --prefix=/usr/local/mysql --with-debug \
6963
6115
    --with-low-memory
6964
 
 
6965
 
   This doesn't affect the performance of MySQL, but has the side
6966
 
   effect that you can't kill clients that are "sleeping" on a
6967
 
   connection with mysqladmin kill or mysqladmin shutdown. Instead,
6968
 
   the client dies when it issues its next command.
6969
 
 
6970
 
   On some versions of AIX, linking with libbind.a makes
6971
 
   getservbyname() dump core. This is an AIX bug and should be
6972
 
   reported to IBM.
6973
 
 
6974
 
   For AIX 4.2.1 and gcc, you have to make the following changes.
6975
 
 
6976
 
   After configuring, edit config.h and include/my_config.h and
6977
 
   change the line that says this:
6978
 
#define HAVE_SNPRINTF 1
6979
 
 
6980
 
   to this:
6981
 
#undef HAVE_SNPRINTF
6982
 
 
6983
 
   And finally, in mysqld.cc, you need to add a prototype for
6984
 
   initgroups().
6985
 
#ifdef _AIX41
6986
 
extern "C" int initgroups(const char *,int);
6987
 
#endif
6988
 
 
6989
 
   For 32-bit binaries, if you need to allocate a lot of memory to
6990
 
   the mysqld process, it is not enough to just use ulimit -d
6991
 
   unlimited. You may also have to modify mysqld_safe to add a line
6992
 
   something like this:
6993
 
export LDR_CNTRL='MAXDATA=0x80000000'
6994
 
 
6995
 
   You can find more information about using a lot of memory at
6996
 
   http://publib16.boulder.ibm.com/pseries/en_US/aixprggd/genprogc/lr
6997
 
   g_prg_support.htm.
6998
 
 
6999
 
   Users of AIX 4.3 should use gmake instead of the make utility
7000
 
   included with AIX.
7001
 
 
7002
 
   As of AIX 4.1, the C compiler has been unbundled from AIX as a
7003
 
   separate product. gcc 3.3.2 can be obtained here:
7004
 
   ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/gc
7005
 
   c/
7006
 
 
7007
 
   The steps for compiling MySQL on AIX with gcc 3.3.2 are similar to
7008
 
   those for using gcc 2.95 (in particular, the need to edit config.h
7009
 
   and my_config.h after running configure). However, before running
7010
 
   configure, you should also patch the curses.h file as follows:
7011
 
/opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/include/curses
7012
 
.h.ORIG
7013
 
       Mon Dec 26 02:17:28 2005
7014
 
--- /opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/include/cu
7015
 
rses.h
7016
 
Mon Dec 26 02:40:13 2005
7017
 
***************
7018
 
*** 2023,2029 ****
7019
 
 
7020
 
 
7021
 
  #endif /* _AIX32_CURSES */
7022
 
! #if defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus) || de
7023
 
fined
7024
 
(__STRICT_ANSI__)
7025
 
  extern int delwin (WINDOW *);
7026
 
  extern int endwin (void);
7027
 
  extern int getcurx (WINDOW *);
7028
 
--- 2023,2029 ----
7029
 
 
7030
 
 
7031
 
  #endif /* _AIX32_CURSES */
7032
 
! #if 0 && (defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus)
7033
 
|| defined
7034
 
(__STRICT_ANSI__))
7035
 
  extern int delwin (WINDOW *);
7036
 
  extern int endwin (void);
7037
 
  extern int getcurx (WINDOW *);
7038
 
 
7039
 
2.13. Post-Installation Setup and Testing
 
6116
       This does not affect the performance of MySQL, but has the
 
6117
       side effect that you cannot kill clients that are "sleeping"
 
6118
       on a connection with mysqladmin kill or mysqladmin shutdown.
 
6119
       Instead, the client dies when it issues its next command.
 
6120
 
 
6121
     * On some versions of AIX, linking with libbind.a makes
 
6122
       getservbyname() dump core. This is an AIX bug and should be
 
6123
       reported to IBM.
 
6124
 
 
6125
2.11.10. Notes on Installing MySQL on HP-UX from Source
 
6126
 
 
6127
   General notes on compiling MySQL on HP-UX.
 
6128
 
 
6129
     * If you are using HP-UX compiler, you can use the following
 
6130
       command (which has been tested with cc B.11.11.04):
 
6131
CC=cc CXX=aCC CFLAGS=+DD64 CXXFLAGS=+DD64 ./configure \
 
6132
    --with-extra-character-set=complex
 
6133
       You can ignore any errors of the following type:
 
6134
aCC: warning 901: unknown option: `-3': use +help for online
 
6135
documentation
 
6136
 
 
6137
     * If you get the following error from configure, verify that you
 
6138
       do not have the path to the K&R compiler before the path to
 
6139
       the HP-UX C and C++ compiler:
 
6140
checking for cc option to accept ANSI C... no
 
6141
configure: error: MySQL requires an ANSI C compiler (and a C++ compil
 
6142
er).
 
6143
Try gcc. See the Installation chapter in the Reference Manual.
 
6144
 
 
6145
     * Another reason for compile failure is that you did not define
 
6146
       the +DD64 flags as just described.
 
6147
 
 
6148
2.12. Postinstallation Setup and Testing
7040
6149
 
7041
6150
   After installing MySQL, there are some issues that you should
7042
6151
   address. For example, on Unix, you should initialize the data
7047
6156
   can create time zone tables to enable recognition of named time
7048
6157
   zones.
7049
6158
 
7050
 
   The following sections include post-installation procedures that
 
6159
   The following sections include postinstallation procedures that
7051
6160
   are specific to Windows systems and to Unix systems. Another
7052
 
   section, Section 2.13.1.3, "Starting and Troubleshooting the MySQL
 
6161
   section, Section 2.12.1.3, "Starting and Troubleshooting the MySQL
7053
6162
   Server," applies to all platforms; it describes what to do if you
7054
 
   have trouble getting the server to start. Section 2.13.2,
 
6163
   have trouble getting the server to start. Section 2.12.2,
7055
6164
   "Securing the Initial MySQL Accounts," also applies to all
7056
6165
   platforms. You should follow its instructions to make sure that
7057
6166
   you have properly protected your MySQL accounts by assigning
7062
6171
   management in Section 5.4, "The MySQL Access Privilege System,"
7063
6172
   and Section 5.5, "MySQL User Account Management."
7064
6173
 
7065
 
2.13.1. Unix Post-Installation Procedures
 
6174
2.12.1. Unix Postinstallation Procedures
7066
6175
 
7067
 
   After installing MySQL on Unix, you need to initialize the grant
 
6176
   After installing MySQL on Unix, you must initialize the grant
7068
6177
   tables, start the server, and make sure that the server works
7069
6178
   satisfactorily. You may also wish to arrange for the server to be
7070
6179
   started and stopped automatically when your system starts and
7073
6182
 
7074
6183
   On Unix, the grant tables are set up by the mysql_install_db
7075
6184
   program. For some installation methods, this program is run for
7076
 
   you automatically:
 
6185
   you automatically if an existing database cannot be found.
7077
6186
 
7078
6187
     * If you install MySQL on Linux using RPM distributions, the
7079
6188
       server RPM runs mysql_install_db.
7080
6189
 
 
6190
     * Using the native packaging system on many platforms, including
 
6191
       Debian Linux, Ubuntu Linux, Gentoo Linux and others, the
 
6192
       mysql_install_db command is run for you.
 
6193
 
7081
6194
     * If you install MySQL on Mac OS X using a PKG distribution, the
7082
6195
       installer runs mysql_install_db.
7083
6196
 
7084
 
   Otherwise, you'll need to run mysql_install_db yourself.
 
6197
   For other platforms and installation types, including generic
 
6198
   binary and source installs, you will need to run mysql_install_db
 
6199
   yourself.
7085
6200
 
7086
6201
   The following procedure describes how to initialize the grant
7087
 
   tables (if that has not previously been done) and then start the
 
6202
   tables (if that has not previously been done) and start the
7088
6203
   server. It also suggests some commands that you can use to test
7089
6204
   whether the server is accessible and working properly. For
7090
6205
   information about starting and stopping the server automatically,
7091
 
   see Section 2.13.1.2, "Starting and Stopping MySQL Automatically."
 
6206
   see Section 2.12.1.2, "Starting and Stopping MySQL Automatically."
7092
6207
 
7093
6208
   After you complete the procedure and have the server running, you
7094
6209
   should assign passwords to the accounts created by
7095
 
   mysql_install_db. Instructions for doing so are given in Section
7096
 
   2.13.2, "Securing the Initial MySQL Accounts."
 
6210
   mysql_install_db and perhaps restrict access to test databases.
 
6211
   For instructions, see Section 2.12.2, "Securing the Initial MySQL
 
6212
   Accounts."
7097
6213
 
7098
6214
   In the examples shown here, the server runs under the user ID of
7099
6215
   the mysql login account. This assumes that such an account exists.
7100
6216
   Either create the account if it does not exist, or substitute the
7101
6217
   name of a different existing login account that you plan to use
7102
 
   for running the server.
 
6218
   for running the server. For information about creating the
 
6219
   account, see Creating a mysql System User and Group, in Section
 
6220
   2.2, "Installing MySQL from Generic Binaries on Unix/Linux."
7103
6221
 
7104
6222
    1. Change location into the top-level directory of your MySQL
7105
6223
       installation, represented here by BASEDIR:
7106
6224
shell> cd BASEDIR
7107
 
       BASEDIR is likely to be something like /usr/local/mysql or
7108
 
       /usr/local. The following steps assume that you are located in
7109
 
       this directory.
7110
 
 
7111
 
    2. If necessary, run the mysql_install_db program to set up the
 
6225
       BASEDIR is the installation directory for your MySQL instance.
 
6226
       It is likely to be something like /usr/local/mysql or
 
6227
       /usr/local. The following steps assume that you have changed
 
6228
       location to this directory.
 
6229
       You will find several files and subdirectories in the BASEDIR
 
6230
       directory. The most important for installation purposes are
 
6231
       the bin and scripts subdirectories:
 
6232
 
 
6233
          + The bin directory contains client programs and the
 
6234
            server. You should add the full path name of this
 
6235
            directory to your PATH environment variable so that your
 
6236
            shell finds the MySQL programs properly. See Section
 
6237
            2.14, "Environment Variables."
 
6238
            For some distribution types, mysqld is installed in the
 
6239
            libexec directory.
 
6240
 
 
6241
          + The scripts directory contains the mysql_install_db
 
6242
            script used to initialize the mysql database containing
 
6243
            the grant tables that store the server access
 
6244
            permissions.
 
6245
            For some distribution types, mysql_install_db is
 
6246
            installed in the bin directory.
 
6247
 
 
6248
    2. If necessary, ensure that the distribution contents are
 
6249
       accessible to mysql. If you installed the distribution as
 
6250
       mysql, no further action is required. If you installed the
 
6251
       distribution as root, its contents will be owned by root.
 
6252
       Change its ownership to mysql by executing the following
 
6253
       commands as root in the installation directory. The first
 
6254
       command changes the owner attribute of the files to the mysql
 
6255
       user. The second changes the group attribute to the mysql
 
6256
       group.
 
6257
shell> chown -R mysql .
 
6258
shell> chgrp -R mysql .
 
6259
 
 
6260
    3. If necessary, run the mysql_install_db program to set up the
7112
6261
       initial MySQL grant tables containing the privileges that
7113
 
       determine how users are allowed to connect to the server.
7114
 
       You'll need to do this if you used a distribution type for
7115
 
       which the installation procedure doesn't run the program for
 
6262
       determine how users are permitted to connect to the server.
 
6263
       You will need to do this if you used a distribution type for
 
6264
       which the installation procedure does not run the program for
7116
6265
       you.
7117
6266
       Typically, mysql_install_db needs to be run only the first
7118
6267
       time you install MySQL, so you can skip this step if you are
7119
6268
       upgrading an existing installation, However, mysql_install_db
7120
6269
       does not overwrite any existing privilege tables, so it should
7121
6270
       be safe to run in any circumstances.
7122
 
       To initialize the grant tables, use one of the following
7123
 
       commands, depending on whether mysql_install_db is located in
7124
 
       the bin or scripts directory:
 
6271
       The exact location of mysql_install_db depends on the layout
 
6272
       for your given installation. To initialize the grant tables,
 
6273
       use one of the following commands, depending on whether
 
6274
       mysql_install_db is located in the bin or scripts directory:
 
6275
shell> scripts/mysql_install_db --user=mysql
7125
6276
shell> bin/mysql_install_db --user=mysql
7126
 
shell> scripts/mysql_install_db --user=mysql
7127
6277
       It might be necessary to specify other options such as
7128
 
       --basedir or --datadir if mysql_install_db does not use the
7129
 
       correct locations for the installation directory or data
 
6278
       --basedir or --datadir if mysql_install_db does not identify
 
6279
       the correct locations for the installation directory or data
7130
6280
       directory. For example:
7131
 
shell> bin/mysql_install_db --user=mysql \
 
6281
shell> scripts/mysql_install_db --user=mysql \
7132
6282
         --basedir=/opt/mysql/mysql \
7133
6283
         --datadir=/opt/mysql/mysql/data
7134
6284
       The mysql_install_db script creates the server's data
7135
 
       directory. Under the data directory, it creates directories
7136
 
       for the mysql database that holds all database privileges and
7137
 
       the test database that you can use to test MySQL. The script
7138
 
       also creates privilege table entries for root and
7139
 
       anonymous-user accounts. The accounts have no passwords
7140
 
       initially. A description of their initial privileges is given
7141
 
       in Section 2.13.2, "Securing the Initial MySQL Accounts."
7142
 
       Briefly, these privileges allow the MySQL root user to do
7143
 
       anything, and allow anybody to create or use databases with a
7144
 
       name of test or starting with test_.
 
6285
       directory with mysql as the owner. Under the data directory,
 
6286
       it creates directories for the mysql database that holds the
 
6287
       grant tables and the test database that you can use to test
 
6288
       MySQL. The script also creates privilege table entries for
 
6289
       root and anonymous-user accounts. The accounts have no
 
6290
       passwords initially. Section 2.12.2, "Securing the Initial
 
6291
       MySQL Accounts," describes the initial privileges. Briefly,
 
6292
       these privileges permit the MySQL root user to do anything,
 
6293
       and permit anybody to create or use databases with a name of
 
6294
       test or starting with test_. See Section 5.4, "The MySQL
 
6295
       Access Privilege System," for a complete listing and
 
6296
       description of the grant tables.
7145
6297
       It is important to make sure that the database directories and
7146
6298
       files are owned by the mysql login account so that the server
7147
6299
       has read and write access to them when you run it later. To
7148
 
       ensure this, the --user option should be used as shown if you
7149
 
       run mysql_install_db as root. Otherwise, you should execute
7150
 
       the script while logged in as mysql, in which case you can
7151
 
       omit the --user option from the command.
7152
 
       mysql_install_db creates several tables in the mysql database,
7153
 
       including user, db, host, tables_priv, columns_priv, func, and
7154
 
       others. See Section 5.4, "The MySQL Access Privilege System,"
7155
 
       for a complete listing and description of these tables.
7156
 
       If you don't want to have the test database, you can remove it
7157
 
       with mysqladmin -u root drop test after starting the server.
 
6300
       ensure this if you run mysql_install_db as root, include the
 
6301
       --user option as shown. Otherwise, you should execute the
 
6302
       script while logged in as mysql, in which case you can omit
 
6303
       the --user option from the command.
 
6304
       If you do not want to have the test database, you can remove
 
6305
       it after starting the server, using the instructions in
 
6306
       Section 2.12.2, "Securing the Initial MySQL Accounts."
7158
6307
       If you have trouble with mysql_install_db at this point, see
7159
 
       Section 2.13.1.1, "Problems Running mysql_install_db."
7160
 
 
7161
 
    3. Start the MySQL server:
 
6308
       Section 2.12.1.1, "Problems Running mysql_install_db."
 
6309
 
 
6310
    4. Most of the MySQL installation can be owned by root if you
 
6311
       like. The exception is that the data directory must be owned
 
6312
       by mysql. To accomplish this, run the following commands as
 
6313
       root in the installation directory. For some distribution
 
6314
       types, the data directory might be named var rather than data;
 
6315
       adjust the second command accordingly.
 
6316
shell> chown -R root .
 
6317
shell> chown -R mysql data
 
6318
 
 
6319
    5. If the plugin directory (the directory named by the plugin_dir
 
6320
       system variable) is writable by the server, it may be possible
 
6321
       for a user to write executable code to a file in the directory
 
6322
       using SELECT ... INTO DUMPFILE. This can be prevented by
 
6323
       making plugin_dir read only to the server or by setting
 
6324
       --secure-file-priv to a directory where SELECT writes can be
 
6325
       made safely.
 
6326
 
 
6327
    6. If you installed MySQL using a source distribution, you may
 
6328
       want to optionally copy one of the provided configuration
 
6329
       files from the support-files directory into your /etc
 
6330
       directory. There are different sample configuration files for
 
6331
       different use cases, server types, and CPU and RAM
 
6332
       configurations. If you want to use one of these standard
 
6333
       files, you should copy it to /etc/my.cnf, or /etc/mysql/my.cnf
 
6334
       and edit and check the configuration before starting your
 
6335
       MySQL server for the first time.
 
6336
       If you do not copy one of the standard configuration files,
 
6337
       the MySQL server will be started with the default settings.
 
6338
       If you want MySQL to start automatically when you boot your
 
6339
       machine, you can copy support-files/mysql.server to the
 
6340
       location where your system has its startup files. More
 
6341
       information can be found in the mysql.server script itself,
 
6342
       and in Section 2.12.1.2, "Starting and Stopping MySQL
 
6343
       Automatically."
 
6344
 
 
6345
    7. Start the MySQL server:
7162
6346
shell> bin/mysqld_safe --user=mysql &
7163
6347
       It is important that the MySQL server be run using an
7164
 
       unprivileged (non-root) login account. To ensure this, the
7165
 
       --user option should be used as shown if you run mysqld_safe
7166
 
       as system root. Otherwise, you should execute the script while
7167
 
       logged in to the system as mysql, in which case you can omit
7168
 
       the --user option from the command.
7169
 
       Further instructions for running MySQL as an unprivileged user
7170
 
       are given in Section 5.3.5, "How to Run MySQL as a Normal
7171
 
       User."
7172
 
       If you neglected to create the grant tables before proceeding
7173
 
       to this step, the following message appears in the error log
7174
 
       file when you start the server:
 
6348
       unprivileged (non-root) login account. To ensure this if you
 
6349
       run mysqld_safe as root, include the --user option as shown.
 
6350
       Otherwise, you should execute the script while logged in as
 
6351
       mysql, in which case you can omit the --user option from the
 
6352
       command.
 
6353
       For further instructions for running MySQL as an unprivileged
 
6354
       user, see Section 5.3.6, "How to Run MySQL as a Normal User."
 
6355
       If the command fails immediately and prints mysqld ended, look
 
6356
       for information in the error log (which by default is the
 
6357
       host_name.err file in the data directory).
 
6358
       If you neglected to create the grant tables by running
 
6359
       mysql_install_db before proceeding to this step, the following
 
6360
       message appears in the error log file when you start the
 
6361
       server:
7175
6362
mysqld: Can't find file: 'host.frm'
 
6363
       This error also occurs if you run mysql_install_db as root
 
6364
       without the --user option. Remove the data directory and run
 
6365
       mysql_install_db with the --user option as described
 
6366
       previously.
7176
6367
       If you have other problems starting the server, see Section
7177
 
       2.13.1.3, "Starting and Troubleshooting the MySQL Server."
 
6368
       2.12.1.3, "Starting and Troubleshooting the MySQL Server." For
 
6369
       more information about mysqld_safe, see Section 4.3.2,
 
6370
       "mysqld_safe --- MySQL Server Startup Script."
7178
6371
 
7179
 
    4. Use mysqladmin to verify that the server is running. The
 
6372
    8. Use mysqladmin to verify that the server is running. The
7180
6373
       following commands provide simple tests to check whether the
7181
6374
       server is up and responding to connections:
7182
6375
shell> bin/mysqladmin version
7185
6378
       on your platform and version of MySQL, but should be similar
7186
6379
       to that shown here:
7187
6380
shell> bin/mysqladmin version
7188
 
mysqladmin  Ver 14.12 Distrib 5.1.41, for pc-linux-gnu on i686
 
6381
mysqladmin  Ver 14.12 Distrib 5.1.62, for pc-linux-gnu on i686
7189
6382
...
7190
6383
 
7191
 
Server version          5.1.41
 
6384
Server version          5.1.62
7192
6385
Protocol version        10
7193
6386
Connection              Localhost via UNIX socket
7194
6387
UNIX socket             /var/lib/mysql/mysql.sock
7200
6393
       To see what else you can do with mysqladmin, invoke it with
7201
6394
       the --help option.
7202
6395
 
7203
 
    5. Verify that you can shut down the server:
 
6396
    9. Verify that you can shut down the server:
7204
6397
shell> bin/mysqladmin -u root shutdown
7205
 
 
7206
 
    6. Verify that you can start the server again. Do this by using
 
6398
   10. Verify that you can start the server again. Do this by using
7207
6399
       mysqld_safe or by invoking mysqld directly. For example:
7208
 
shell> bin/mysqld_safe --user=mysql --log &
7209
 
       If mysqld_safe fails, see Section 2.13.1.3, "Starting and
 
6400
shell> bin/mysqld_safe --user=mysql &
 
6401
       If mysqld_safe fails, see Section 2.12.1.3, "Starting and
7210
6402
       Troubleshooting the MySQL Server."
7211
 
 
7212
 
    7. Run some simple tests to verify that you can retrieve
 
6403
   11. Run some simple tests to verify that you can retrieve
7213
6404
       information from the server. The output should be similar to
7214
6405
       what is shown here:
7215
6406
shell> bin/mysqlshow
7216
 
+-----------+
7217
 
| Databases |
7218
 
+-----------+
7219
 
| mysql     |
7220
 
| test      |
7221
 
+-----------+
 
6407
+--------------------+
 
6408
|     Databases      |
 
6409
+--------------------+
 
6410
| information_schema |
 
6411
| mysql              |
 
6412
| test               |
 
6413
+--------------------+
7222
6414
 
7223
6415
shell> bin/mysqlshow mysql
7224
6416
Database: mysql
7227
6419
+---------------------------+
7228
6420
| columns_priv              |
7229
6421
| db                        |
 
6422
| event                     |
7230
6423
| func                      |
7231
6424
| help_category             |
7232
6425
| help_keyword              |
7233
6426
| help_relation             |
7234
6427
| help_topic                |
7235
6428
| host                      |
 
6429
| plugin                    |
7236
6430
| proc                      |
7237
6431
| procs_priv                |
 
6432
| servers                   |
7238
6433
| tables_priv               |
7239
6434
| time_zone                 |
7240
6435
| time_zone_leap_second     |
7251
6446
| %    | test   |      |
7252
6447
| %    | test_% |      |
7253
6448
+------+--------+------+
7254
 
 
7255
 
    8. There is a benchmark suite in the sql-bench directory (under
 
6449
   12. There is a benchmark suite in the sql-bench directory (under
7256
6450
       the MySQL installation directory) that you can use to compare
7257
6451
       how MySQL performs on different platforms. The benchmark suite
7258
6452
       is written in Perl. It requires the Perl DBI module that
7270
6464
       tests, execute these commands:
7271
6465
shell> cd sql-bench
7272
6466
shell> perl run-all-tests
7273
 
       If you don't have the sql-bench directory, you probably
 
6467
       If you do not have the sql-bench directory, you probably
7274
6468
       installed MySQL using RPM files other than the source RPM.
7275
6469
       (The source RPM includes the sql-bench benchmark directory.)
7276
6470
       In this case, you must first install the benchmark suite
7284
6478
shell> mysql -vvf test < ./tests/auto_increment.tst
7285
6479
       The expected result of the test can be found in the
7286
6480
       ./tests/auto_increment.res file.
7287
 
 
7288
 
    9. At this point, you should have the server running. However,
7289
 
       none of the initial MySQL accounts have a password, so you
7290
 
       should assign passwords using the instructions found in
7291
 
       Section 2.13.2, "Securing the Initial MySQL Accounts."
 
6481
   13. At this point, you should have the server running. However,
 
6482
       none of the initial MySQL accounts have a password, and the
 
6483
       server permits permissive access to test databases. To tighten
 
6484
       security, follow the instructions in Section 2.12.2, "Securing
 
6485
       the Initial MySQL Accounts."
7292
6486
 
7293
6487
   The MySQL 5.1 installation procedure creates time zone tables in
7294
 
   the mysql database. However, you must populate the tables manually
7295
 
   using the instructions in Section 9.7, "MySQL Server Time Zone
7296
 
   Support."
7297
 
 
7298
 
2.13.1.1. Problems Running mysql_install_db
 
6488
   the mysql database but does not populate them. To do so, use the
 
6489
   instructions in Section 9.6, "MySQL Server Time Zone Support."
 
6490
 
 
6491
   To make it more convenient to invoke programs installed in the bin
 
6492
   directory under the installation directory, you can add that
 
6493
   directory to your PATH environment variable setting. That enables
 
6494
   you to run a program by typing only its name, not its entire path
 
6495
   name. See Section 4.2.4, "Setting Environment Variables."
 
6496
 
 
6497
   You can set up new accounts using the bin/mysql_setpermission
 
6498
   script if you install the DBI and DBD::mysql Perl modules. See
 
6499
   Section 4.6.14, "mysql_setpermission --- Interactively Set
 
6500
   Permissions in Grant Tables." For Perl module installation
 
6501
   instructions, see Section 2.15, "Perl Installation Notes."
 
6502
 
 
6503
   If you would like to use mysqlaccess and have the MySQL
 
6504
   distribution in some nonstandard location, you must change the
 
6505
   location where mysqlaccess expects to find the mysql client. Edit
 
6506
   the bin/mysqlaccess script at approximately line 18. Search for a
 
6507
   line that looks like this:
 
6508
$MYSQL     = '/usr/local/bin/mysql';    # path to mysql executable
 
6509
 
 
6510
   Change the path to reflect the location where mysql actually is
 
6511
   stored on your system. If you do not do this, a Broken pipe error
 
6512
   will occur when you run mysqlaccess.
 
6513
 
 
6514
2.12.1.1. Problems Running mysql_install_db
7299
6515
 
7300
6516
   The purpose of the mysql_install_db script is to generate new
7301
6517
   MySQL privilege tables. It does not overwrite existing MySQL
7309
6525
   bin directory and the data directory is named data. To rename the
7310
6526
   mysql database and re-run mysql_install_db, use these commands.
7311
6527
shell> mv data/mysql data/mysql.old
7312
 
shell> bin/mysql_install_db --user=mysql
 
6528
shell> scripts/mysql_install_db --user=mysql
7313
6529
 
7314
6530
   When you run mysql_install_db, you might encounter the following
7315
6531
   problems:
7321
6537
mysqld ended
7322
6538
       In this case, you should examine the error log file very
7323
6539
       carefully. The log should be located in the directory XXXXXX
7324
 
       named by the error message and should indicate why mysqld
7325
 
       didn't start. If you do not understand what happened, include
7326
 
       the log when you post a bug report. See Section 1.6, "How to
 
6540
       named by the error message and should indicate why mysqld did
 
6541
       not start. If you do not understand what happened, include the
 
6542
       log when you post a bug report. See Section 1.7, "How to
7327
6543
       Report Bugs or Problems."
7328
6544
 
7329
6545
     * There is a mysqld process running
7346
6562
Address already in use
7347
6563
Can't start server: Bind on unix socket...
7348
6564
       For instructions on setting up multiple servers, see Section
7349
 
       5.6, "Running Multiple MySQL Servers on the Same Machine."
 
6565
       5.6, "Running Multiple MySQL Instances on One Machine."
7350
6566
 
7351
6567
     * You do not have write access to the /tmp directory
7352
6568
       If you do not have write access to create temporary files or a
7353
 
       Unix socket file in the default location (the /tmp directory),
7354
 
       an error occurs when you run mysql_install_db or the mysqld
 
6569
       Unix socket file in the default location (the /tmp directory)
 
6570
       or the TMP_DIR environment variable, if it has been set, an
 
6571
       error occurs when you run mysql_install_db or the mysqld
7355
6572
       server.
7356
6573
       You can specify different locations for the temporary
7357
6574
       directory and Unix socket file by executing these commands
7363
6580
shell> export TMPDIR MYSQL_UNIX_PORT
7364
6581
       Then you should be able to run mysql_install_db and start the
7365
6582
       server with these commands:
7366
 
shell> bin/mysql_install_db --user=mysql
 
6583
shell> scripts/mysql_install_db --user=mysql
7367
6584
shell> bin/mysqld_safe --user=mysql &
7368
 
       If mysql_install_db is located in the scripts directory,
7369
 
       modify the first command to scripts/mysql_install_db.
7370
 
       See Section B.5.4.5, "How to Protect or Change the MySQL Unix
 
6585
       If mysql_install_db is located in the bin directory, modify
 
6586
       the first command to bin/mysql_install_db.
 
6587
       See Section C.5.4.5, "How to Protect or Change the MySQL Unix
7371
6588
       Socket File," and Section 2.14, "Environment Variables."
7372
6589
 
7373
6590
   There are some alternatives to running the mysql_install_db script
7385
6602
       privileges, you can put the GRANT and REVOKE statements in a
7386
6603
       file and execute the file as a script using mysql after
7387
6604
       running mysql_install_db. For example:
7388
 
shell> bin/mysql_install_db --user=mysql
 
6605
shell> scripts/mysql_install_db --user=mysql
7389
6606
shell> bin/mysql -u root < your_script_file
7390
6607
       By doing this, you can avoid having to issue the statements
7391
6608
       manually on each machine.
7392
6609
 
7393
6610
     * It is possible to re-create the grant tables completely after
7394
6611
       they have previously been created. You might want to do this
7395
 
       if you're just learning how to use GRANT and REVOKE and have
 
6612
       if you are just learning how to use GRANT and REVOKE and have
7396
6613
       made so many modifications after running mysql_install_db that
7397
6614
       you want to wipe out the tables and start over.
7398
6615
       To re-create the grant tables, remove all the .frm, .MYI, and
7411
6628
       populate the grant tables manually, you also have to create
7412
6629
       them first.
7413
6630
 
7414
 
2.13.1.2. Starting and Stopping MySQL Automatically
 
6631
2.12.1.2. Starting and Stopping MySQL Automatically
7415
6632
 
7416
6633
   Generally, you start the mysqld server in one of these ways:
7417
6634
 
7420
6637
     * Run the MySQL server as a Windows service. The service can be
7421
6638
       set to start the server automatically when Windows starts, or
7422
6639
       as a manual service that you start on request. For
7423
 
       instructions, see Section 2.5.5.6, "Starting MySQL as a
7424
 
       Windows Service."
 
6640
       instructions, see Section 2.3.5.7, "Starting MySQL Server as a
 
6641
       Microsoft Windows Service."
7425
6642
 
7426
6643
     * Invoke mysqld_safe, which tries to determine the proper
7427
6644
       options for mysqld and then runs it with those options. This
7430
6647
 
7431
6648
     * Invoke mysql.server. This script is used primarily at system
7432
6649
       startup and shutdown on systems that use System V-style run
7433
 
       directories, where it usually is installed under the name
 
6650
       directories (that is, /etc/init.d and run-level specific
 
6651
       directories), where it usually is installed under the name
7434
6652
       mysql. The mysql.server script starts the server by invoking
7435
6653
       mysqld_safe. See Section 4.3.3, "mysql.server --- MySQL Server
7436
6654
       Startup Script."
7438
6656
     * On Mac OS X, install a separate MySQL Startup Item package to
7439
6657
       enable the automatic startup of MySQL on system startup. The
7440
6658
       Startup Item starts the server by invoking mysql.server. See
7441
 
       Section 2.7, "Installing MySQL on Mac OS X," for details.
7442
 
 
7443
 
   The mysqld_safe and mysql.server scripts and the Mac OS X Startup
7444
 
   Item can be used to start the server manually, or automatically at
7445
 
   system startup time. mysql.server and the Startup Item also can be
7446
 
   used to stop the server.
 
6659
       Section 2.4.3, "Installing the MySQL Startup Item," for
 
6660
       details. A MySQL Preference Pane also provides control for
 
6661
       starting and stopping MySQL through the System Preferences,
 
6662
       see Section 2.4.4, "Installing and Using the MySQL Preference
 
6663
       Pane."
 
6664
 
 
6665
     * Use the Solaris/OpenSolaris service management framework (SMF)
 
6666
       system to initiate and control MySQL startup. For more
 
6667
       information, see Section 2.6.2, "Installing MySQL on
 
6668
       OpenSolaris using IPS."
 
6669
 
 
6670
   The mysqld_safe and mysql.server scripts, Windows server,
 
6671
   Solaris/OpenSolaris SMF, and the Mac OS X Startup Item (or MySQL
 
6672
   Preference Pane) can be used to start the server manually, or
 
6673
   automatically at system startup time. mysql.server and the Startup
 
6674
   Item also can be used to stop the server.
7447
6675
 
7448
6676
   To start or stop the server manually using the mysql.server
7449
6677
   script, invoke it with start or stop arguments:
7471
6699
   /etc/rc* files.
7472
6700
 
7473
6701
   If you use the Linux server RPM package
7474
 
   (MySQL-server-VERSION.rpm), the mysql.server script is installed
7475
 
   in the /etc/init.d directory with the name mysql. You need not
7476
 
   install it manually. See Section 2.6.1, "Installing MySQL from RPM
7477
 
   Packages on Linux," for more information on the Linux RPM
7478
 
   packages.
 
6702
   (MySQL-server-VERSION.rpm), or a native Linux package
 
6703
   installation, the mysql.server script may be installed in the
 
6704
   /etc/init.d directory with the name mysql. See Section 2.5.1,
 
6705
   "Installing MySQL from RPM Packages on Linux," for more
 
6706
   information on the Linux RPM packages.
7479
6707
 
7480
6708
   Some vendors provide RPM packages that install a startup script
7481
6709
   under a different name such as mysqld.
7493
6721
shell> cp mysql.server /etc/init.d/mysql
7494
6722
shell> chmod +x /etc/init.d/mysql
7495
6723
 
 
6724
   Note
 
6725
 
7496
6726
   Older Red Hat systems use the /etc/rc.d/init.d directory rather
7497
6727
   than /etc/init.d. Adjust the preceding commands accordingly.
7498
6728
   Alternatively, first create /etc/init.d as a symbolic link that
7545
6775
 
7546
6776
   The following table shows which option groups the server and each
7547
6777
   startup script read from option files.
7548
 
   Script       Option Groups
 
6778
 
 
6779
   Table 2.20. MySQL Startup scripts and supported server option
 
6780
   groups
 
6781
      Script                  Option Groups
7549
6782
   mysqld       [mysqld], [server], [mysqld-major_version]
7550
6783
   mysqld_safe  [mysqld], [server], [mysqld_safe]
7551
6784
   mysql.server [mysqld], [mysql.server], [server]
7562
6795
   [mysql.server] and [mysqld_safe] groups instead when using MySQL
7563
6796
   5.1.
7564
6797
 
7565
 
   See Section 4.2.3.3, "Using Option Files."
 
6798
   For more information on MySQL configuration files and their
 
6799
   structure and contents, see Section 4.2.3.3, "Using Option Files."
7566
6800
 
7567
 
2.13.1.3. Starting and Troubleshooting the MySQL Server
 
6801
2.12.1.3. Starting and Troubleshooting the MySQL Server
7568
6802
 
7569
6803
   This section provides troubleshooting suggestions for problems
7570
6804
   starting the server on Unix. If you are using Windows, see Section
7571
 
   2.5.6, "Troubleshooting a MySQL Installation Under Windows."
 
6805
   2.3.6, "Troubleshooting a Microsoft Windows MySQL Server
 
6806
   Installation."
7572
6807
 
7573
6808
   If you have problems starting the server, here are some things to
7574
6809
   try:
7596
6831
   that you have them configured the way you want before starting the
7597
6832
   server:
7598
6833
 
7599
 
     * If you are using InnoDB tables, see Section 13.6.2, "InnoDB
7600
 
       Configuration."
7601
 
 
7602
 
     * If you are using MySQL Cluster, see Section 17.3, "MySQL
7603
 
       Cluster Configuration."
7604
 
 
7605
 
   MySQL Enterprise For expert advice on start-up options appropriate
7606
 
   to your circumstances, subscribe to The MySQL Enterprise Monitor.
7607
 
   For more information, see
7608
 
   http://www.mysql.com/products/enterprise/advisors.html.
 
6834
   If you are using InnoDB tables, see Section 13.6.2, "Configuring
 
6835
   InnoDB."
 
6836
 
 
6837
   If you are using MySQL Cluster, see Section 16.3, "MySQL Cluster
 
6838
   Configuration."
7609
6839
 
7610
6840
   Storage engines will use default option values if you specify
7611
6841
   none, but it is recommended that you review the available options
7624
6854
   the default path settings are by invoking mysqld with the
7625
6855
   --verbose and --help options.
7626
6856
 
7627
 
   If the default locations don't match the MySQL installation layout
7628
 
   on your system, you can override them by specifying options to
7629
 
   mysqld or mysqld_safe on the command line or in an option file.
 
6857
   If the default locations do not match the MySQL installation
 
6858
   layout on your system, you can override them by specifying options
 
6859
   to mysqld or mysqld_safe on the command line or in an option file.
7630
6860
 
7631
6861
   To specify the location of the data directory explicitly, use the
7632
6862
   --datadir option. However, normally you can tell mysqld the
7658
6888
 
7659
6889
   If you get Errcode 13 (which means Permission denied) when
7660
6890
   starting mysqld, this means that the privileges of the data
7661
 
   directory or its contents do not allow the server access. In this
 
6891
   directory or its contents do not permit server access. In this
7662
6892
   case, you change the permissions for the involved files and
7663
6893
   directories so that the server has the right to use them. You can
7664
6894
   also start the server as root, but this raises security issues and
7697
6927
shell> tail host_name.log
7698
6928
 
7699
6929
   The error log should contain information that indicates why the
7700
 
   server couldn't start.
 
6930
   server could not start.
7701
6931
 
7702
6932
   If either of the following errors occur, it means that some other
7703
6933
   program (perhaps another mysqld server) is using the TCP/IP port
7709
6939
   running. If so, shut down the server before starting mysqld again.
7710
6940
   (If another server is running, and you really want to run multiple
7711
6941
   servers, you can find information about how to do so in Section
7712
 
   5.6, "Running Multiple MySQL Servers on the Same Machine.")
 
6942
   5.6, "Running Multiple MySQL Instances on One Machine.")
7713
6943
 
7714
6944
   If no other server is running, try to execute the command telnet
7715
6945
   your_host_name tcp_ip_port_number. (The default MySQL port number
7716
 
   is 3306.) Then press Enter a couple of times. If you don't get an
 
6946
   is 3306.) Then press Enter a couple of times. If you do not get an
7717
6947
   error message like telnet: Unable to connect to remote host:
7718
6948
   Connection refused, some other program is using the TCP/IP port
7719
 
   that mysqld is trying to use. You'll need to track down what
 
6949
   that mysqld is trying to use. You will need to track down what
7720
6950
   program this is and disable it, or else tell mysqld to listen to a
7721
 
   different port with the --port option. In this case, you'll also
 
6951
   different port with the --port option. In this case, you will also
7722
6952
   need to specify the port number for client programs when
7723
 
   connecting to the server via TCP/IP.
 
6953
   connecting to the server using TCP/IP.
7724
6954
 
7725
6955
   Another reason the port might be inaccessible is that you have a
7726
6956
   firewall running that blocks connections to it. If so, modify the
7727
 
   firewall settings to allow access to the port.
 
6957
   firewall settings to permit access to the port.
7728
6958
 
7729
 
   If the server starts but you can't connect to it, you should make
 
6959
   If the server starts but you cannot connect to it, you should make
7730
6960
   sure that you have an entry in /etc/hosts that looks like this:
7731
6961
127.0.0.1       localhost
7732
6962
 
7733
 
   This problem occurs only on systems that do not have a working
7734
 
   thread library and for which MySQL must be configured to use
7735
 
   MIT-pthreads.
7736
 
 
7737
6963
   If you cannot get mysqld to start, you can try to make a trace
7738
6964
   file to find the problem by using the --debug option. See MySQL
7739
6965
   Internals: Porting
7740
6966
   (http://forge.mysql.com/wiki/MySQL_Internals_Porting).
7741
6967
 
7742
 
2.13.2. Securing the Initial MySQL Accounts
 
6968
2.12.2. Securing the Initial MySQL Accounts
7743
6969
 
7744
6970
   Part of the MySQL installation process is to set up the mysql
7745
6971
   database that contains the grant tables:
7746
6972
 
7747
 
     * Windows distributions contain preinitialized grant tables that
7748
 
       are installed automatically.
7749
 
 
7750
 
     * On Unix, the grant tables are populated by the
7751
 
       mysql_install_db program. Some installation methods run this
7752
 
       program for you. Others require that you execute it manually.
7753
 
       For details, see Section 2.13.1, "Unix Post-Installation
7754
 
       Procedures."
7755
 
 
7756
 
   The grant tables define the initial MySQL user accounts and their
7757
 
   access privileges. These accounts are set up as follows:
7758
 
 
7759
 
     * Accounts with the user name root are created. These are
7760
 
       superuser accounts that can do anything. The initial root
7761
 
       account passwords are empty, so anyone can connect to the
7762
 
       MySQL server as root --- without a password --- and be granted
7763
 
       all privileges.
7764
 
 
7765
 
          + On Windows, one root account is created; this account
7766
 
            allows connecting from the local host only. The Windows
7767
 
            installer will optionally create an account allowing for
7768
 
            connections from any host only if the user selects the
7769
 
            Enable root access from remote machines option during
7770
 
            installation.
7771
 
 
7772
 
          + On Unix, both root accounts are for connections from the
7773
 
            local host. Connections must be made from the local host
7774
 
            by specifying a host name of localhost for one of the
7775
 
            accounts, or the actual host name or IP number for the
7776
 
            other.
7777
 
 
7778
 
     * Two anonymous-user accounts are created, each with an empty
 
6973
     * Windows distributions contain preinitialized grant tables.
 
6974
 
 
6975
     * On Unix, the mysql_install_db program populates the grant
 
6976
       tables. Some installation methods run this program for you.
 
6977
       Others require that you execute it manually. For details, see
 
6978
       Section 2.12.1, "Unix Postinstallation Procedures."
 
6979
 
 
6980
   The mysql.user grant table defines the initial MySQL user accounts
 
6981
   and their access privileges:
 
6982
 
 
6983
     * Some accounts have the user name root. These are superuser
 
6984
       accounts that have all privileges and can do anything. The
 
6985
       initial root account passwords are empty, so anyone can
 
6986
       connect to the MySQL server as root without a password and be
 
6987
       granted all privileges.
 
6988
 
 
6989
          + On Windows, root accounts are created that permit
 
6990
            connections from the local host only. Connections can be
 
6991
            made by specifying the host name localhost or the IP
 
6992
            address 127.0.0.1. If the user selects the Enable root
 
6993
            access from remote machines option during installation,
 
6994
            the Windows installer creates another root account that
 
6995
            permits connections from any host.
 
6996
 
 
6997
          + On Unix, each root account permits connections from the
 
6998
            local host. Connections can be made by specifying the
 
6999
            host name localhost, the IP address 127.0.0.1, or the
 
7000
            actual host name or IP address.
 
7001
       An attempt to connect to the host 127.0.0.1 normally resolves
 
7002
       to the localhost account. However, this fails if the server is
 
7003
       run with the --skip-name-resolve option, so the 127.0.0.1
 
7004
       account is useful in that case.
 
7005
 
 
7006
     * Some accounts are for anonymous users. These have an empty
7779
7007
       user name. The anonymous accounts have no password, so anyone
7780
7008
       can use them to connect to the MySQL server.
7781
7009
 
7782
 
          + On Windows, one anonymous account is for connections from
7783
 
            the local host. It has no global privileges. (Before
7784
 
            MySQL 5.1.16, it has all global privileges, just like the
7785
 
            root accounts.) The other is for connections from any
7786
 
            host and has all privileges for the test database and for
7787
 
            other databases with names that start with test.
7788
 
 
7789
 
          + On Unix, both anonymous accounts are for connections from
7790
 
            the local host. Connections must be made from the local
7791
 
            host by specifying a host name of localhost for one of
7792
 
            the accounts, or the actual host name or IP number for
7793
 
            the other. These accounts have all privileges for the
7794
 
            test database and for other databases with names that
7795
 
            start with test_.
7796
 
 
7797
 
   As noted, none of the initial accounts have passwords. This means
7798
 
   that your MySQL installation is unprotected until you do something
7799
 
   about it:
 
7010
          + On Windows, there is one anonymous account that permits
 
7011
            connections from the local host. Connections can be made
 
7012
            by specifying a host name of localhost. The account has
 
7013
            no global privileges. (Before MySQL 5.1.16, it has all
 
7014
            global privileges, just like the root accounts.)
 
7015
 
 
7016
          + On Unix, each anonymous account permits connections from
 
7017
            the local host. Connections can be made by specifying a
 
7018
            host name of localhost for one of the accounts, or the
 
7019
            actual host name or IP address for the other.
 
7020
 
 
7021
   To display which accounts exist in the mysql.user table and check
 
7022
   whether their passwords are empty, use the following statement:
 
7023
mysql> SELECT User, Host, Password FROM mysql.user;
 
7024
+------+--------------------+----------+
 
7025
| User | Host               | Password |
 
7026
+------+--------------------+----------+
 
7027
| root | localhost          |          |
 
7028
| root | myhost.example.com |          |
 
7029
| root | 127.0.0.1          |          |
 
7030
|      | localhost          |          |
 
7031
|      | myhost.example.com |          |
 
7032
+------+--------------------+----------+
 
7033
 
 
7034
   This output indicates that there are several root and
 
7035
   anonymous-user accounts, none of which have passwords. The output
 
7036
   might differ on your system, but the presence of accounts with
 
7037
   empty passwords means that your MySQL installation is unprotected
 
7038
   until you do something about it:
 
7039
 
 
7040
     * You should assign a password to each MySQL root account.
7800
7041
 
7801
7042
     * If you want to prevent clients from connecting as anonymous
7802
7043
       users without a password, you should either assign a password
7803
7044
       to each anonymous account or else remove the accounts.
7804
7045
 
7805
 
     * You should assign a password to each MySQL root account.
 
7046
   In addition, the mysql.db table contains rows that permit all
 
7047
   accounts to access the test database and other databases with
 
7048
   names that start with test_. This is true even for accounts that
 
7049
   otherwise have no special privileges such as the default anonymous
 
7050
   accounts. This is convenient for testing but inadvisable on
 
7051
   production servers. Administrators who want database access
 
7052
   restricted only to accounts that have permissions granted
 
7053
   explicitly for that purpose should remove these mysql.db table
 
7054
   rows.
7806
7055
 
7807
7056
   The following instructions describe how to set up passwords for
7808
 
   the initial MySQL accounts, first for the anonymous accounts and
7809
 
   then for the root accounts. Replace "newpwd" in the examples with
7810
 
   the actual password that you want to use. The instructions also
7811
 
   cover how to remove the anonymous accounts, should you prefer not
7812
 
   to allow anonymous access at all.
7813
 
 
7814
 
   You might want to defer setting the passwords until later, so that
7815
 
   you don't need to specify them while you perform additional setup
 
7057
   the initial MySQL accounts, first for the root accounts, then for
 
7058
   the anonymous accounts. The instructions also cover how to remove
 
7059
   the anonymous accounts, should you prefer not to permit anonymous
 
7060
   access at all, and describe how to remove permissive access to
 
7061
   test databases. Replace newpwd in the examples with the password
 
7062
   that you want to use. Replace host_name with the name of the
 
7063
   server host. You can determine this name from the output of the
 
7064
   preceding SELECT statement. For the output shown, host_name is
 
7065
   myhost.example.com.
 
7066
   Note
 
7067
 
 
7068
   For additional information about setting passwords, see Section
 
7069
   5.5.5, "Assigning Account Passwords." If you forget your root
 
7070
   password after setting it, see Section C.5.4.1, "How to Reset the
 
7071
   Root Password."
 
7072
 
 
7073
   You might want to defer setting the passwords until later, to
 
7074
   avoid the need to specify them while you perform additional setup
7816
7075
   or testing. However, be sure to set them before using your
7817
7076
   installation for production purposes.
7818
7077
 
7819
 
   Anonymous Account Password Assignment
7820
 
 
7821
 
   To assign passwords to the anonymous accounts, connect to the
7822
 
   server as root and then use either SET PASSWORD or UPDATE. In
7823
 
   either case, be sure to encrypt the password using the PASSWORD()
7824
 
   function.
7825
 
 
7826
 
   To use SET PASSWORD on Windows, do this:
7827
 
shell> mysql -u root
7828
 
mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
7829
 
mysql> SET PASSWORD FOR ''@'%' = PASSWORD('newpwd');
7830
 
 
7831
 
   To use SET PASSWORD on Unix, do this:
7832
 
shell> mysql -u root
7833
 
mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
7834
 
mysql> SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd');
7835
 
 
7836
 
   In the second SET PASSWORD statement, replace host_name with the
7837
 
   name of the server host. This is the name that is specified in the
7838
 
   Host column of the non-localhost record for root in the user
7839
 
   table. If you don't know what host name this is, issue the
7840
 
   following statement before using SET PASSWORD:
7841
 
mysql> SELECT Host, User FROM mysql.user;
7842
 
 
7843
 
   Look for the record that has root in the User column and something
7844
 
   other than localhost in the Host column. Then use that Host value
7845
 
   in the second SET PASSWORD statement.
7846
 
 
7847
 
   Anonymous Account Removal
7848
 
 
7849
 
   If you prefer to remove the anonymous accounts instead, do so as
7850
 
   follows:
7851
 
shell> mysql -u root
7852
 
mysql> DROP USER '';
7853
 
 
7854
 
   The DROP statement applies both to Windows and to Unix. On
7855
 
   Windows, if you want to remove only the anonymous account that has
7856
 
   the same privileges as root, do this instead:
7857
 
shell> mysql -u root
7858
 
mysql> DROP USER ''@'localhost';
7859
 
 
7860
 
   That account allows anonymous access but has full privileges, so
7861
 
   removing it improves security.
7862
 
 
7863
 
   root Account Password Assignment
7864
 
 
7865
 
   You can assign passwords to the root accounts in several ways. The
7866
 
   following discussion demonstrates three methods:
 
7078
   To set up additional accounts, see Section 5.5.2, "Adding User
 
7079
   Accounts."
 
7080
 
 
7081
Assigning root Account Passwords
 
7082
 
 
7083
   The root account passwords can be set several ways. The following
 
7084
   discussion demonstrates three methods:
7867
7085
 
7868
7086
     * Use the SET PASSWORD statement
7869
7087
 
 
7088
     * Use the UPDATE statement
 
7089
 
7870
7090
     * Use the mysqladmin command-line client program
7871
7091
 
7872
 
     * Use the UPDATE statement
7873
 
 
7874
7092
   To assign passwords using SET PASSWORD, connect to the server as
7875
 
   root and issue SET PASSWORD statements. Be sure to encrypt the
7876
 
   password using the PASSWORD() function.
 
7093
   root and issue a SET PASSWORD statement for each root account
 
7094
   listed in the mysql.user table. Be sure to encrypt the password
 
7095
   using the PASSWORD() function.
7877
7096
 
7878
7097
   For Windows, do this:
7879
7098
shell> mysql -u root
7880
7099
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
 
7100
mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd');
7881
7101
mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd');
7882
7102
 
 
7103
   The last statement is unnecessary if the mysql.user table has no
 
7104
   root account with a host value of %.
 
7105
 
7883
7106
   For Unix, do this:
7884
7107
shell> mysql -u root
7885
7108
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
 
7109
mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd');
7886
7110
mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');
7887
7111
 
7888
 
   In the second SET PASSWORD statement, replace host_name with the
7889
 
   name of the server host. This is the same host name that you used
7890
 
   when you assigned the anonymous account passwords.
 
7112
   You can also use a single statement that assigns a password to all
 
7113
   root accounts by using UPDATE to modify the mysql.user table
 
7114
   directly. This method works on any platform:
 
7115
shell> mysql -u root
 
7116
mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
 
7117
    ->     WHERE User = 'root';
 
7118
mysql> FLUSH PRIVILEGES;
7891
7119
 
7892
 
   If the user table contains an account with User and Host values of
7893
 
   'root' and '127.0.0.1', use an additional SET PASSWORD statement
7894
 
   to set that account's password:
7895
 
mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd');
 
7120
   The FLUSH statement causes the server to reread the grant tables.
 
7121
   Without it, the password change remains unnoticed by the server
 
7122
   until you restart it.
7896
7123
 
7897
7124
   To assign passwords to the root accounts using mysqladmin, execute
7898
7125
   the following commands:
7899
7126
shell> mysqladmin -u root password "newpwd"
7900
7127
shell> mysqladmin -u root -h host_name password "newpwd"
7901
7128
 
7902
 
   These commands apply both to Windows and to Unix. In the second
7903
 
   command, replace host_name with the name of the server host. The
7904
 
   double quotes around the password are not always necessary, but
 
7129
   Those commands apply both to Windows and to Unix. The double
 
7130
   quotation marks around the password are not always necessary, but
7905
7131
   you should use them if the password contains spaces or other
7906
7132
   characters that are special to your command interpreter.
7907
7133
 
7908
7134
   The mysqladmin method of setting the root account passwords does
7909
 
   not set the password for the 'root'@'127.0.0.1' account. To do so,
7910
 
   use SET PASSWORD as shown earlier.
7911
 
 
7912
 
   You can also use UPDATE to modify the user table directly. The
7913
 
   following UPDATE statement assigns a password to all root
7914
 
   accounts:
7915
 
shell> mysql -u root
7916
 
mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
7917
 
    ->     WHERE User = 'root';
7918
 
mysql> FLUSH PRIVILEGES;
7919
 
 
7920
 
   The UPDATE statement applies both to Windows and to Unix.
7921
 
 
7922
 
   After the passwords have been set, you must supply the appropriate
7923
 
   password whenever you connect to the server. For example, if you
7924
 
   want to use mysqladmin to shut down the server, you can do so
7925
 
   using this command:
 
7135
   not work for the 'root'@'127.0.0.1' account. Use the SET PASSWORD
 
7136
   method shown earlier.
 
7137
 
 
7138
   After the root passwords have been set, you must supply the
 
7139
   appropriate password whenever you connect as root to the server.
 
7140
   For example, to shut down the server with mysqladmin, use this
 
7141
   command:
7926
7142
shell> mysqladmin -u root -p shutdown
7927
7143
Enter password: (enter root password here)
7928
7144
 
7929
 
Note
7930
 
 
7931
 
   If you forget your root password after setting it up, Section
7932
 
   B.5.4.1, "How to Reset the Root Password," covers the procedure
7933
 
   for resetting it.
7934
 
 
7935
 
   To set up additional accounts, you can use the GRANT statement.
7936
 
   For instructions, see Section 5.5.2, "Adding User Accounts."
 
7145
Assigning Anonymous Account Passwords
 
7146
 
 
7147
   The mysql commands in the following instructions include a -p
 
7148
   option based on the assumption that you have set the root account
 
7149
   passwords using the preceding instructions and must specify that
 
7150
   password when connecting to the server.
 
7151
 
 
7152
   To assign passwords to the anonymous accounts, connect to the
 
7153
   server as root, then use either SET PASSWORD or UPDATE. Be sure to
 
7154
   encrypt the password using the PASSWORD() function.
 
7155
 
 
7156
   To use SET PASSWORD on Windows, do this:
 
7157
shell> mysql -u root -p
 
7158
Enter password: (enter root password here)
 
7159
mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
 
7160
 
 
7161
   To use SET PASSWORD on Unix, do this:
 
7162
shell> mysql -u root -p
 
7163
Enter password: (enter root password here)
 
7164
mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
 
7165
mysql> SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd');
 
7166
 
 
7167
   To set the anonymous-user account passwords with a single UPDATE
 
7168
   statement, do this (on any platform):
 
7169
shell> mysql -u root -p
 
7170
Enter password: (enter root password here)
 
7171
mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
 
7172
    ->     WHERE User = '';
 
7173
mysql> FLUSH PRIVILEGES;
 
7174
 
 
7175
   The FLUSH statement causes the server to reread the grant tables.
 
7176
   Without it, the password change remains unnoticed by the server
 
7177
   until you restart it.
 
7178
 
 
7179
Removing Anonymous Accounts
 
7180
 
 
7181
   If you prefer to remove any anonymous accounts rather than
 
7182
   assigning them passwords, do so as follows on Windows:
 
7183
shell> mysql -u root -p
 
7184
Enter password: (enter root password here)
 
7185
mysql> DROP USER ''@'localhost';
 
7186
 
 
7187
   On Unix, remove the anonymous accounts like this:
 
7188
shell> mysql -u root -p
 
7189
Enter password: (enter root password here)
 
7190
mysql> DROP USER ''@'localhost';
 
7191
mysql> DROP USER ''@'host_name';
 
7192
 
 
7193
Securing Test Databases
 
7194
 
 
7195
   By default, the mysql.db table contains rows that permit access by
 
7196
   any user to the test database and other databases with names that
 
7197
   start with test_. (These rows have an empty User column value,
 
7198
   which for access-checking purposes matches any user name.) This
 
7199
   means that such databases can be used even by accounts that
 
7200
   otherwise possess no privileges. If you want to remove any-user
 
7201
   access to test databases, do so as follows:
 
7202
shell> mysql -u root -p
 
7203
Enter password: (enter root password here)
 
7204
mysql> DELETE FROM mysql.db WHERE Db LIKE 'test%';
 
7205
mysql> FLUSH PRIVILEGES;
 
7206
 
 
7207
   The FLUSH statement causes the server to reread the grant tables.
 
7208
   Without it, the privilege change remains unnoticed by the server
 
7209
   until you restart it.
 
7210
 
 
7211
   With the preceding change, only users who have global database
 
7212
   privileges or privileges granted explicitly for the test database
 
7213
   can use it. However, if you do not want the database to exist at
 
7214
   all, drop it:
 
7215
mysql> DROP DATABASE test;
 
7216
 
 
7217
   Note
 
7218
 
 
7219
   On Windows, you can also perform the process described in this
 
7220
   section using the Configuration Wizard (see Section 2.3.4.11,
 
7221
   "MySQL Server Instance Config Wizard: The Security Options
 
7222
   Dialog"). On other platforms, the MySQL distribution includes
 
7223
   mysql_secure_installation, a command-line utility that automates
 
7224
   much of the process of securing a MySQL installation.
 
7225
 
 
7226
2.13. Upgrading or Downgrading MySQL
 
7227
 
 
7228
2.13.1. Upgrading MySQL
 
7229
 
 
7230
   As a general rule, to upgrade from one release series to another,
 
7231
   you should go to the next series rather than skipping a series. To
 
7232
   upgrade from a release series previous to MySQL 5.0, upgrade to
 
7233
   each successive release series in turn until you have reached
 
7234
   MySQL 5.0, and then proceed with the upgrade to MySQL 5.1. For
 
7235
   example, if you currently are running MySQL 4.1 and wish to
 
7236
   upgrade to a newer series, upgrade to MySQL 5.0 first before
 
7237
   upgrading to 5.1, and so forth. For information on upgrading to
 
7238
   MySQL 5.0, see the MySQL 5.0 Reference Manual; for earlier
 
7239
   releases, see the MySQL 3.23, 4.0, 4.1 Reference Manual.
 
7240
 
 
7241
   If you perform a binary (in-place) upgrade without dumping and
 
7242
   reloading tables, you cannot upgrade directly from MySQL 4.1 to
 
7243
   5.1. This occurs due to an incompatible change in the MyISAM table
 
7244
   index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
 
7245
   repair all MyISAM tables (see Section 2.13.4, "Rebuilding or
 
7246
   Repairing Tables or Indexes"). Then upgrade from MySQL 5.0 to 5.1
 
7247
   and check and repair your tables.
 
7248
 
 
7249
   To upgrade from MySQL 5.0 to 5.1, use the items in the following
 
7250
   checklist as a guide:
 
7251
 
 
7252
     * Before any upgrade, back up your databases, including the
 
7253
       mysql database that contains the grant tables. See Section
 
7254
       6.2, "Database Backup Methods."
 
7255
 
 
7256
     * Read all the notes in Section 2.13.1.1, "Upgrading from MySQL
 
7257
       5.0 to 5.1." These notes enable you to identify upgrade issues
 
7258
       that apply to your current MySQL installation. Some
 
7259
       incompatibilities discussed in that section require your
 
7260
       attention before upgrading. Others should be dealt with after
 
7261
       upgrading.
 
7262
 
 
7263
     * Read Appendix D, "MySQL Change History" as well, which
 
7264
       provides information about features that are new in MySQL 5.1
 
7265
       or differ from those found in MySQL 5.0.
 
7266
 
 
7267
     * After upgrading to a new version of MySQL, run mysql_upgrade
 
7268
       (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
 
7269
       Upgrade"). This program checks your tables, and attempts to
 
7270
       repair them if necessary. It also updates your grant tables to
 
7271
       make sure that they have the current structure so that you can
 
7272
       take advantage of any new capabilities. (Some releases of
 
7273
       MySQL introduce changes to the structure of the grant tables
 
7274
       to add new privileges or features.)
 
7275
       mysql_upgrade does not upgrade the contents of the help
 
7276
       tables. For upgrade instructions, see Section 5.1.8,
 
7277
       "Server-Side Help."
 
7278
 
 
7279
     * If you run MySQL Server on Windows, see Section 2.3.7,
 
7280
       "Upgrading MySQL Server on Microsoft Windows."
 
7281
 
 
7282
     * If you use replication, see Section 15.4.3, "Upgrading a
 
7283
       Replication Setup," for information on upgrading your
 
7284
       replication setup.
 
7285
 
 
7286
     * If you upgrade an installation originally produced by
 
7287
       installing multiple RPM packages, it is best to upgrade all
 
7288
       the packages, not just some. For example, if you previously
 
7289
       installed the server and client RPMs, do not upgrade just the
 
7290
       server RPM.
 
7291
 
 
7292
     * As of MySQL 5.1.9, the mysqld-max server is included in binary
 
7293
       distributions. There is no separate MySQL-Max distribution. As
 
7294
       of MySQL 5.1.12, there is no mysqld-max server at all in
 
7295
       binary distributions. They contain a server that includes the
 
7296
       features previously included in mysqld-max.
 
7297
 
 
7298
     * If you have created a user-defined function (UDF) with a given
 
7299
       name and upgrade MySQL to a version that implements a new
 
7300
       built-in function with the same name, the UDF becomes
 
7301
       inaccessible. To correct this, use DROP FUNCTION to drop the
 
7302
       UDF, and then use CREATE FUNCTION to re-create the UDF with a
 
7303
       different nonconflicting name. The same is true if the new
 
7304
       version of MySQL implements a built-in function with the same
 
7305
       name as an existing stored function. See Section 8.2.4,
 
7306
       "Function Name Parsing and Resolution," for the rules
 
7307
       describing how the server interprets references to different
 
7308
       kinds of functions.
 
7309
 
 
7310
   You can always move the MySQL format files and data files between
 
7311
   different versions on systems with the same architecture as long
 
7312
   as you stay within versions for the same release series of MySQL.
 
7313
 
 
7314
   If you are cautious about using new versions, you can always
 
7315
   rename your old mysqld before installing a newer one. For example,
 
7316
   if you are using MySQL 5.0.13 and want to upgrade to 5.1.10,
 
7317
   rename your current server from mysqld to mysqld-5.0.13. If your
 
7318
   new mysqld then does something unexpected, you can simply shut it
 
7319
   down and restart with your old mysqld.
 
7320
 
 
7321
   If, after an upgrade, you experience problems with compiled client
 
7322
   programs, such as Commands out of sync or unexpected core dumps,
 
7323
   you probably have used old header or library files when compiling
 
7324
   your programs. In this case, you should check the date for your
 
7325
   mysql.h file and libmysqlclient.a library to verify that they are
 
7326
   from the new MySQL distribution. If not, recompile your programs
 
7327
   with the new headers and libraries. Recompilation might also be
 
7328
   necessary for programs compiled against the shared client library
 
7329
   if the library major version number has changed (for example from
 
7330
   libmysqlclient.so.15 to libmysqlclient.so.16.
 
7331
 
 
7332
   If problems occur, such as that the new mysqld server does not
 
7333
   start or that you cannot connect without a password, verify that
 
7334
   you do not have an old my.cnf file from your previous
 
7335
   installation. You can check this with the --print-defaults option
 
7336
   (for example, mysqld --print-defaults). If this command displays
 
7337
   anything other than the program name, you have an active my.cnf
 
7338
   file that affects server or client operation.
 
7339
 
 
7340
   If your MySQL installation contains a large amount of data that
 
7341
   might take a long time to convert after an in-place upgrade, you
 
7342
   might find it useful to create a "dummy" database instance for
 
7343
   assessing what conversions might be needed and the work involved
 
7344
   to perform them. Make a copy of your MySQL instance that contains
 
7345
   a full copy of the mysql database, plus all other databases
 
7346
   without data. Run your upgrade procedure on this dummy instance to
 
7347
   see what actions might be needed so that you can better evaluate
 
7348
   the work involved when performing actual data conversion on your
 
7349
   original database instance.
 
7350
 
 
7351
   It is a good idea to rebuild and reinstall the Perl DBD::mysql
 
7352
   module whenever you install a new release of MySQL. The same
 
7353
   applies to other MySQL interfaces as well, such as PHP mysql
 
7354
   extensions and the Python MySQLdb module.
 
7355
 
 
7356
2.13.1.1. Upgrading from MySQL 5.0 to 5.1
 
7357
 
 
7358
   After upgrading a 5.0 installation to 5.0.10 or above, it is
 
7359
   necessary to upgrade your grant tables. Otherwise, creating stored
 
7360
   procedures and functions might not work. To perform this upgrade,
 
7361
   run mysql_upgrade.
 
7362
   Note
 
7363
 
 
7364
   It is good practice to back up your data before installing any new
 
7365
   version of software. Although MySQL works very hard to ensure a
 
7366
   high level of quality, you should protect your data by making a
 
7367
   backup.
 
7368
 
 
7369
   To upgrade to 5.1 from any previous version, MySQL recommends that
 
7370
   you dump your tables with mysqldump before upgrading and reload
 
7371
   the dump file after upgrading.
 
7372
 
 
7373
   If you perform a binary (in-place) upgrade without dumping and
 
7374
   reloading tables, you cannot upgrade directly from MySQL 4.1 to
 
7375
   5.1. This occurs due to an incompatible change in the MyISAM table
 
7376
   index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
 
7377
   repair all MyISAM tables (see Section 2.13.4, "Rebuilding or
 
7378
   Repairing Tables or Indexes"). Then upgrade from MySQL 5.0 to 5.1
 
7379
   and check and repair your tables.
 
7380
 
 
7381
   In general, you should do the following when upgrading from MySQL
 
7382
   5.0 to 5.1:
 
7383
 
 
7384
     * Read all the items in the following sections to see whether
 
7385
       any of them might affect your applications:
 
7386
 
 
7387
          + Section 2.13.1, "Upgrading MySQL," has general update
 
7388
            information.
 
7389
 
 
7390
          + The items in the change lists found later in this section
 
7391
            enable you to identify upgrade issues that apply to your
 
7392
            current MySQL installation.
 
7393
 
 
7394
          + The MySQL 5.1 change history describes significant new
 
7395
            features you can use in 5.1 or that differ from those
 
7396
            found in MySQL 5.0. Some of these changes may result in
 
7397
            incompatibilities. See Section D.1, "Changes in Release
 
7398
            5.1.x (Production)."
 
7399
       Note particularly any changes that are marked Known issue or
 
7400
       Incompatible change. These incompatibilities with earlier
 
7401
       versions of MySQL may require your attention before you
 
7402
       upgrade. Our aim is to avoid these changes, but occasionally
 
7403
       they are necessary to correct problems that would be worse
 
7404
       than an incompatibility between releases. If any upgrade issue
 
7405
       applicable to your installation involves an incompatibility
 
7406
       that requires special handling, follow the instructions given
 
7407
       in the incompatibility description. Often this will involve
 
7408
       dumping and reloading tables, or use of a statement such as
 
7409
       CHECK TABLE or REPAIR TABLE.
 
7410
       For dump and reload instructions, see Section 2.13.4,
 
7411
       "Rebuilding or Repairing Tables or Indexes." Any procedure
 
7412
       that involves REPAIR TABLE with the USE_FRM option must be
 
7413
       done before upgrading. Use of this statement with a version of
 
7414
       MySQL different from the one used to create the table (that
 
7415
       is, using it after upgrading) may damage the table. See
 
7416
       Section 12.7.2.6, "REPAIR TABLE Syntax."
 
7417
 
 
7418
     * Before upgrading to a new version of MySQL, Section 2.13.3,
 
7419
       "Checking Whether Tables or Indexes Must Be Rebuilt," to see
 
7420
       whether changes to table formats or to character sets or
 
7421
       collations were made between your current version of MySQL and
 
7422
       the version to which you are upgrading. If so and these
 
7423
       changes result in an incompatibility between MySQL versions,
 
7424
       you will need to upgrade the affected tables using the
 
7425
       instructions in Section 2.13.4, "Rebuilding or Repairing
 
7426
       Tables or Indexes."
 
7427
 
 
7428
     * After upgrading to a new version of MySQL, run mysql_upgrade
 
7429
       (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
 
7430
       Upgrade"). This program checks your tables, and attempts to
 
7431
       repair them if necessary. It also updates your grant tables to
 
7432
       make sure that they have the current structure so that you can
 
7433
       take advantage of any new capabilities. (Some releases of
 
7434
       MySQL introduce changes to the structure of the grant tables
 
7435
       to add new privileges or features.)
 
7436
       mysql_upgrade does not upgrade the contents of the help
 
7437
       tables. For upgrade instructions, see Section 5.1.8,
 
7438
       "Server-Side Help."
 
7439
 
 
7440
     * If you run MySQL Server on Windows, see Section 2.3.7,
 
7441
       "Upgrading MySQL Server on Microsoft Windows."
 
7442
 
 
7443
     * If you use replication, see Section 15.4.3, "Upgrading a
 
7444
       Replication Setup," for information on upgrading your
 
7445
       replication setup.
 
7446
 
 
7447
   If your MySQL installation contains a large amount of data that
 
7448
   might take a long time to convert after an in-place upgrade, you
 
7449
   might find it useful to create a "dummy" database instance for
 
7450
   assessing what conversions might be needed and the work involved
 
7451
   to perform them. Make a copy of your MySQL instance that contains
 
7452
   a full copy of the mysql database, plus all other databases
 
7453
   without data. Run your upgrade procedure on this dummy instance to
 
7454
   see what actions might be needed so that you can better evaluate
 
7455
   the work involved when performing actual data conversion on your
 
7456
   original database instance.
 
7457
 
 
7458
   The following lists describe changes that may affect applications
 
7459
   and that you should watch out for when upgrading from MySQL 5.0 to
 
7460
   5.1.
 
7461
 
 
7462
Configuration Changes
 
7463
 
 
7464
 
 
7465
     * Before MySQL 5.1.11, to build MySQL from source with SSL
 
7466
       support enabled, you would invoke configure with either the
 
7467
       --with-openssl or --with-yassl option. In MySQL 5.1.11, those
 
7468
       options both have been replaced by the --with-ssl option. By
 
7469
       default, --with-ssl causes the bundled yaSSL library to be
 
7470
       used. To select OpenSSL instead, give the option as
 
7471
       --with-ssl=path, where path is the directory where the OpenSSL
 
7472
       header files and libraries are located.
 
7473
 
 
7474
Server Changes
 
7475
 
 
7476
 
 
7477
     * Known issue: mysql_upgrade attempts to to upgrade tables that
 
7478
       are incompatible with the current version of MySQL. (It
 
7479
       invokes mysqlcheck to check tables and, if necessary, repair
 
7480
       them.) However this can fail for storage engines that do not
 
7481
       support REPAIR TABLE, such as InnoDB, and leave tables in a
 
7482
       nonupgradable state.
 
7483
       To work around this problem, use ALTER TABLE tbl_name
 
7484
       ENGINE=InnoDB to perform a "null" alter operation that
 
7485
       rebuilds the table.
 
7486
 
 
7487
     * Known issue: After a binary upgrade to MySQL 5.1 from a MySQL
 
7488
       5.0 installation that contains ARCHIVE tables:
 
7489
 
 
7490
          + Before MySQL 5.1.42, accessing those tables will cause
 
7491
            the server to crash, even if you have run mysql_upgrade
 
7492
            or CHECK TABLE ... FOR UPGRADE.
 
7493
 
 
7494
          + As of MySQL 5.1.42, the server will not open 5.0 ARCHIVE
 
7495
            tables at all.
 
7496
       In either case, the solution is to use mysqldump to dump all
 
7497
       5.0 ARCHIVE tables before upgrading, and reload them into
 
7498
       MySQL 5.1 after upgrading. This problem is fixed in MySQL
 
7499
       5.6.4: The server can open ARCHIVE tables created in MySQL
 
7500
       5.0. However, it remains the recommended upgrade procedure to
 
7501
       dump 5.0 ARCHIVE tables before upgrading and reload them after
 
7502
       upgrading.
 
7503
 
 
7504
     * Known issue: The fix for Bug #23491 introduced a problem with
 
7505
       SHOW CREATE VIEW, which is used by mysqldump. This causes an
 
7506
       incompatibility when upgrading from versions affected by that
 
7507
       bug fix (MySQL 5.0.40 through 5.0.43, MySQL 5.1.18 through
 
7508
       5.1.19): If you use mysqldump before upgrading from an
 
7509
       affected version and reload the data after upgrading to a
 
7510
       higher version, you must drop and recreate your views.
 
7511
 
 
7512
     * Known issue: Dumps performed by using mysqldump to generate a
 
7513
       dump file before the upgrade and reloading the file after
 
7514
       upgrading are subject to the following problem:
 
7515
       Before MySQL 5.0.40, mysqldump displays SPATIAL index
 
7516
       definitions using prefix lengths for the indexed columns.
 
7517
       These prefix lengths are accepted in MySQL 5.0, but not as of
 
7518
       MySQL 5.1. If you use mysqldump from versions of MySQL older
 
7519
       than 5.0.40, any table containing SPATIAL indexes will cause
 
7520
       an error when the dump file is reloaded into MySQL 5.1 or
 
7521
       higher.
 
7522
       For example, a table definition might look like this when
 
7523
       dumped in MySQL 5.0:
 
7524
CREATE TABLE `t` (
 
7525
 `g` geometry NOT NULL,
 
7526
 SPATIAL KEY `g` (`g`(32))
 
7527
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
7528
       The SPATIAL index definition will not be accepted in MySQL
 
7529
       5.1. To work around this, edit the dump file to remove the
 
7530
       prefix:
 
7531
CREATE TABLE `t` (
 
7532
 `g` geometry NOT NULL,
 
7533
 SPATIAL KEY `g` (`g`)
 
7534
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
7535
       Dump files can be large, so it may be preferable to dump table
 
7536
       definitions and data separately to make it easier to edit the
 
7537
       definitions:
 
7538
shell> mysqldump --no-data other_args > definitions.sql
 
7539
shell> mysqldump --no-create-info other_args > data.sql
 
7540
       Then edit definitions.sql before reloading definitions.sql and
 
7541
       data.sql, in that order.
 
7542
       If you upgrade to a version of MySQL 5.0 higher than 5.0.40
 
7543
       before upgrading to MySQL 5.1, this problem does not occur.
 
7544
 
 
7545
     * Known issue: Before MySQL 5.1.30, the CHECK TABLE ... FOR
 
7546
       UPGRADE statement did not check for incompatible collation
 
7547
       changes made in MySQL 5.1.24. (This also affects mysqlcheck
 
7548
       and mysql_upgrade, which cause that statement to be executed.)
 
7549
       Prior to the fix made in 5.1.30, a binary upgrade (performed
 
7550
       without dumping tables with mysqldump before the upgrade and
 
7551
       reloading the dump file after the upgrade) would corrupt
 
7552
       tables. After the fix, CHECK TABLE ... FOR UPGRADE properly
 
7553
       detects the problem and warns about tables that need repair.
 
7554
       However, the fix is not backward compatible and can result in
 
7555
       a downgrading problem under these circumstances:
 
7556
 
 
7557
         1. Perform a binary upgrade to a version of MySQL that
 
7558
            includes the fix.
 
7559
 
 
7560
         2. Run CHECK TABLE ... FOR UPGRADE (or mysqlcheck or
 
7561
            mysql_upgrade) to upgrade tables.
 
7562
 
 
7563
         3. Perform a binary downgrade to a version of MySQL that
 
7564
            does not include the fix.
 
7565
       The solution is to dump tables with mysqldump before the
 
7566
       downgrade and reload the dump file after the downgrade.
 
7567
       Alternatively, drop and recreate affected indexes.
 
7568
 
 
7569
     * Known issue: MySQL introduces encoding for table names that
 
7570
       have non-ASCII characters (see Section 8.2.3, "Mapping of
 
7571
       Identifiers to File Names"). After a binary upgrade from MySQL
 
7572
       5.0 to 5.1 or higher, the server recognizes names that have
 
7573
       non-ASCII characters and adds a #mysql50# prefix to them.
 
7574
       As of MySQL 5.1.31, mysql_upgrade encodes these names by
 
7575
       executing the following command:
 
7576
mysqlcheck --all-databases --check-upgrade --fix-db-names --fix-table
 
7577
-names
 
7578
       Prior to MySQL 5.1.31, mysql_upgrade does not execute this
 
7579
       command, so you should execute it manually if you have
 
7580
       database or table names that contain nonalphanumeric
 
7581
       characters.
 
7582
       Prior to MySQL 5.1.23, the mysqlcheck command does not perform
 
7583
       the name encoding for views. To work around this problem, drop
 
7584
       each affected view and recreate it.
 
7585
       mysqlcheck cannot fix names that contain literal instances of
 
7586
       the @ character that is used for encoding special characters.
 
7587
       If you have databases or tables that contain this character,
 
7588
       use mysqldump to dump them before upgrading to MySQL 5.1, and
 
7589
       then reload the dump file after upgrading.
 
7590
 
 
7591
     * Known issue: When upgrading from MySQL 5.0 to versions of 5.1
 
7592
       prior to 5.1.23, running mysqlcheck (or mysql_upgrade, which
 
7593
       runs mysqlcheck) to upgrade tables fails for names that must
 
7594
       be written as quoted identifiers. To work around this problem,
 
7595
       rename each affected table to a name that does not require
 
7596
       quoting:
 
7597
RENAME TABLE `tab``le_a` TO table_a;
 
7598
RENAME TABLE `table b` TO table_b;
 
7599
       After renaming the tables, run the mysql_upgrade program. Then
 
7600
       rename the tables back to their original names:
 
7601
RENAME TABLE table_a TO `tab``le_a`;
 
7602
RENAME TABLE table_b TO `table b`;
 
7603
 
 
7604
     * Known issue: In connection with view creation, the server
 
7605
       created arc directories inside database directories and
 
7606
       maintained useless copies of .frm files there. Creation and
 
7607
       renaming procedures of those copies as well as creation of arc
 
7608
       directories has been discontinued in MySQL 5.1.29.
 
7609
       This change does cause a problem when downgrading to older
 
7610
       server versions which manifests itself under these
 
7611
       circumstances:
 
7612
 
 
7613
         1. Create a view v_orig in MySQL 5.1.29 or higher.
 
7614
 
 
7615
         2. Rename the view to v_new and then back to v_orig.
 
7616
 
 
7617
         3. Downgrade to an older 5.1.x server and run mysql_upgrade.
 
7618
 
 
7619
         4. Try to rename v_orig to v_new again. This operation
 
7620
            fails.
 
7621
       As a workaround to avoid this problem, use either of these
 
7622
       approaches:
 
7623
 
 
7624
          + Dump your data using mysqldump before downgrading and
 
7625
            reload the dump file after downgrading.
 
7626
 
 
7627
          + Instead of renaming a view after the downgrade, drop it
 
7628
            and recreate it.
 
7629
 
 
7630
     * Incompatible change: As of MySQL 5.5.6, handling of CREATE
 
7631
       TABLE IF NOT EXISTS ... SELECT statements has been changed for
 
7632
       the case that the destination table already exists:
 
7633
 
 
7634
          + Previously, for CREATE TABLE IF NOT EXISTS ... SELECT,
 
7635
            MySQL produced a warning that the table exists, but
 
7636
            inserted the rows and wrote the statement to the binary
 
7637
            log anyway. By contrast, CREATE TABLE ... SELECT (without
 
7638
            IF NOT EXISTS) failed with an error, but MySQL inserted
 
7639
            no rows and did not write the statement to the binary
 
7640
            log.
 
7641
 
 
7642
          + MySQL now handles both statements the same way when the
 
7643
            destination table exists, in that neither statement
 
7644
            inserts rows or is written to the binary log. The
 
7645
            difference between them is that MySQL produces a warning
 
7646
            when IF NOT EXISTS is present and an error when it is
 
7647
            not.
 
7648
       This change in handling of IF NOT EXISTS results in an
 
7649
       incompatibility for statement-based replication from a MySQL
 
7650
       5.1 master with the original behavior and a MySQL 5.5 slave
 
7651
       with the new behavior. Suppose that CREATE TABLE IF NOT EXISTS
 
7652
       ... SELECT is executed on the master and the destination table
 
7653
       exists. The result is that rows are inserted on the master but
 
7654
       not on the slave. (Row-based replication does not have this
 
7655
       problem.)
 
7656
       To address this issue, statement-based binary logging for
 
7657
       CREATE TABLE IF NOT EXISTS ... SELECT is changed in MySQL 5.1
 
7658
       as of 5.1.51:
 
7659
 
 
7660
          + If the destination table does not exist, there is no
 
7661
            change: The statement is logged as is.
 
7662
 
 
7663
          + If the destination table does exist, the statement is
 
7664
            logged as the equivalent pair of CREATE TABLE IF NOT
 
7665
            EXISTS and INSERT ... SELECT statements. (If the SELECT
 
7666
            in the original statement is preceded by IGNORE or
 
7667
            REPLACE, the INSERT becomes INSERT IGNORE or REPLACE,
 
7668
            respectively.)
 
7669
       This change provides forward compatibility for statement-based
 
7670
       replication from MySQL 5.1 to 5.5 because when the destination
 
7671
       table exists, the rows will be inserted on both the master and
 
7672
       slave. To take advantage of this compatibility measure, the
 
7673
       5.1 server must be at least 5.1.51 and the 5.5 server must be
 
7674
       at least 5.5.6.
 
7675
       To upgrade an existing 5.1-to-5.5 replication scenario,
 
7676
       upgrade the master first to 5.1.51 or higher. Note that this
 
7677
       differs from the usual replication upgrade advice of upgrading
 
7678
       the slave first.
 
7679
       A workaround for applications that wish to achieve the
 
7680
       original effect (rows inserted regardless of whether the
 
7681
       destination table exists) is to use CREATE TABLE IF NOT EXISTS
 
7682
       and INSERT ... SELECT statements rather than CREATE TABLE IF
 
7683
       NOT EXISTS ... SELECT statements.
 
7684
       Along with the change just described, the following related
 
7685
       change was made: Previously, if an existing view was named as
 
7686
       the destination table for CREATE TABLE IF NOT EXISTS ...
 
7687
       SELECT, rows were inserted into the underlying base table and
 
7688
       the statement was written to the binary log. As of MySQL
 
7689
       5.1.51 and 5.5.6, nothing is inserted or logged.
 
7690
 
 
7691
     * Incompatible change: Prior to MySQL 5.1.51, if you flushed the
 
7692
       logs using FLUSH LOGS or mysqladmin flush-logs and mysqld was
 
7693
       writing the error log to a file (for example, if it was
 
7694
       started with the --log-error option), it renames the current
 
7695
       log file with the suffix -old, then created a new empty log
 
7696
       file. This had the problem that a second log-flushing
 
7697
       operation thus caused the original error log file to be lost
 
7698
       unless you saved it under a different name. For example, you
 
7699
       could use the following commands to save the file:
 
7700
shell> mysqladmin flush-logs
 
7701
shell> mv host_name.err-old backup-directory
 
7702
       To avoid the preceding file-loss problem, no renaming occurs
 
7703
       as of MySQL 5.1.51; the server merely closes and reopens the
 
7704
       log file. To rename the file, you can do so manually before
 
7705
       flushing. Then flushing the logs reopens a new file with the
 
7706
       original file name. For example, you can rename the file and
 
7707
       create a new one using the following commands:
 
7708
shell> mv host_name.err host_name.err-old
 
7709
shell> mysqladmin flush-logs
 
7710
shell> mv host_name.err-old backup-directory
 
7711
 
 
7712
     * Incompatible change: Character set or collation changes were
 
7713
       made in MySQL 5.1.21, 5.1.23, and 5.1.24 that may require
 
7714
       table indexes to be rebuilt. For details, see Section 2.13.3,
 
7715
       "Checking Whether Tables or Indexes Must Be Rebuilt."
 
7716
 
 
7717
     * Incompatible change: MySQL 5.1 implements support for a plugin
 
7718
       API that enables the loading and unloading of components at
 
7719
       runtime, without restarting the server. Section 21.2, "The
 
7720
       MySQL Plugin API." The plugin API requires the mysql.plugin
 
7721
       table. After upgrading from an older version of MySQL, you
 
7722
       should run the mysql_upgrade command to create this table. See
 
7723
       Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
 
7724
       Upgrade."
 
7725
       Plugins are installed in the directory named by the plugin_dir
 
7726
       system variable. This variable also controls the location from
 
7727
       which the server loads user-defined functions (UDFs), which is
 
7728
       a change from earlier versions of MySQL. That is, all UDF
 
7729
       library files now must be installed in the plugin directory.
 
7730
       When upgrading from an older version of MySQL, you must
 
7731
       migrate your UDF files to the plugin directory.
 
7732
 
 
7733
     * Incompatible change: The table_cache system variable has been
 
7734
       renamed to table_open_cache. Any scripts that refer to
 
7735
       table_cache must be updated to use the new name.
 
7736
 
 
7737
     * Incompatible change: In MySQL 5.1.36, options for loading
 
7738
       plugins such as pluggable storage engines were changed from
 
7739
       boolean to tristate format. The implementations overlap, but
 
7740
       if you previously used options of the form --plugin_name=0 or
 
7741
       --plugin_name=1, you should instead use --plugin_name=OFF or
 
7742
       --plugin_name=ON, respectively. For details, see Section
 
7743
       5.1.7.1, "Installing and Uninstalling Plugins."
 
7744
 
 
7745
     * Incompatible change: From MySQL 5.1.24 to 5.1.31, the UPDATE
 
7746
       statement was changed such that assigning NULL to a NOT NULL
 
7747
       column caused an error even when strict SQL mode was not
 
7748
       enabled. The original behavior before MySQL 5.1.24 was that
 
7749
       such assignments caused an error only in strict SQL mode, and
 
7750
       otherwise set the column to the implicit default value for the
 
7751
       column data type and generated a warning. (For information
 
7752
       about implicit default values, see Section 10.1.4, "Data Type
 
7753
       Default Values.")
 
7754
       The change caused compatibility problems for applications that
 
7755
       relied on the original behavior. It also caused replication
 
7756
       problems between servers that had the original behavior and
 
7757
       those that did not, for applications that assigned NULL to NOT
 
7758
       NULL columns in UPDATE statements without strict SQL mode
 
7759
       enabled. The change was reverted in MySQL 5.1.32 so that
 
7760
       UPDATE again had the original behavior. Problems can still
 
7761
       occur if you replicate between servers that have the modified
 
7762
       UPDATE behavior and those that do not.
 
7763
 
 
7764
     * Incompatible change: As of MySQL 5.1.29, the default binary
 
7765
       logging mode has been changed from MIXED to STATEMENT for
 
7766
       compatibility with MySQL 5.0.
 
7767
 
 
7768
     * Incompatible change: In MySQL 5.1.25, a change was made to the
 
7769
       way that the server handles prepared statements. This affects
 
7770
       prepared statements processed at the SQL level (using the
 
7771
       PREPARE statement) and those processed using the binary
 
7772
       client/server protocol (using the mysql_stmt_prepare() C API
 
7773
       function).
 
7774
       Previously, changes to metadata of tables or views referred to
 
7775
       in a prepared statement could cause a server crash when the
 
7776
       statement was next executed, or perhaps an error at execute
 
7777
       time with a crash occurring later. For example, this could
 
7778
       happen after dropping a table and recreating it with a
 
7779
       different definition.
 
7780
       Now metadata changes to tables or views referred to by
 
7781
       prepared statements are detected and cause automatic
 
7782
       repreparation of the statement when it is next executed.
 
7783
       Metadata changes occur for DDL statements such as those that
 
7784
       create, drop, alter, rename, or truncate tables, or that
 
7785
       analyze, optimize, or repair tables. Repreparation also occurs
 
7786
       after referenced tables or views are flushed from the table
 
7787
       definition cache, either implicitly to make room for new
 
7788
       entries in the cache, or explicitly due to FLUSH TABLES.
 
7789
       Repreparation is automatic, but to the extent that it occurs,
 
7790
       performance of prepared statements is diminished.
 
7791
       Table content changes (for example, with INSERT or UPDATE) do
 
7792
       not cause repreparation, nor do SELECT statements.
 
7793
       An incompatibility with previous versions of MySQL is that a
 
7794
       prepared statement may now return a different set of columns
 
7795
       or different column types from one execution to the next. For
 
7796
       example, if the prepared statement is SELECT * FROM t1,
 
7797
       altering t1 to contain a different number of columns causes
 
7798
       the next execution to return a number of columns different
 
7799
       from the previous execution.
 
7800
       Older versions of the client library cannot handle this change
 
7801
       in behavior. For applications that use prepared statements
 
7802
       with the new server, an upgrade to the new client library is
 
7803
       strongly recommended.
 
7804
       Along with this change to statement repreparation, the default
 
7805
       value of the table_definition_cache system variable has been
 
7806
       increased from 128 to 256. The purpose of this increase is to
 
7807
       lessen the chance that prepared statements will need
 
7808
       repreparation due to referred-to tables/views having been
 
7809
       flushed from the cache to make room for new entries.
 
7810
       A new status variable, Com_stmt_reprepare, has been introduced
 
7811
       to track the number of repreparations.
 
7812
 
 
7813
     * Incompatible change: The -, *, and / operators and the
 
7814
       functions POW() and EXP() could misbehave when used with
 
7815
       floating-point numbers. Previously they might return +INF,
 
7816
       -INF, or NaN in cases of numeric overflow (including that
 
7817
       caused by division by zero) or when invalid arguments were
 
7818
       used. As of MySQL 5.1.24, NULL is returned in all such cases.
 
7819
 
 
7820
     * Incompatible change: As of MySQL 5.1.23, within a stored
 
7821
       routine, it is no longer permissible to declare a cursor for a
 
7822
       SHOW or DESCRIBE statement. This happened to work in some
 
7823
       instances, but is no longer supported. In many cases, a
 
7824
       workaround for this change is to use the cursor with a SELECT
 
7825
       query to read from an INFORMATION_SCHEMA table that produces
 
7826
       the same information as the SHOW statement.
 
7827
 
 
7828
     * Incompatible change: SHOW CREATE VIEW displays view
 
7829
       definitions using an AS alias_name clause for each column. If
 
7830
       a column is created from an expression, the default alias is
 
7831
       the expression text, which can be quite long. As of MySQL
 
7832
       5.1.23, aliases for column names in CREATE VIEW statements are
 
7833
       checked against the maximum column length of 64 characters
 
7834
       (not the maximum alias length of 256 characters). As a result,
 
7835
       views created from the output of SHOW CREATE VIEW fail if any
 
7836
       column alias exceeds 64 characters. This can cause problems
 
7837
       for replication or loading dump files. For additional
 
7838
       information and workarounds, see Section E.4, "Restrictions on
 
7839
       Views."
 
7840
 
 
7841
     * Incompatible change: Several issues were identified for stored
 
7842
       programs (stored procedures and functions, triggers, and
 
7843
       events) and views containing non-ASCII symbols. These issues
 
7844
       involved conversion errors due to incomplete character set
 
7845
       information when translating these objects to and from stored
 
7846
       format.
 
7847
       To address these problems, the representation for these
 
7848
       objects was changed in MySQL 5.1.21. However, the fixes affect
 
7849
       all stored programs and views. (For example, you will see
 
7850
       warnings about "no creation context.") To avoid warnings from
 
7851
       the server about the use of old definitions from any release
 
7852
       prior to 5.1.21, you should dump stored programs and views
 
7853
       with mysqldump after upgrading to 5.1.21 or higher, and then
 
7854
       reload them to recreate them with new definitions. Invoke
 
7855
       mysqldump with a --default-character-set option that names the
 
7856
       non-ASCII character set that was used for the definitions when
 
7857
       the objects were originally created.
 
7858
       Upgrading for triggers in particular must be handled
 
7859
       carefully, for two reasons:
 
7860
 
 
7861
          + The output from mysqldump does not contain a DROP TRIGGER
 
7862
            statement preceding each CREATE TRIGGER statement, so
 
7863
            reloading the dump file will fail to re-create the
 
7864
            triggers unless you manually drop them after generating
 
7865
            the dump file and before reloading it.
 
7866
 
 
7867
          + If you are upgrading from a very old version of MySQL 5.0
 
7868
            (before 5.0.10), the trigger upgrade procedure is
 
7869
            different because triggers for those versions were
 
7870
            created using a different namespace (trigger names had to
 
7871
            be unique per table, rather than per schema as is true
 
7872
            now). For instructions on upgrading triggers from old 5.0
 
7873
            versions, see Upgrading from MySQL 4.1 to 5.0
 
7874
            (http://dev.mysql.com/doc/refman/5.0/en/upgrading-from-pr
 
7875
            evious-series.html).
 
7876
       Assuming that you are upgrading from MySQL 5.0.10 to 5.1.20 to
 
7877
       MySQL 5.1.21 or later, use the following procedure to upgrade
 
7878
       your triggers:
 
7879
 
 
7880
          + Use mysqldump to generate a dump file that contains the
 
7881
            trigger definitions:
 
7882
mysqldump --triggers--no-create-db --no-data
 
7883
          --no-create-info --all-databases > triggers.sql
 
7884
            You might need to add options to specify connection
 
7885
            parameters, such as --user or --password. Also, if you
 
7886
            are updating from a version of MySQL 5.1 older than
 
7887
            5.1.21, you may need to include a --default-character-set
 
7888
            option that specifies the non-ASCII character set that
 
7889
            was used for the definitions when the triggers were
 
7890
            originally created.
 
7891
            Otherwise, invoke mysqldump with exactly the preceding
 
7892
            options to avoid generating a dump file that will not
 
7893
            have the intended effect when reloaded. For example, if
 
7894
            you omit the --no-create-db option, your databases will
 
7895
            be removed and recreated with no contents when you reload
 
7896
            the dump file.
 
7897
 
 
7898
          + Drop existing triggers. To see which triggers exist, use
 
7899
            this statement:
 
7900
SELECT TRIGGER_SCHEMA, EVENT_OBJECT_TABLE, TRIGGER_NAME
 
7901
FROM INFORMATION_SCHEMA.TRIGGERS;
 
7902
            To generate DROP TRIGGERS statements for the triggers,
 
7903
            use this statement:
 
7904
SELECT CONCAT('DROP TRIGGER ', TRIGGER_SCHEMA, '.', TRIGGER_NAME, ';'
 
7905
)
 
7906
FROM INFORMATION_SCHEMA.TRIGGERS
 
7907
INTO OUTFILE '/tmp/drop_triggers.sql';
 
7908
            The statement uses INTO OUTFILE, so you must have the
 
7909
            FILE privilege. The file will be created on the server
 
7910
            host. Use a different file name if you like. To be 100%
 
7911
            safe, inspect the trigger definitions in the
 
7912
            drop_triggers.sql file, and perhaps make a backup of the
 
7913
            file. Then execute the statements in the file:
 
7914
mysql --force < /tmp/drop_triggers.sql
 
7915
 
 
7916
          + Recreate the triggers by reloading the dump file created
 
7917
            earlier:
 
7918
mysql --force < triggers.sql
 
7919
 
 
7920
     * Incompatible change: As of MySQL 5.1.20, mysqld_safe supports
 
7921
       error logging to syslog on systems that support the logger
 
7922
       command. The new --syslog and --skip-syslog options can be
 
7923
       used instead of the --log-error option to control logging
 
7924
       behavior, as described in Section 4.3.2, "mysqld_safe ---
 
7925
       MySQL Server Startup Script."
 
7926
       In 5.1.21 and up, the default is --skip-syslog, which is
 
7927
       compatible with the default behavior of writing an error log
 
7928
       file for releases prior to 5.1.20.
 
7929
       In 5.1.20 only, the following conditions apply: 1) The default
 
7930
       is to use syslog, which is not compatible with releases prior
 
7931
       to 5.1.20. 2) Logging to syslog may fail to operate correctly
 
7932
       in some cases. For these reasons, avoid using MySQL 5.1.20.
 
7933
 
 
7934
     * Incompatible change: As of MySQL 5.1.18, the plugin interface
 
7935
       and its handling of system variables was changed. Command-line
 
7936
       options such as --skip-innodb now cause an error if InnoDB is
 
7937
       not built-in or plugin-loaded. You should use
 
7938
       --loose-skip-innodb if you do not want any error even if
 
7939
       InnoDB is not available. The --loose prefix modifier should be
 
7940
       used for all command-line options where you are uncertain
 
7941
       whether the plugin exists and when you want the operation to
 
7942
       proceed even if the option is necessarily ignored due to the
 
7943
       absence of the plugin. (For a desecription of how --loose
 
7944
       works, see Section 4.2.3.1, "Using Options on the Command
 
7945
       Line.")
 
7946
 
 
7947
     * Incompatible change: As of MySQL 5.1.15, InnoDB rolls back
 
7948
       only the last statement on a transaction timeout. A new
 
7949
       option, --innodb_rollback_on_timeout, causes InnoDB to abort
 
7950
       and roll back the entire transaction if a transaction timeout
 
7951
       occurs (the same behavior as in MySQL 4.1).
 
7952
 
 
7953
     * Incompatible change: As of MySQL 5.1.15, the following
 
7954
       conditions apply to enabling the read_only system variable:
 
7955
 
 
7956
          + If you attempt to enable read_only while you have any
 
7957
            explicit locks (acquired with LOCK TABLES or have a
 
7958
            pending transaction, an error will occur.
 
7959
 
 
7960
          + If other clients hold explicit table locks or have
 
7961
            pending transactions, the attempt to enable read_only
 
7962
            blocks until the locks are released and the transactions
 
7963
            end. While the attempt to enable read_only is pending,
 
7964
            requests by other clients for table locks or to begin
 
7965
            transactions also block until read_only has been set.
 
7966
 
 
7967
          + read_only can be enabled while you hold a global read
 
7968
            lock (acquired with FLUSH TABLES WITH READ LOCK) because
 
7969
            that does not involve table locks.
 
7970
       Previously, the attempt to enable read_only would return
 
7971
       immediately even if explicit locks or transactions were
 
7972
       pending, so some data changes could occur for statements
 
7973
       executing in the server at the same time.
 
7974
 
 
7975
     * Incompatible change: The number of function names affected by
 
7976
       IGNORE_SPACE was reduced significantly in MySQL 5.1.13, from
 
7977
       about 200 to about 30. (For details about IGNORE_SPACE, see
 
7978
       Section 8.2.4, "Function Name Parsing and Resolution.") This
 
7979
       change improves the consistency of parser operation. However,
 
7980
       it also introduces the possibility of incompatibility for old
 
7981
       SQL code that relies on the following conditions:
 
7982
 
 
7983
          + IGNORE_SPACE is disabled.
 
7984
 
 
7985
          + The presence or absence of whitespace following a
 
7986
            function name is used to distinguish between a built-in
 
7987
            function and stored function that have the same name (for
 
7988
            example, PI() versus PI ()).
 
7989
       For functions that are no longer affected by IGNORE_SPACE as
 
7990
       of MySQL 5.1.13, that strategy no longer works. Either of the
 
7991
       following approaches can be used if you have code that is
 
7992
       subject to the preceding incompatibility:
 
7993
 
 
7994
          + If a stored function has a name that conflicts with a
 
7995
            built-in function, refer to the stored function with a
 
7996
            schema name qualifier, regardless of whether whitespace
 
7997
            is present. For example, write schema_name.PI() or
 
7998
            schema_name.PI ().
 
7999
 
 
8000
          + Alternatively, rename the stored function to use a
 
8001
            nonconflicting name and change invocations of the
 
8002
            function to use the new name.
 
8003
 
 
8004
     * Incompatible change: For utf8 columns, the full-text parser
 
8005
       incorrectly considered several nonword punctuation and
 
8006
       whitespace characters as word characters, causing some
 
8007
       searches to return incorrect results. The fix involves a
 
8008
       change to the full-text parser in MySQL 5.1.12, so as of
 
8009
       5.1.12, any tables that have FULLTEXT indexes on utf8 columns
 
8010
       must be repaired with REPAIR TABLE:
 
8011
REPAIR TABLE tbl_name QUICK;
 
8012
 
 
8013
     * Incompatible change: Storage engines can be pluggable at
 
8014
       runtime, so the distinction between disabled and invalid
 
8015
       storage engines no longer applies. As of MySQL 5.1.12, this
 
8016
       affects the NO_ENGINE_SUBSTITUTION SQL mode, as described in
 
8017
       Section 5.1.6, "Server SQL Modes."
 
8018
 
 
8019
     * Incompatible change: The structure of FULLTEXT indexes has
 
8020
       been changed in MySQL 5.1.6. After upgrading to MySQL 5.1.6 or
 
8021
       greater, any tables that have FULLTEXT indexes must be
 
8022
       repaired with REPAIR TABLE:
 
8023
REPAIR TABLE tbl_name QUICK;
 
8024
 
 
8025
     * Incompatible change: In MySQL 5.1.6, when log tables were
 
8026
       implemented, the default log destination for the general query
 
8027
       and slow query log was TABLE. As of MySQL 5.1.21, this default
 
8028
       has been changed to FILE, which is compatible with MySQL 5.0,
 
8029
       but incompatible with earlier releases of MySQL 5.1. If you
 
8030
       are upgrading from MySQL 5.0 to 5.1.21 or higher, no logging
 
8031
       option changes should be necessary. However, if you are
 
8032
       upgrading from 5.1.6 through 5.1.20 to 5.1.21 or higher and
 
8033
       were using TABLE logging, use the --log-output=TABLE option
 
8034
       explicitly to preserve your server's table-logging behavior.
 
8035
 
 
8036
     * Incompatible change: In very old versions of MySQL (prior to
 
8037
       4.1), the TIMESTAMP data type supported a display width, which
 
8038
       was silenty ignored beginning with MySQL 4.1. This is
 
8039
       deprecated in MySQL 5.1, and removed altogether in MySQL 5.5.
 
8040
       These changes in behavior can lead to two problem scenarios
 
8041
       when trying to use TIMESTAMP(N) columns with a MySQL 5.5 or
 
8042
       later server:
 
8043
 
 
8044
          + When importing a dump file (for example, one created
 
8045
            using mysqldump) created in a MySQL 5.0 or earlier server
 
8046
            into a server from a newer release series, a CREATE TABLE
 
8047
            or ALTER TABLE statement containing TIMESTAMP(N) causes
 
8048
            the import to fail with a syntax error.
 
8049
            To fix this problem, edit the dump file in a text editor
 
8050
            to replace any instances of TIMESTAMP(N) with TIMESTAMP
 
8051
            prior to importing the file. Be sure to use a plain text
 
8052
            editor for this, and not a word processor; otherwise, the
 
8053
            result is almost certain to be unusable for importing
 
8054
            into the MySQL server.
 
8055
 
 
8056
          + When trying replicate any CREATE TABLE or ALTER TABLE
 
8057
            statement containing TIMESTAMP(N) from a master MySQL
 
8058
            server that supports the TIMESTAMP(N) syntax to a MySQL
 
8059
            5.5.3 or newer slave, the statement causes replication to
 
8060
            fail. Similarly, when you try to restore from a binary
 
8061
            log written by a server that supports TIMESTAMP(N) to a
 
8062
            MySQL 5.5.3 or newer server, any CREATE TABLE or ALTER
 
8063
            TABLE statement containing TIMESTAMP(N) causes the backup
 
8064
            to fail. This holds true regardless of the logging
 
8065
            format.
 
8066
            It may be possible to fix such issues using a hex editor,
 
8067
            by replacing any width arguments used with TIMESTAMP, and
 
8068
            the parentheses containing them, with space characters
 
8069
            (hexadecimal 20). Be sure to use a programmer's binary
 
8070
            hex editor and not a regular text editor or word
 
8071
            processor for this; otherwise, the result is almost
 
8072
            certain to be a corrupted binary log file. To guard
 
8073
            against accidental corruption of the binary log, you
 
8074
            should always work on a copy of the file rather than the
 
8075
            original.
 
8076
       You should try to handle potential issues of these types
 
8077
       proactively by updating with ALTER TABLE any TIMESTAMP(N)
 
8078
       columns in your databases so that they use TIMESTAMP instead,
 
8079
       before performing any upgrades.
 
8080
 
 
8081
     * Incompatible change: For ENUM columns that had enumeration
 
8082
       values containing commas, the commas were mapped to 0xff
 
8083
       internally. However, this rendered the commas
 
8084
       indistinguishable from true 0xff characters in the values.
 
8085
       This no longer occurs. However, the fix requires that you dump
 
8086
       and reload any tables that have ENUM columns containing true
 
8087
       0xff in their values: Dump the tables using mysqldump with the
 
8088
       current server before upgrading from a version of MySQL 5.1
 
8089
       older than 5.1.15 to version 5.1.15 or newer.
 
8090
 
 
8091
     * As of MySQL 5.1.12, the lc_time_names system variable
 
8092
       specifies the locale that controls the language used to
 
8093
       display day and month names and abbreviations. This variable
 
8094
       affects the output from the DATE_FORMAT(), DAYNAME() and
 
8095
       MONTHNAME() functions. See Section 9.7, "MySQL Server Locale
 
8096
       Support."
 
8097
 
 
8098
     * As of MySQL 5.1.9, mysqld_safe no longer implicitly invokes
 
8099
       mysqld-max if it exists. Instead, it invokes mysqld unless a
 
8100
       --mysqld or --mysqld-version option is given to specify
 
8101
       another server explicitly. If you previously relied on the
 
8102
       implicit invocation of mysqld-max, you should use an
 
8103
       appropriate option now. As of MySQL 5.1.12, there is no longer
 
8104
       any separate mysqld-max server, so no change should be
 
8105
       necessary.
 
8106
 
 
8107
SQL Changes
 
8108
 
 
8109
 
 
8110
     * Known issue: Prior to MySQL 5.1.17, the parser accepted
 
8111
       invalid code in SQL condition handlers, leading to server
 
8112
       crashes or unexpected execution behavior in stored programs.
 
8113
       Specifically, the parser permitted a condition handler to
 
8114
       refer to labels for blocks that enclose the handler
 
8115
       declaration. This was incorrect because block label scope does
 
8116
       not include the code for handlers declared within the labeled
 
8117
       block.
 
8118
       As of 5.1.17, the parser rejects this invalid construct, but
 
8119
       if you perform a binary upgrade (without dumping and reloading
 
8120
       your databases), existing handlers that contain the construct
 
8121
       still are invalid and should be rewritten even if they appear
 
8122
       to function as you expect.
 
8123
       To find affected handlers, use mysqldump to dump all stored
 
8124
       procedures and functions, triggers, and events. Then attempt
 
8125
       to reload them into an upgraded server. Handlers that contain
 
8126
       illegal label references will be rejected.
 
8127
       For more information about condition handlers and writing them
 
8128
       to avoid invalid jumps, see Section 12.6.7.2, "DECLARE ...
 
8129
       HANDLER Syntax."
 
8130
 
 
8131
     * Incompatible change: The parser accepted statements that
 
8132
       contained /* ... */ that were not properly closed with */,
 
8133
       such as SELECT 1 /* + 2. As of MySQL 5.1.23, statements that
 
8134
       contain unclosed /*-comments now are rejected with a syntax
 
8135
       error.
 
8136
       This fix has the potential to cause incompatibilities. Because
 
8137
       of Bug #26302, which caused the trailing */ to be truncated
 
8138
       from comments in views, stored routines, triggers, and events,
 
8139
       it is possible that objects of those types may have been
 
8140
       stored with definitions that now will be rejected as
 
8141
       syntactically invalid. Such objects should be dropped and
 
8142
       re-created so that their definitions do not contain truncated
 
8143
       comments.
 
8144
 
 
8145
     * Incompatible change: Multiple-table DELETE statements
 
8146
       containing ambiguous aliases could have unintended side
 
8147
       effects such as deleting rows from the wrong table. Examples:
 
8148
DELETE FROM t1 AS a2 USING t1 AS a1 INNER JOIN t2 AS a2;
 
8149
DELETE t1 AS a2 FROM t1 AS a1 INNER JOIN t2 AS a2;
 
8150
       To avoid ambiguity, declaration of aliases other than in the
 
8151
       table_references part of the statement should be avoided:
 
8152
DELETE FROM t1 USING t1 AS a1 INNER JOIN t2 AS a2;
 
8153
DELETE t1 FROM t1 AS a1 INNER JOIN t2 AS a2;
 
8154
       As of MySQL 5.1.23, alias declarations outside the
 
8155
       table_references part of the statement are disallowed for the
 
8156
       USING variant of multiple-table DELETE syntax. (In MySQL 5.5,
 
8157
       alias declarations outside table_references are disallowed for
 
8158
       all multiple-table DELETE statements.) Statements containing
 
8159
       aliases that are no longer permitted must be rewritten.
 
8160
 
 
8161
     * Incompatible change: As of MySQL 5.1.8, TYPE = engine_name is
 
8162
       still accepted as a synonym for the ENGINE = engine_name table
 
8163
       option but generates a warning. You should note that this
 
8164
       option is not available in MySQL 5.1.7, and is removed
 
8165
       altogether in MySQL 5.5 and produces a syntax error.
 
8166
       TYPE has been deprecated since MySQL 4.0.
 
8167
 
 
8168
     * Incompatible change: MySQL 5.1.6 introduces the TRIGGER
 
8169
       privilege. Previously, the SUPER privilege was needed to
 
8170
       create or drop triggers. Now those operations require the
 
8171
       TRIGGER privilege. This is a security improvement because you
 
8172
       no longer need to grant users the SUPER privilege to enable
 
8173
       them to create triggers. However, the requirement that the
 
8174
       account named in a trigger's DEFINER clause must have the
 
8175
       SUPER privilege has changed to a requirement for the TRIGGER
 
8176
       privilege. When upgrading from a previous version of MySQL 5.0
 
8177
       or 5.1 to MySQL 5.1.6 or newer, be sure to update your grant
 
8178
       tables by running mysql_upgrade. This will assign the TRIGGER
 
8179
       privilege to all accounts that had the SUPER privilege. If you
 
8180
       fail to update the grant tables, triggers may fail when
 
8181
       activated. After updating the grant tables, you can revoke the
 
8182
       SUPER privilege from those accounts that no longer otherwise
 
8183
       require it.
 
8184
 
 
8185
     * Some keywords may be reserved in MySQL 5.1 that were not
 
8186
       reserved in MySQL 5.0. See Section 8.3, "Reserved Words."
 
8187
 
 
8188
     * The BACKUP TABLE, and RESTORE TABLE statements are deprecated.
 
8189
       mysqldump or mysqlhotcopy can be used as alternatives.
 
8190
 
 
8191
     * The LOAD DATA FROM MASTER and LOAD TABLE FROM MASTER
 
8192
       statements are deprecated. See Section 12.4.2.2, "LOAD DATA
 
8193
       FROM MASTER Syntax," for recommended alternatives.
 
8194
 
 
8195
     * The INSTALL PLUGIN and UNINSTALL PLUGIN statements that are
 
8196
       used for the plugin API are new. So is the WITH PARSER clause
 
8197
       for FULLTEXT index creation that associates a parser plugin
 
8198
       with a full-text index. Section 21.2, "The MySQL Plugin API."
 
8199
 
 
8200
C API Changes
 
8201
 
 
8202
 
 
8203
     * Incompatible change: As of MySQL 5.1.7, the
 
8204
       mysql_stmt_attr_get() C API function returns a boolean rather
 
8205
       than an unsigned int for STMT_ATTR_UPDATE_MAX_LENGTH. (Bug
 
8206
       #16144)
 
8207
 
 
8208
2.13.2. Downgrading MySQL
 
8209
 
 
8210
   This section describes what you should do to downgrade to an older
 
8211
   MySQL version in the unlikely case that the previous version
 
8212
   worked better than the new one.
 
8213
 
 
8214
   If you are downgrading within the same release series (for
 
8215
   example, from 5.0.13 to 5.0.12) the general rule is that you just
 
8216
   have to install the new binaries on top of the old ones. There is
 
8217
   no need to do anything with the databases. As always, however, it
 
8218
   is always a good idea to make a backup.
 
8219
 
 
8220
   The following items form a checklist of things you should do
 
8221
   whenever you perform a downgrade:
 
8222
 
 
8223
     * Read the upgrading section for the release series from which
 
8224
       you are downgrading to be sure that it does not have any
 
8225
       features you really need. See Section 2.13.1, "Upgrading
 
8226
       MySQL."
 
8227
 
 
8228
     * If there is a downgrading section for that version, you should
 
8229
       read that as well.
 
8230
 
 
8231
     * To see which new features were added between the version to
 
8232
       which you are downgrading and your current version, see the
 
8233
       change logs (Appendix D, "MySQL Change History").
 
8234
 
 
8235
     * Check Section 2.13.3, "Checking Whether Tables or Indexes Must
 
8236
       Be Rebuilt," to see whether changes to table formats or to
 
8237
       character sets or collations were made between your current
 
8238
       version of MySQL and the version to which you are downgrading.
 
8239
       If so and these changes result in an incompatibility between
 
8240
       MySQL versions, you will need to downgrade the affected tables
 
8241
       using the instructions in Section 2.13.4, "Rebuilding or
 
8242
       Repairing Tables or Indexes."
 
8243
 
 
8244
   In most cases, you can move the MySQL format files and data files
 
8245
   between different versions on the same architecture as long as you
 
8246
   stay within versions for the same release series of MySQL.
 
8247
 
 
8248
   If you downgrade from one release series to another, there may be
 
8249
   incompatibilities in table storage formats. In this case, use
 
8250
   mysqldump to dump your tables before downgrading. After
 
8251
   downgrading, reload the dump file using mysql or mysqlimport to
 
8252
   re-create your tables. For examples, see Section 2.13.5, "Copying
 
8253
   MySQL Databases to Another Machine."
 
8254
 
 
8255
   A typical symptom of a downward-incompatible table format change
 
8256
   when you downgrade is that you cannot open tables. In that case,
 
8257
   use the following procedure:
 
8258
 
 
8259
    1. Stop the older MySQL server that you are downgrading to.
 
8260
 
 
8261
    2. Restart the newer MySQL server you are downgrading from.
 
8262
 
 
8263
    3. Dump any tables that were inaccessible to the older server by
 
8264
       using mysqldump to create a dump file.
 
8265
 
 
8266
    4. Stop the newer MySQL server and restart the older one.
 
8267
 
 
8268
    5. Reload the dump file into the older server. Your tables should
 
8269
       be accessible.
 
8270
 
 
8271
   It might also be the case that system tables in the mysql database
 
8272
   have changed and that downgrading introduces some loss of
 
8273
   functionality or requires some adjustments. Here are some
 
8274
   examples:
 
8275
 
 
8276
     * Trigger creation requires the TRIGGER privilege as of MySQL
 
8277
       5.1. In MySQL 5.0, there is no TRIGGER privilege and SUPER is
 
8278
       required instead. If you downgrade from MySQL 5.1 to 5.0, you
 
8279
       will need to give the SUPER privilege to those accounts that
 
8280
       had the TRIGGER privilege in 5.1.
 
8281
 
 
8282
     * Triggers were added in MySQL 5.0, so if you downgrade from 5.0
 
8283
       to 4.1, you cannot use triggers at all.
 
8284
 
 
8285
     * The mysql.proc.comment column definition changed between MySQL
 
8286
       5.1 and 5.5. After a downgrade from 5.5 to 5.1, this table is
 
8287
       seen as corrupt and in need of repair. To workaround this
 
8288
       problem, execute mysql_upgrade from the version of MySQL to
 
8289
       which you downgraded.
 
8290
 
 
8291
2.13.2.1. Downgrading to MySQL 5.0
 
8292
 
 
8293
   When downgrading to MySQL 5.0 from MySQL 5.1, you should keep in
 
8294
   mind the following issues relating to features found in MySQL 5.1,
 
8295
   but not in MySQL 5.0:
 
8296
 
 
8297
     * Partitioning.  MySQL 5.0 does not support user-defined
 
8298
       partitioning. If a table was created as a partitioned table in
 
8299
       5.1 (or if an table created in a previous version of MySQL was
 
8300
       altered to include partitions after an upgrade to 5.1), the
 
8301
       table is accessible after downgrade only if you do one of the
 
8302
       following:
 
8303
 
 
8304
          + Export the table using mysqldump and then drop it in
 
8305
            MySQL 5.1; import the table again following the downgrade
 
8306
            to MySQL 5.0.
 
8307
 
 
8308
          + Prior to the downgrade, remove the table's partitioning
 
8309
            using ALTER TABLE table_name REMOVE PARTITIONING.
 
8310
 
 
8311
     * Event Scheduler.  MySQL 5.0 does not support scheduled events.
 
8312
       If your databases contain scheduled event definitions, you
 
8313
       should prevent them from being dumped when you use mysqldump
 
8314
       by using the --skip-events option. (See Section 4.5.4,
 
8315
       "mysqldump --- A Database Backup Program.")
 
8316
 
 
8317
     * Stored routines.  MySQL 5.1.21 added a number of new columns
 
8318
       to the mysql.proc table in which stored routine definitions
 
8319
       are stored. If you are downgrading from MySQL 5.1.21 or later
 
8320
       to MySQL 5.0, you cannot import the MySQL 5.1 routine
 
8321
       definitions into MySQL 5.0.46 or earlier using the dump of
 
8322
       mysql.proc created by mysqldump (such as when using the
 
8323
       --all-databases option). Instead, you should run mysqldump
 
8324
       --routines prior to performing the downgrade and run the
 
8325
       stored routines DDL statements following the downgrade.
 
8326
       See Bug #11986, Bug #30029, and Bug #30660, for more
 
8327
       information.
 
8328
 
 
8329
     * Triggers.  Trigger creation requires the TRIGGER privilege as
 
8330
       of MySQL 5.1. In MySQL 5.0, there is no TRIGGER privilege and
 
8331
       SUPER is required instead. If you downgrade from MySQL 5.1 to
 
8332
       5.0, you will need to give the SUPER privilege to those
 
8333
       accounts that had the TRIGGER privilege in 5.1.
 
8334
 
 
8335
2.13.3. Checking Whether Tables or Indexes Must Be Rebuilt
 
8336
 
 
8337
   A binary upgrade or downgrade is one that installs one version of
 
8338
   MySQL "in place" over an existing version, without dumping and
 
8339
   reloading tables:
 
8340
 
 
8341
    1. Stop the server for the existing version if it is running.
 
8342
 
 
8343
    2. Install a different version of MySQL. This is an upgrade if
 
8344
       the new version is higher than the original version, a
 
8345
       downgrade if the version is lower.
 
8346
 
 
8347
    3. Start the server for the new version.
 
8348
 
 
8349
   In many cases, the tables from the previous version of MySQL can
 
8350
   be used without problem by the new version. However, sometimes
 
8351
   changes occur that require tables or table indexes to be rebuilt,
 
8352
   as described in this section. If you have tables that are affected
 
8353
   by any of the issues described here, rebuild the tables or indexes
 
8354
   as necessary using the instructions given in Section 2.13.4,
 
8355
   "Rebuilding or Repairing Tables or Indexes."
 
8356
 
 
8357
Table Incompatibilities
 
8358
 
 
8359
   After a binary upgrade to MySQL 5.1 from a MySQL 5.0 installation
 
8360
   that contains ARCHIVE tables:
 
8361
 
 
8362
     * Before MySQL 5.1.42, accessing those tables will cause the
 
8363
       server to crash, even if you have run mysql_upgrade or CHECK
 
8364
       TABLE ... FOR UPGRADE.
 
8365
 
 
8366
     * As of MySQL 5.1.42, the server will not open 5.0 ARCHIVE
 
8367
       tables at all.
 
8368
 
 
8369
   In either case, the solution is to use mysqldump to dump all 5.0
 
8370
   ARCHIVE tables before upgrading, and reload them into MySQL 5.1
 
8371
   after upgrading. This problem is fixed in MySQL 5.6.4: The server
 
8372
   can open ARCHIVE tables created in MySQL 5.0. However, it remains
 
8373
   the recommended upgrade procedure to dump 5.0 ARCHIVE tables
 
8374
   before upgrading and reload them after upgrading.
 
8375
 
 
8376
Index Incompatibilities
 
8377
 
 
8378
   If you perform a binary upgrade without dumping and reloading
 
8379
   tables, you cannot upgrade directly from MySQL 4.1 to 5.1 or
 
8380
   higher. This occurs due to an incompatible change in the MyISAM
 
8381
   table index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
 
8382
   repair all MyISAM tables. Then upgrade from MySQL 5.0 to 5.1 and
 
8383
   check and repair your tables.
 
8384
 
 
8385
   Modifications to the handling of character sets or collations
 
8386
   might change the character sort order, which causes the ordering
 
8387
   of entries in any index that uses an affected character set or
 
8388
   collation to be incorrect. Such changes result in several possible
 
8389
   problems:
 
8390
 
 
8391
     * Comparison results that differ from previous results
 
8392
 
 
8393
     * Inability to find some index values due to misordered index
 
8394
       entries
 
8395
 
 
8396
     * Misordered ORDER BY results
 
8397
 
 
8398
     * Tables that CHECK TABLE reports as being in need of repair
 
8399
 
 
8400
   The solution to these problems is to rebuild any indexes that use
 
8401
   an affected character set or collation, either by dropping and
 
8402
   re-creating the indexes, or by dumping and reloading the entire
 
8403
   table. For information about rebuilding indexes, see Section
 
8404
   2.13.4, "Rebuilding or Repairing Tables or Indexes."
 
8405
 
 
8406
   To check whether a table has indexes that must be rebuilt, consult
 
8407
   the following list. It indicates which versions of MySQL
 
8408
   introduced character set or collation changes that require indexes
 
8409
   to be rebuilt. Each entry indicates the version in which the
 
8410
   change occurred and the character sets or collations that the
 
8411
   change affects. If the change is associated with a particular bug
 
8412
   report, the bug number is given.
 
8413
 
 
8414
   The list applies both for binary upgrades and downgrades. For
 
8415
   example, Bug #27877 was fixed in MySQL 5.1.24 and 5.4.0, so it
 
8416
   applies to upgrades from versions older than 5.1.24 to 5.1.24 or
 
8417
   newer, and to downgrades from 5.1.24 or newer to versions older
 
8418
   than 5.1.24.
 
8419
 
 
8420
   In many cases, you can use CHECK TABLE ... FOR UPGRADE to identify
 
8421
   tables for which index rebuilding is required. (It will report:
 
8422
   Table upgrade required. Please do "REPAIR TABLE `tbl_name`" or
 
8423
   dump/reload to fix it!) In these cases, you can also use
 
8424
   mysqlcheck --check-upgrade or mysql_upgrade, which execute CHECK
 
8425
   TABLE. However, the use of CHECK TABLE applies only after
 
8426
   upgrades, not downgrades. Also, CHECK TABLE is not applicable to
 
8427
   all storage engines. For details about which storage engines CHECK
 
8428
   TABLE supports, see Section 12.7.2.3, "CHECK TABLE Syntax."
 
8429
 
 
8430
   Changes that cause index rebuilding to be necessary:
 
8431
 
 
8432
     * MySQL 5.0.48, 5.1.21 (Bug #29461)
 
8433
       Affects indexes for columns that use any of these character
 
8434
       sets: eucjpms, euc_kr, gb2312, latin7, macce, ujis
 
8435
       Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
 
8436
       as of MySQL 5.1.29, 5.4.0 (see Bug #39585).
 
8437
 
 
8438
     * MySQL 5.0.48, 5.1.23 (Bug #27562)
 
8439
       Affects indexes that use the ascii_general_ci collation for
 
8440
       columns that contain any of these characters: '`' GRAVE
 
8441
       ACCENT, '[' LEFT SQUARE BRACKET, '\' REVERSE SOLIDUS, ']'
 
8442
       RIGHT SQUARE BRACKET, '~' TILDE
 
8443
       Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
 
8444
       as of MySQL 5.1.29, 5.4.0 (see Bug #39585).
 
8445
 
 
8446
     * MySQL 5.1.24, 5.4.0 (Bug #27877)
 
8447
       Affects indexes that use the utf8_general_ci or
 
8448
       ucs2_general_ci collation for columns that contain 'Ɵ' LATIN
 
8449
       SMALL LETTER SHARP S (German).
 
8450
       Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
 
8451
       as of MySQL 5.1.30, 5.4.0 (see Bug #40053).
 
8452
 
 
8453
2.13.4. Rebuilding or Repairing Tables or Indexes
 
8454
 
 
8455
   This section describes how to rebuild a table. This can be
 
8456
   necessitated by changes to MySQL such as how data types are
 
8457
   handled or changes to character set handling. For example, an
 
8458
   error in a collation might have been corrected, necessitating a
 
8459
   table rebuild to update the indexes for character columns that use
 
8460
   the collation. (For examples, see Section 2.13.3, "Checking
 
8461
   Whether Tables or Indexes Must Be Rebuilt.") It might also be that
 
8462
   a table repair or upgrade should be done as indicated by a table
 
8463
   check operation such as that performed by CHECK TABLE, mysqlcheck,
 
8464
   or mysql_upgrade.
 
8465
 
 
8466
   Methods for rebuilding a table include dumping and reloading it,
 
8467
   or using ALTER TABLE or REPAIR TABLE.
 
8468
   Note
 
8469
 
 
8470
   If you are rebuilding tables because a different version of MySQL
 
8471
   will not handle them after a binary (in-place) upgrade or
 
8472
   downgrade, you must use the dump-and-reload method. Dump the
 
8473
   tables before upgrading or downgrading using your original version
 
8474
   of MySQL. Then reload the tables after upgrading or downgrading.
 
8475
 
 
8476
   If you use the dump-and-reload method of rebuilding tables only
 
8477
   for the purpose of rebuilding indexes, you can perform the dump
 
8478
   either before or after upgrading or downgrading. Reloading still
 
8479
   must be done afterward.
 
8480
 
 
8481
   To rebuild a table by dumping and reloading it, use mysqldump to
 
8482
   create a dump file and mysql to reload the file:
 
8483
shell> mysqldump db_name t1 > dump.sql
 
8484
shell> mysql db_name < dump.sql
 
8485
 
 
8486
   To rebuild all the tables in a single database, specify the
 
8487
   database name without any following table name:
 
8488
shell> mysqldump db_name > dump.sql
 
8489
shell> mysql db_name < dump.sql
 
8490
 
 
8491
   To rebuild all tables in all databases, use the --all-databases
 
8492
   option:
 
8493
shell> mysqldump --all-databases > dump.sql
 
8494
shell> mysql < dump.sql
 
8495
 
 
8496
   To rebuild a table with ALTER TABLE, use a "null" alteration; that
 
8497
   is, an ALTER TABLE statement that "changes" the table to use the
 
8498
   storage engine that it already has. For example, if t1 is a MyISAM
 
8499
   table, use this statement:
 
8500
mysql> ALTER TABLE t1 ENGINE = MyISAM;
 
8501
 
 
8502
   If you are not sure which storage engine to specify in the ALTER
 
8503
   TABLE statement, use SHOW CREATE TABLE to display the table
 
8504
   definition.
 
8505
 
 
8506
   If you must rebuild a table because a table checking operation
 
8507
   indicates that the table is corrupt or needs an upgrade, you can
 
8508
   use REPAIR TABLE if that statement supports the table's storage
 
8509
   engine. For example, to repair a MyISAM table, use this statement:
 
8510
mysql> REPAIR TABLE t1;
 
8511
 
 
8512
   For storage engines such as InnoDB that REPAIR TABLE does not
 
8513
   support, use mysqldump to create a dump file and mysql to reload
 
8514
   the file, as described earlier.
 
8515
 
 
8516
   For specifics about which storage engines REPAIR TABLE supports,
 
8517
   see Section 12.7.2.6, "REPAIR TABLE Syntax."
 
8518
 
 
8519
   mysqlcheck --repair provides command-line access to the REPAIR
 
8520
   TABLE statement. This can be a more convenient means of repairing
 
8521
   tables because you can use the --databases or --all-databases
 
8522
   option to repair all tables in specific databases or all
 
8523
   databases, respectively:
 
8524
shell> mysqlcheck --repair --databases db_name ...
 
8525
shell> mysqlcheck --repair --all-databases
 
8526
 
 
8527
2.13.5. Copying MySQL Databases to Another Machine
 
8528
 
 
8529
   You can copy the .frm, .MYI, and .MYD files for MyISAM tables
 
8530
   between different architectures that support the same
 
8531
   floating-point format. (MySQL takes care of any byte-swapping
 
8532
   issues.) See Section 13.5, "The MyISAM Storage Engine."
 
8533
 
 
8534
   In cases where you need to transfer databases between different
 
8535
   architectures, you can use mysqldump to create a file containing
 
8536
   SQL statements. You can then transfer the file to the other
 
8537
   machine and feed it as input to the mysql client.
 
8538
 
 
8539
   Use mysqldump --help to see what options are available.
 
8540
 
 
8541
   The easiest (although not the fastest) way to move a database
 
8542
   between two machines is to run the following commands on the
 
8543
   machine on which the database is located:
 
8544
shell> mysqladmin -h 'other_hostname' create db_name
 
8545
shell> mysqldump db_name | mysql -h 'other_hostname' db_name
 
8546
 
 
8547
   If you want to copy a database from a remote machine over a slow
 
8548
   network, you can use these commands:
 
8549
shell> mysqladmin create db_name
 
8550
shell> mysqldump -h 'other_hostname' --compress db_name | mysql db_na
 
8551
me
 
8552
 
 
8553
   You can also store the dump in a file, transfer the file to the
 
8554
   target machine, and then load the file into the database there.
 
8555
   For example, you can dump a database to a compressed file on the
 
8556
   source machine like this:
 
8557
shell> mysqldump --quick db_name | gzip > db_name.gz
 
8558
 
 
8559
   Transfer the file containing the database contents to the target
 
8560
   machine and run these commands there:
 
8561
shell> mysqladmin create db_name
 
8562
shell> gunzip < db_name.gz | mysql db_name
 
8563
 
 
8564
   You can also use mysqldump and mysqlimport to transfer the
 
8565
   database. For large tables, this is much faster than simply using
 
8566
   mysqldump. In the following commands, DUMPDIR represents the full
 
8567
   path name of the directory you use to store the output from
 
8568
   mysqldump.
 
8569
 
 
8570
   First, create the directory for the output files and dump the
 
8571
   database:
 
8572
shell> mkdir DUMPDIR
 
8573
shell> mysqldump --tab=DUMPDIR db_name
 
8574
 
 
8575
   Then transfer the files in the DUMPDIR directory to some
 
8576
   corresponding directory on the target machine and load the files
 
8577
   into MySQL there:
 
8578
shell> mysqladmin create db_name           # create database
 
8579
shell> cat DUMPDIR/*.sql | mysql db_name   # create tables in databas
 
8580
e
 
8581
shell> mysqlimport db_name DUMPDIR/*.txt   # load data into tables
 
8582
 
 
8583
   Do not forget to copy the mysql database because that is where the
 
8584
   grant tables are stored. You might have to run commands as the
 
8585
   MySQL root user on the new machine until you have the mysql
 
8586
   database in place.
 
8587
 
 
8588
   After you import the mysql database on the new machine, execute
 
8589
   mysqladmin flush-privileges so that the server reloads the grant
 
8590
   table information.
7937
8591
 
7938
8592
2.14. Environment Variables
7939
8593
 
7949
8603
   In many cases, it is preferable to use an option file instead of
7950
8604
   environment variables to modify the behavior of MySQL. See Section
7951
8605
   4.2.3.3, "Using Option Files."
 
8606
 
 
8607
   To set an environment variable within sh, ksh, bash, or zsh shells
 
8608
   you can use the following commands:
 
8609
shell> ENVVAR=value
 
8610
shell> export ENVVAR
 
8611
 
 
8612
   The export is required if you want other sub-commands to inherit
 
8613
   that value during execution. On more recent shells you can combine
 
8614
   the export and setting processes, like this:
 
8615
shell> export set ENVVAR=value
 
8616
 
 
8617
   For the csh, or tcsh shells, use the setenv command:
 
8618
shell> setenv ENVVAR value
 
8619
 
 
8620
   Within the Windows Command Prompt use the set command to specify
 
8621
   the value of a variable:
 
8622
shell> set ENVVAR=value
 
8623
 
 
8624
   On Unix, Linux, Mac OS X, and Windows, the set command without
 
8625
   parameters will display the list of currently set variables.
 
8626
 
 
8627
   Table 2.21. MySQL Related Environment Variables
7952
8628
   Variable Description
7953
8629
   CXX The name of your C++ compiler (for running configure).
7954
8630
   CC The name of your C compiler (for running configure).
7972
8648
   MYSQL_PS1 The command prompt to use in the mysql command-line
7973
8649
   client.
7974
8650
   MYSQL_PWD The default password when connecting to mysqld. Note
7975
 
   that using this is insecure. See Section 5.5.6.2, "End-User
 
8651
   that using this is insecure. See Section 5.3.2.2, "End-User
7976
8652
   Guidelines for Password Security."
7977
8653
   MYSQL_TCP_PORT The default TCP/IP port number.
7978
8654
   MYSQL_UNIX_PORT The default Unix socket file name; used for
7980
8656
   PATH Used by the shell to find MySQL programs.
7981
8657
   TMPDIR The directory where temporary files are created.
7982
8658
   TZ This should be set to your local time zone. See Section
7983
 
   B.5.4.6, "Time Zone Problems."
 
8659
   C.5.4.6, "Time Zone Problems."
7984
8660
   UMASK The user-file creation mode when creating files. See note
7985
8661
   following table.
7986
8662
   UMASK_DIR The user-directory creation mode when creating
7987
8663
   directories. See note following table.
7988
 
   USER The default user name on Windows and NetWare used when
7989
 
   connecting to mysqld.
 
8664
   USER The default user name on Windows and NetWare when connecting
 
8665
   to mysqld.
 
8666
 
 
8667
   For information about the mysql history file, see Section 4.5.1.3,
 
8668
   "mysql History File."
7990
8669
 
7991
8670
   The UMASK and UMASK_DIR variables, despite their names, are used
7992
8671
   as modes, not masks:
8007
8686
 
8008
8687
2.15. Perl Installation Notes
8009
8688
 
8010
 
   Perl support for MySQL is provided by means of the DBI/DBD client
8011
 
   interface. The interface requires Perl 5.6.0, and 5.6.1 or later
8012
 
   is preferred. DBI does not work if you have an older version of
8013
 
   Perl.
 
8689
   The Perl DBI module provides a generic interface for database
 
8690
   access. You can write a DBI script that works with many different
 
8691
   database engines without change. To use DBI, you must install the
 
8692
   DBI module, as well as a DataBase Driver (DBD) module for each
 
8693
   type of databas server you want to access. For MySQL, this driver
 
8694
   is the DBD::mysql module.
8014
8695
 
8015
 
   If you want to use transactions with Perl DBI, you need to have
8016
 
   DBD::mysql 2.0900. If you are using the MySQL 4.1 or newer client
8017
 
   library, you must use DBD::mysql 2.9003 or newer. Support for
8018
 
   server-side prepared statements requires DBD::mysql 3.0009 or
8019
 
   newer.
 
8696
   Perl, and the DBD::MySQL module for DBI must be installed if you
 
8697
   want to run the MySQL benchmark scripts; see Section 7.1.3, "The
 
8698
   MySQL Benchmark Suite." They are also required for the MySQL
 
8699
   Cluster ndb_size.pl utility; see Section 16.4.21, "ndb_size.pl ---
 
8700
   NDBCLUSTER Size Requirement Estimator."
 
8701
   Note
8020
8702
 
8021
8703
   Perl support is not included with MySQL distributions. You can
8022
8704
   obtain the necessary modules from http://search.cpan.org for Unix,
8023
8705
   or by using the ActiveState ppm program on Windows. The following
8024
8706
   sections describe how to do this.
8025
8707
 
8026
 
   Perl support for MySQL must be installed if you want to run the
8027
 
   MySQL benchmark scripts; see Section 7.1.3, "The MySQL Benchmark
8028
 
   Suite." It is also required for the MySQL Cluster ndb_size.pl
8029
 
   utility; see Section 17.4.21, "ndb_size.pl --- NDBCLUSTER Size
8030
 
   Requirement Estimator."
 
8708
   The DBI/DBD interface requires Perl 5.6.0, and 5.6.1 or later is
 
8709
   preferred. DBI does not work if you have an older version of Perl.
 
8710
   You should use DBD::mysql 4.009 or higher. Although earlier
 
8711
   versions are available, they do not support the full functionality
 
8712
   of MySQL 5.1.
8031
8713
 
8032
8714
2.15.1. Installing Perl on Unix
8033
8715
 
8034
8716
   MySQL Perl support requires that you have installed MySQL client
8035
8717
   programming support (libraries and header files). Most
8036
 
   installation methods install the necessary files. However, if you
8037
 
   installed MySQL from RPM files on Linux, be sure that you've
8038
 
   installed the developer RPM. The client programs are in the client
8039
 
   RPM, but client programming support is in the developer RPM.
 
8718
   installation methods install the necessary files. If you install
 
8719
   MySQL from RPM files on Linux, be sure to install the developer
 
8720
   RPM as well. The client programs are in the client RPM, but client
 
8721
   programming support is in the developer RPM.
8040
8722
 
8041
 
   If you want to install Perl support, the files you need can be
8042
 
   obtained from the CPAN (Comprehensive Perl Archive Network) at
8043
 
   http://search.cpan.org.
 
8723
   The files you need for Perl support can be obtained from the CPAN
 
8724
   (Comprehensive Perl Archive Network) at http://search.cpan.org.
8044
8725
 
8045
8726
   The easiest way to install Perl modules on Unix is to use the CPAN
8046
8727
   module. For example:
8084
8765
   server must be running or the test fails.
8085
8766
 
8086
8767
   It is a good idea to rebuild and reinstall the DBD::mysql
8087
 
   distribution whenever you install a new release of MySQL,
8088
 
   particularly if you notice symptoms such as that all your DBI
8089
 
   scripts fail after you upgrade MySQL.
 
8768
   distribution whenever you install a new release of MySQL. This
 
8769
   ensures that the latest versions of the MySQL client libraries are
 
8770
   installed correctly.
8090
8771
 
8091
8772
   If you do not have access rights to install Perl modules in the
8092
8773
   system directory or if you want to install local Perl modules, the
8106
8787
       http://www.activestate.com/Products/ActivePerl/ and install
8107
8788
       it.
8108
8789
 
8109
 
    2. Open a console window (a "DOS window").
 
8790
    2. Open a console window.
8110
8791
 
8111
8792
    3. If necessary, set the HTTP_proxy variable. For example, you
8112
8793
       might try a setting like this:
8113
 
set HTTP_proxy=my.proxy.com:3128
 
8794
C:\> set HTTP_proxy=my.proxy.com:3128
8114
8795
 
8115
8796
    4. Start the PPM program:
8116
8797
C:\> C:\perl\bin\ppm.pl
8124
8805
   This procedure should work with ActiveState Perl 5.6 or newer.
8125
8806
 
8126
8807
   If you cannot get the procedure to work, you should install the
8127
 
   MyODBC driver instead and connect to the MySQL server through
8128
 
   ODBC:
 
8808
   ODBC driver instead and connect to the MySQL server through ODBC:
8129
8809
use DBI;
8130
8810
$dbh= DBI->connect("DBI:ODBC:$dsn",$user,$password) ||
8131
8811
  die "Got error $DBI::errstr when connecting to $dsn\n";
8137
8817
   libmysqlclient.so shared library. You should be able to fix this
8138
8818
   problem by one of the following methods:
8139
8819
 
8140
 
     * Compile the DBD::mysql distribution with perl Makefile.PL
8141
 
       -static -config rather than perl Makefile.PL.
8142
 
 
8143
8820
     * Copy libmysqlclient.so to the directory where your other
8144
8821
       shared libraries are located (probably /usr/lib or /lib).
8145
8822
 
8193
8870
 
8194
8871
   After this, you must run make realclean and then proceed with the
8195
8872
   installation from the beginning.
8196
 
 
8197
 
   If you want to install DBI on SCO, you have to edit the Makefile
8198
 
   in DBI-xxx and each subdirectory. Note that the following assumes
8199
 
   gcc 2.95.2 or newer:
8200
 
OLD:                                  NEW:
8201
 
CC = cc                               CC = gcc
8202
 
CCCDLFLAGS = -KPIC -W1,-Bexport       CCCDLFLAGS = -fpic
8203
 
CCDLFLAGS = -wl,-Bexport              CCDLFLAGS =
8204
 
 
8205
 
LD = ld                               LD = gcc -G -fpic
8206
 
LDDLFLAGS = -G -L/usr/local/lib       LDDLFLAGS = -L/usr/local/lib
8207
 
LDFLAGS = -belf -L/usr/local/lib      LDFLAGS = -L/usr/local/lib
8208
 
 
8209
 
LD = ld                               LD = gcc -G -fpic
8210
 
OPTIMISE = -Od                        OPTIMISE = -O1
8211
 
 
8212
 
OLD:
8213
 
CCCFLAGS = -belf -dy -w0 -U M_XENIX -DPERL_SCO5 -I/usr/local/include
8214
 
 
8215
 
NEW:
8216
 
CCFLAGS = -U M_XENIX -DPERL_SCO5 -I/usr/local/include
8217
 
 
8218
 
   These changes are necessary because the Perl dynaloader does not
8219
 
   load the DBI modules if they were compiled with icc or cc.
8220
 
 
8221
 
   If you want to use the Perl module on a system that does not
8222
 
   support dynamic linking (such as SCO), you can generate a static
8223
 
   version of Perl that includes DBI and DBD::mysql. The way this
8224
 
   works is that you generate a version of Perl with the DBI code
8225
 
   linked in and install it on top of your current Perl. Then you use
8226
 
   that to build a version of Perl that additionally has the DBD code
8227
 
   linked in, and install that.
8228
 
 
8229
 
   On SCO, you must have the following environment variables set:
8230
 
LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/usr/progressive/lib
8231
 
 
8232
 
   Or:
8233
 
LD_LIBRARY_PATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:\
8234
 
    /usr/progressive/lib:/usr/skunk/lib
8235
 
LIBPATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:\
8236
 
    /usr/progressive/lib:/usr/skunk/lib
8237
 
MANPATH=scohelp:/usr/man:/usr/local1/man:/usr/local/man:\
8238
 
    /usr/skunk/man:
8239
 
 
8240
 
   First, create a Perl that includes a statically linked DBI module
8241
 
   by running these commands in the directory where your DBI
8242
 
   distribution is located:
8243
 
shell> perl Makefile.PL -static -config
8244
 
shell> make
8245
 
shell> make install
8246
 
shell> make perl
8247
 
 
8248
 
   Then you must install the new Perl. The output of make perl
8249
 
   indicates the exact make command you need to execute to perform
8250
 
   the installation. On SCO, this is make -f Makefile.aperl inst_perl
8251
 
   MAP_TARGET=perl.
8252
 
 
8253
 
   Next, use the just-created Perl to create another Perl that also
8254
 
   includes a statically linked DBD::mysql by running these commands
8255
 
   in the directory where your DBD::mysql distribution is located:
8256
 
shell> perl Makefile.PL -static -config
8257
 
shell> make
8258
 
shell> make install
8259
 
shell> make perl
8260
 
 
8261
 
   Finally, you should install this new Perl. Again, the output of
8262
 
   make perl indicates the command to use.