You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8243 lines
366 KiB

  1. Chapter 2. Installing and Upgrading MySQL
  2. This chapter describes how to obtain and install MySQL. A summary
  3. of the procedure follows and later sections provide the details.
  4. If you plan to upgrade an existing version of MySQL to a newer
  5. version rather than install MySQL for the first time, see Section
  6. 2.4.1, "Upgrading MySQL," for information about upgrade procedures
  7. and about issues that you should consider before upgrading.
  8. If you are interested in migrating to MySQL from another database
  9. system, you may wish to read Section A.8, "MySQL 5.1 FAQ ---
  10. Migration," which contains answers to some common questions
  11. concerning migration issues.
  12. 1. Determine whether MySQL runs and is supported on your
  13. platform.
  14. Please note that not all platforms are equally suitable for
  15. running MySQL, and that not all platforms on which MySQL is
  16. known to run are officially supported by Oracle Corporation:
  17. 2. Choose which distribution to install.
  18. Several versions of MySQL are available, and most are
  19. available in several distribution formats. You can choose from
  20. pre-packaged distributions containing binary (precompiled)
  21. programs or source code. When in doubt, use a binary
  22. distribution. We also provide public access to our current
  23. source tree for those who want to see our most recent
  24. developments and help us test new code. To determine which
  25. version and type of distribution you should use, see Section
  26. 2.1.2, "Choosing Which MySQL Distribution to Install."
  27. 3. Download the distribution that you want to install.
  28. For instructions, see Section 2.1.3, "How to Get MySQL." To
  29. verify the integrity of the distribution, use the instructions
  30. in Section 2.1.4, "Verifying Package Integrity Using MD5
  31. Checksums or GnuPG."
  32. 4. Install the distribution.
  33. To install MySQL from a binary distribution, use the
  34. instructions in Section 2.2, "Installing MySQL from Generic
  35. Binaries on Unix/Linux."
  36. To install MySQL from a source distribution or from the
  37. current development source tree, use the instructions in
  38. Section 2.3, "MySQL Installation Using a Source Distribution."
  39. 5. Perform any necessary post-installation setup.
  40. After installing MySQL, read Section 2.13, "Post-Installation
  41. Setup and Testing." This section contains important
  42. information about making sure the MySQL server is working
  43. properly. It also describes how to secure the initial MySQL
  44. user accounts, which have no passwords until you assign
  45. passwords. The section applies whether you install MySQL using
  46. a binary or source distribution.
  47. 6. If you want to run the MySQL benchmark scripts, Perl support
  48. for MySQL must be available. See Section 2.15, "Perl
  49. Installation Notes."
  50. 2.1. General Installation Guidance
  51. The immediately following sections contain the information
  52. necessary to choose, download, and verify your distribution. The
  53. instructions in later sections of the chapter describe how to
  54. install the distribution that you choose. For binary
  55. distributions, see the instructions at Section 2.2, "Installing
  56. MySQL from Generic Binaries on Unix/Linux" or the corresponding
  57. section for your platform if available. To build MySQL from
  58. source, use the instructions in Section 2.3, "MySQL Installation
  59. Using a Source Distribution."
  60. 2.1.1. Operating Systems Supported by MySQL Community Server
  61. This section lists the operating systems on which MySQL Community
  62. Server is known to run.
  63. Important
  64. Oracle Corporation does not necessarily provide official support
  65. for all the platforms listed in this section. For information
  66. about those platforms that are officially supported, see
  67. http://www.mysql.com/support/supportedplatforms.html on the MySQL
  68. Web site.
  69. We use GNU Autoconf, so it is possible to port MySQL to all modern
  70. systems that have a C++ compiler and a working implementation of
  71. POSIX threads. (Thread support is needed for the server. To
  72. compile only the client code, the only requirement is a C++
  73. compiler.)
  74. MySQL has been reported to compile successfully on the following
  75. combinations of operating system and thread package.
  76. * AIX 4.x, 5.x with native threads. See Section 2.12,
  77. "Installing MySQL on AIX." AIX 5.3 should be upgraded to
  78. technology level 7 (5300-07).
  79. * FreeBSD 5.x and up with native threads. See Section 2.10,
  80. "Installing MySQL on FreeBSD."
  81. * HP-UX 11.x with the native threads. See Section 2.11,
  82. "Installing MySQL on HP-UX."
  83. * Linux, builds on all fairly recent Linux distributions with
  84. glibc 2.3. See Section 2.6, "Installing MySQL on Linux."
  85. * Mac OS X. See Section 2.7, "Installing MySQL on Mac OS X."
  86. * Solaris 2.8 on SPARC and x86, including support for native
  87. threads. See Section 2.8.1, "Solaris Notes."
  88. * Windows 2000, Windows XP, Windows Vista, Windows Server 2003,
  89. and Windows Server 2008. See Section 2.5, "Installing MySQL on
  90. Windows."
  91. MySQL has also been known to run on other systems in the past. See
  92. Section 2.1, "General Installation Guidance." Some porting effort
  93. might be required for current versions of MySQL on these systems.
  94. Not all platforms are equally well-suited for running MySQL. How
  95. well a certain platform is suited for a high-load mission-critical
  96. MySQL server is determined by the following factors:
  97. * General stability of the thread library. A platform may have
  98. an excellent reputation otherwise, but MySQL is only as stable
  99. as the thread library it calls, even if everything else is
  100. perfect.
  101. * The capability of the kernel and the thread library to take
  102. advantage of symmetric multi-processor (SMP) systems. In other
  103. words, when a process creates a thread, it should be possible
  104. for that thread to run on a CPU different from the original
  105. process.
  106. * The capability of the kernel and the thread library to run
  107. many threads that acquire and release a mutex over a short
  108. critical region frequently without excessive context switches.
  109. If the implementation of pthread_mutex_lock() is too anxious
  110. to yield CPU time, this hurts MySQL tremendously. If this
  111. issue is not taken care of, adding extra CPUs actually makes
  112. MySQL slower.
  113. * General file system stability and performance.
  114. * Table size. If your tables are large, performance is affected
  115. by the ability of the file system to deal with large files and
  116. dealing with them efficiently.
  117. * Our level of expertise here at Oracle Corporation with the
  118. platform. If we know a platform well, we enable
  119. platform-specific optimizations and fixes at compile time. We
  120. can also provide advice on configuring your system optimally
  121. for MySQL.
  122. * The amount of testing we have done internally for similar
  123. configurations.
  124. * The number of users that have run MySQL successfully on the
  125. platform in similar configurations. If this number is high,
  126. the likelihood of encountering platform-specific surprises is
  127. much smaller.
  128. 2.1.2. Choosing Which MySQL Distribution to Install
  129. When preparing to install MySQL, you should decide which version
  130. to use. MySQL development occurs in several release series, and
  131. you can pick the one that best fits your needs. After deciding
  132. which version to install, you can choose a distribution format.
  133. Releases are available in binary or source format.
  134. 2.1.2.1. Choosing Which Version of MySQL to Install
  135. The first decision to make is whether you want to use a production
  136. (stable) release or a development release. In the MySQL
  137. development process, multiple release series co-exist, each at a
  138. different stage of maturity:
  139. * MySQL 5.5 is the current development release series.
  140. * MySQL 5.1 is the current General Availability (Production)
  141. release series. New releases are issued for bugfixes only; no
  142. new features are being added that could affect stability.
  143. * MySQL 5.0 is the previous stable (production-quality) release
  144. series. MySQL 5.0 is now at the end of the product lifecycle.
  145. Active development and support for this version has ended.
  146. Extended support for MySQL 5.0 remains available. According to
  147. the http://www.mysql.com/about/legal/lifecycle/, only Security
  148. and Severity Level 1 issues are still being fixed for MySQL
  149. 5.0.
  150. * MySQL 4.1, 4.0, and 3.23 are old stable (production-quality)
  151. release series. Active development and support for these
  152. versions has ended.
  153. We do not believe in a complete code freeze because this prevents
  154. us from making bugfixes and other fixes that must be done. By
  155. "somewhat frozen" we mean that we may add small things that should
  156. not affect anything that currently works in a production release.
  157. Naturally, relevant bugfixes from an earlier series propagate to
  158. later series.
  159. Normally, if you are beginning to use MySQL for the first time or
  160. trying to port it to some system for which there is no binary
  161. distribution, go with the General Availability release series.
  162. Currently, this is MySQL 5.1. All MySQL releases, even those from
  163. development series, are checked with the MySQL benchmarks and an
  164. extensive test suite before being issued.
  165. If you are running an older system and want to upgrade, but do not
  166. want to take the chance of having a nonseamless upgrade, you
  167. should upgrade to the latest version in the same release series
  168. you are using (where only the last part of the version number is
  169. newer than yours). We have tried to fix only fatal bugs and make
  170. only small, relatively "safe" changes to that version.
  171. If you want to use new features not present in the production
  172. release series, you can use a version from a development series.
  173. Note that development releases are not as stable as production
  174. releases.
  175. If you want to use the very latest sources containing all current
  176. patches and bugfixes, you can use one of our Bazaar repositories.
  177. These are not "releases" as such, but are available as previews of
  178. the code on which future releases are to be based.
  179. The MySQL naming scheme uses release names that consist of three
  180. numbers and a suffix; for example, mysql-5.0.14-rc. The numbers
  181. within the release name are interpreted as follows:
  182. * The first number (5) is the major version and describes the
  183. file format. All MySQL 5 releases have the same file format.
  184. * The second number (0) is the release level. Taken together,
  185. the major version and release level constitute the release
  186. series number.
  187. * The third number (14) is the version number within the release
  188. series. This is incremented for each new release. Usually you
  189. want the latest version for the series you have chosen.
  190. For each minor update, the last number in the version string is
  191. incremented. When there are major new features or minor
  192. incompatibilities with previous versions, the second number in the
  193. version string is incremented. When the file format changes, the
  194. first number is increased.
  195. Release names also include a suffix to indicates the stability
  196. level of the release. Releases within a series progress through a
  197. set of suffixes to indicate how the stability level improves. The
  198. possible suffixes are:
  199. * alpha indicates that the release is for preview purposes only.
  200. Known bugs should be documented in the News section (see
  201. Appendix C, "MySQL Change History"). Most alpha releases
  202. implement new commands and extensions. Active development that
  203. may involve major code changes can occur in an alpha release.
  204. However, we do conduct testing before issuing a release.
  205. * beta indicates that the release is appropriate for use with
  206. new development. Within beta releases, the features and
  207. compatibility should remain consistent. However, beta releases
  208. may contain numerous and major unaddressed bugs.
  209. All APIs, externally visible structures, and columns for SQL
  210. statements will not change during future beta, release
  211. candidate, or production releases.
  212. * rc indicates a Release Candidate. Release candidates are
  213. believed to be stable, having passed all of MySQL's internal
  214. testing, and with all known fatal runtime bugs fixed. However,
  215. the release has not been in widespread use long enough to know
  216. for sure that all bugs have been identified. Only minor fixes
  217. are added. (A release candidate is what formerly was known as
  218. a gamma release.)
  219. * If there is no suffix, it indicates that the release is a
  220. General Availability (GA) or Production release. GA releases
  221. are stable, having successfully passed through all earlier
  222. release stages and are believed to be reliable, free of
  223. serious bugs, and suitable for use in production systems. Only
  224. critical bugfixes are applied to the release.
  225. MySQL uses a naming scheme that is slightly different from most
  226. other products. In general, it is usually safe to use any version
  227. that has been out for a couple of weeks without being replaced by
  228. a new version within the same release series.
  229. All releases of MySQL are run through our standard tests and
  230. benchmarks to ensure that they are relatively safe to use. Because
  231. the standard tests are extended over time to check for all
  232. previously found bugs, the test suite keeps getting better.
  233. All releases have been tested at least with these tools:
  234. * An internal test suite
  235. The mysql-test directory contains an extensive set of test
  236. cases. We run these tests for every server binary. See Section
  237. 22.1.2, "MySQL Test Suite," for more information about this
  238. test suite.
  239. * The MySQL benchmark suite
  240. This suite runs a range of common queries. It is also a test
  241. to determine whether the latest batch of optimizations
  242. actually made the code faster. See Section 7.1.3, "The MySQL
  243. Benchmark Suite."
  244. We also test the newest MySQL version in our internal production
  245. environment, on at least one machine. We have more than 100GB of
  246. data to work with.
  247. 2.1.2.2. Choosing a Distribution Format
  248. After choosing which version of MySQL to install, you should
  249. decide whether to use a binary distribution or a source
  250. distribution. In most cases, you should probably use a binary
  251. distribution, if one exists for your platform. Binary
  252. distributions are available in native format for many platforms,
  253. such as RPM files for Linux or PKG package installers for Mac OS X
  254. or Solaris. Distributions also are available as Zip archives or
  255. compressed tar files.
  256. Reasons to choose a binary distribution include the following:
  257. * Binary distributions generally are easier to install than
  258. source distributions.
  259. * To satisfy different user requirements, we provide several
  260. servers in binary distributions. mysqld is an optimized server
  261. that is a smaller, faster binary. mysqld-debug is compiled
  262. with debugging support.
  263. Each of these servers is compiled from the same source
  264. distribution, though with different configuration options. All
  265. native MySQL clients can connect to servers from either MySQL
  266. version.
  267. Under some circumstances, you may be better off installing MySQL
  268. from a source distribution:
  269. * You want to install MySQL at some explicit location. The
  270. standard binary distributions are ready to run at any
  271. installation location, but you might require even more
  272. flexibility to place MySQL components where you want.
  273. * You want to configure mysqld to ensure that features are
  274. available that might not be included in the standard binary
  275. distributions. Here is a list of the most common extra options
  276. that you may want to use to ensure feature availability:
  277. + --with-libwrap
  278. + --with-named-z-libs (this is done for some of the
  279. binaries)
  280. + --with-debug[=full]
  281. * You want to configure mysqld without some features that are
  282. included in the standard binary distributions. For example,
  283. distributions normally are compiled with support for all
  284. character sets. If you want a smaller MySQL server, you can
  285. recompile it with support for only the character sets you
  286. need.
  287. * You have a special compiler (such as pgcc) or want to use
  288. compiler options that are better optimized for your processor.
  289. Binary distributions are compiled with options that should
  290. work on a variety of processors from the same processor
  291. family.
  292. * You want to use the latest sources from one of the Bazaar
  293. repositories to have access to all current bugfixes. For
  294. example, if you have found a bug and reported it to the MySQL
  295. development team, the bugfix is committed to the source
  296. repository and you can access it there. The bugfix does not
  297. appear in a release until a release actually is issued.
  298. * You want to read (or modify) the C and C++ code that makes up
  299. MySQL. For this purpose, you should get a source distribution,
  300. because the source code is always the ultimate manual.
  301. * Source distributions contain more tests and examples than
  302. binary distributions.
  303. 2.1.2.3. How and When Updates Are Released
  304. MySQL is evolving quite rapidly and we want to share new
  305. developments with other MySQL users. We try to produce a new
  306. release whenever we have new and useful features that others also
  307. seem to have a need for.
  308. We also try to help users who request features that are easy to
  309. implement. We take note of what our licensed users want, and we
  310. especially take note of what our support customers want and try to
  311. help them in this regard.
  312. No one is required to download a new release. The News section
  313. helps you determine whether the new release has something you
  314. really want. See Appendix C, "MySQL Change History."
  315. We use the following policy when updating MySQL:
  316. * Enterprise Server releases are meant to appear every 18
  317. months, supplemented by quarterly service packs and monthly
  318. rapid updates. Community Server releases are meant to appear
  319. 2-3 times per year.
  320. * Releases are issued within each series. For each release, the
  321. last number in the version is one more than the previous
  322. release within the same series.
  323. * Binary distributions for some platforms are made by us for
  324. major releases. Other people may make binary distributions for
  325. other systems, but probably less frequently.
  326. * We make fixes available as soon as we have identified and
  327. corrected small or noncritical but annoying bugs. The fixes
  328. are available in source form immediately from our public
  329. Bazaar repositories, and are included in the next release.
  330. * If by any chance a security vulnerability or critical bug is
  331. found in a release, our policy is to fix it in a new release
  332. as soon as possible. (We would like other companies to do
  333. this, too!)
  334. 2.1.3. How to Get MySQL
  335. Check our downloads page at http://dev.mysql.com/downloads/ for
  336. information about the current version of MySQL and for downloading
  337. instructions. For a complete up-to-date list of MySQL download
  338. mirror sites, see http://dev.mysql.com/downloads/mirrors.html. You
  339. can also find information there about becoming a MySQL mirror site
  340. and how to report a bad or out-of-date mirror.
  341. Our main mirror is located at http://mirrors.sunsite.dk/mysql/.
  342. 2.1.4. Verifying Package Integrity Using MD5 Checksums or GnuPG
  343. After you have downloaded the MySQL package that suits your needs
  344. and before you attempt to install it, you should make sure that it
  345. is intact and has not been tampered with. There are three means of
  346. integrity checking:
  347. * MD5 checksums
  348. * Cryptographic signatures using GnuPG, the GNU Privacy Guard
  349. * For RPM packages, the built-in RPM integrity verification
  350. mechanism
  351. The following sections describe how to use these methods.
  352. If you notice that the MD5 checksum or GPG signatures do not
  353. match, first try to download the respective package one more time,
  354. perhaps from another mirror site. If you repeatedly cannot
  355. successfully verify the integrity of the package, please notify us
  356. about such incidents, including the full package name and the
  357. download site you have been using, at webmaster@mysql.com or
  358. build@mysql.com. Do not report downloading problems using the
  359. bug-reporting system.
  360. 2.1.4.1. Verifying the MD5 Checksum
  361. After you have downloaded a MySQL package, you should make sure
  362. that its MD5 checksum matches the one provided on the MySQL
  363. download pages. Each package has an individual checksum that you
  364. can verify with the following command, where package_name is the
  365. name of the package you downloaded:
  366. shell> md5sum package_name
  367. Example:
  368. shell> md5sum mysql-standard-5.1.46-linux-i686.tar.gz
  369. aaab65abbec64d5e907dcd41b8699945 mysql-standard-5.1.46-linux-i686.ta
  370. r.gz
  371. You should verify that the resulting checksum (the string of
  372. hexadecimal digits) matches the one displayed on the download page
  373. immediately below the respective package.
  374. Note
  375. Make sure to verify the checksum of the archive file (for example,
  376. the .zip or .tar.gz file) and not of the files that are contained
  377. inside of the archive.
  378. Note that not all operating systems support the md5sum command. On
  379. some, it is simply called md5, and others do not ship it at all.
  380. On Linux, it is part of the GNU Text Utilities package, which is
  381. available for a wide range of platforms. You can download the
  382. source code from http://www.gnu.org/software/textutils/ as well.
  383. If you have OpenSSL installed, you can use the command openssl md5
  384. package_name instead. A Windows implementation of the md5 command
  385. line utility is available from http://www.fourmilab.ch/md5/.
  386. winMd5Sum is a graphical MD5 checking tool that can be obtained
  387. from http://www.nullriver.com/index/products/winmd5sum.
  388. 2.1.4.2. Signature Checking Using GnuPG
  389. Another method of verifying the integrity and authenticity of a
  390. package is to use cryptographic signatures. This is more reliable
  391. than using MD5 checksums, but requires more work.
  392. We sign MySQL downloadable packages with GnuPG (GNU Privacy
  393. Guard). GnuPG is an Open Source alternative to the well-known
  394. Pretty Good Privacy (PGP) by Phil Zimmermann. See
  395. http://www.gnupg.org/ for more information about GnuPG and how to
  396. obtain and install it on your system. Most Linux distributions
  397. ship with GnuPG installed by default. For more information about
  398. GnuPG, see http://www.openpgp.org/.
  399. To verify the signature for a specific package, you first need to
  400. obtain a copy of our public GPG build key, which you can download
  401. from http://keyserver.pgp.com/. The key that you want to obtain is
  402. named build@mysql.com. Alternatively, you can cut and paste the
  403. key directly from the following text:
  404. -----BEGIN PGP PUBLIC KEY BLOCK-----
  405. Version: GnuPG v1.4.5 (GNU/Linux)
  406. mQGiBD4+owwRBAC14GIfUfCyEDSIePvEW3SAFUdJBtoQHH/nJKZyQT7h9bPlUWC3
  407. RODjQReyCITRrdwyrKUGku2FmeVGwn2u2WmDMNABLnpprWPkBdCk96+OmSLN9brZ
  408. fw2vOUgCmYv2hW0hyDHuvYlQA/BThQoADgj8AW6/0Lo7V1W9/8VuHP0gQwCgvzV3
  409. BqOxRznNCRCRxAuAuVztHRcEAJooQK1+iSiunZMYD1WufeXfshc57S/+yeJkegNW
  410. hxwR9pRWVArNYJdDRT+rf2RUe3vpquKNQU/hnEIUHJRQqYHo8gTxvxXNQc7fJYLV
  411. K2HtkrPbP72vwsEKMYhhr0eKCbtLGfls9krjJ6sBgACyP/Vb7hiPwxh6rDZ7ITnE
  412. kYpXBACmWpP8NJTkamEnPCia2ZoOHODANwpUkP43I7jsDmgtobZX9qnrAXw+uNDI
  413. QJEXM6FSbi0LLtZciNlYsafwAPEOMDKpMqAK6IyisNtPvaLd8lH0bPAnWqcyefep
  414. rv0sxxqUEMcM3o7wwgfN83POkDasDbs3pjwPhxvhz6//62zQJ7Q7TXlTUUwgUGFj
  415. a2FnZSBzaWduaW5nIGtleSAod3d3Lm15c3FsLmNvbSkgPGJ1aWxkQG15c3FsLmNv
  416. bT6IXQQTEQIAHQULBwoDBAMVAwIDFgIBAheABQJLcC5lBQkQ8/JZAAoJEIxxjTtQ
  417. cuH1oD4AoIcOQ4EoGsZvy06D0Ei5vcsWEy8dAJ4g46i3WEcdSWxMhcBSsPz65sh5
  418. lohMBBMRAgAMBQI+PqPRBYMJZgC7AAoJEElQ4SqycpHyJOEAn1mxHijft00bKXvu
  419. cSo/pECUmppiAJ41M9MRVj5VcdH/KN/KjRtW6tHFPYhMBBMRAgAMBQI+QoIDBYMJ
  420. YiKJAAoJELb1zU3GuiQ/lpEAoIhpp6BozKI8p6eaabzF5MlJH58pAKCu/ROofK8J
  421. Eg2aLos+5zEYrB/LsrkCDQQ+PqMdEAgA7+GJfxbMdY4wslPnjH9rF4N2qfWsEN/l
  422. xaZoJYc3a6M02WCnHl6ahT2/tBK2w1QI4YFteR47gCvtgb6O1JHffOo2HfLmRDRi
  423. Rjd1DTCHqeyX7CHhcghj/dNRlW2Z0l5QFEcmV9U0Vhp3aFfWC4Ujfs3LU+hkAWzE
  424. 7zaD5cH9J7yv/6xuZVw411x0h4UqsTcWMu0iM1BzELqX1DY7LwoPEb/O9Rkbf4fm
  425. Le11EzIaCa4PqARXQZc4dhSinMt6K3X4BrRsKTfozBu74F47D8Ilbf5vSYHbuE5p
  426. /1oIDznkg/p8kW+3FxuWrycciqFTcNz215yyX39LXFnlLzKUb/F5GwADBQf+Lwqq
  427. a8CGrRfsOAJxim63CHfty5mUc5rUSnTslGYEIOCR1BeQauyPZbPDsDD9MZ1ZaSaf
  428. anFvwFG6Llx9xkU7tzq+vKLoWkm4u5xf3vn55VjnSd1aQ9eQnUcXiL4cnBGoTbOW
  429. I39EcyzgslzBdC++MPjcQTcA7p6JUVsP6oAB3FQWg54tuUo0Ec8bsM8b3Ev42Lmu
  430. QT5NdKHGwHsXTPtl0klk4bQk4OajHsiy1BMahpT27jWjJlMiJc+IWJ0mghkKHt92
  431. 6s/ymfdf5HkdQ1cyvsz5tryVI3Fx78XeSYfQvuuwqp2H139pXGEkg0n6KdUOetdZ
  432. Whe70YGNPw1yjWJT1IhMBBgRAgAMBQI+PqMdBQkJZgGAAAoJEIxxjTtQcuH17p4A
  433. n3r1QpVC9yhnW2cSAjq+kr72GX0eAJ4295kl6NxYEuFApmr1+0uUq/SlsQ==
  434. =Mski
  435. -----END PGP PUBLIC KEY BLOCK-----
  436. To import the build key into your personal public GPG keyring, use
  437. gpg --import. For example, if you have saved the key in a file
  438. named mysql_pubkey.asc, the import command looks like this:
  439. shell> gpg --import mysql_pubkey.asc
  440. gpg: key 5072E1F5: public key "MySQL Package signing key (www.mysql.c
  441. om) <build@mysql.com>" imported
  442. gpg: Total number processed: 1
  443. gpg: imported: 1
  444. gpg: no ultimately trusted keys found
  445. You can also download the key from the public keyserver using the
  446. public key id, 5072E1F5:
  447. shell> gpg --recv-keys 5072E1F5
  448. gpg: requesting key 5072E1F5 from hkp server subkeys.pgp.net
  449. gpg: key 5072E1F5: "MySQL Package signing key (www.mysql.com) <build@
  450. mysql.com>" 2 new signatures
  451. gpg: no ultimately trusted keys found
  452. gpg: Total number processed: 1
  453. gpg: new signatures: 2
  454. If you want to import the key into your RPM configuration to
  455. validate RPM install packages, you should be able to import the
  456. key directly:
  457. shell> rpm --import mysql_pubkey.asc
  458. If you experience problems, try exporting the key from gpg and
  459. importing:
  460. shell> gpg --export -a 5072e1f5 > 5072e1f5.asc
  461. shell> rpm --import 5072e1f5.asc
  462. Alternatively, rpm also supports loading the key directly from a
  463. URL, and you cas use this manual page:
  464. shell> rpm --import http://dev.mysql.com/doc/refman/5.1/en/checking-g
  465. pg-signature.html
  466. After you have downloaded and imported the public build key,
  467. download your desired MySQL package and the corresponding
  468. signature, which also is available from the download page. The
  469. signature file has the same name as the distribution file with an
  470. .asc extension, as shown by the examples in the following table.
  471. Distribution file mysql-standard-5.1.46-linux-i686.tar.gz
  472. Signature file mysql-standard-5.1.46-linux-i686.tar.gz.asc
  473. Make sure that both files are stored in the same directory and
  474. then run the following command to verify the signature for the
  475. distribution file:
  476. shell> gpg --verify package_name.asc
  477. Example:
  478. shell> gpg --verify mysql-standard-5.1.46-linux-i686.tar.gz.asc
  479. gpg: Signature made Tue 12 Jul 2005 23:35:41 EST using DSA key ID 507
  480. 2E1F5
  481. gpg: Good signature from "MySQL Package signing key (www.mysql.com) <
  482. build@mysql.com>"
  483. The Good signature message indicates that everything is all right.
  484. You can ignore any insecure memory warning you might obtain.
  485. See the GPG documentation for more information on how to work with
  486. public keys.
  487. 2.1.4.3. Signature Checking Using RPM
  488. For RPM packages, there is no separate signature. RPM packages
  489. have a built-in GPG signature and MD5 checksum. You can verify a
  490. package by running the following command:
  491. shell> rpm --checksig package_name.rpm
  492. Example:
  493. shell> rpm --checksig MySQL-server-5.1.46-0.glibc23.i386.rpm
  494. MySQL-server-5.1.46-0.glibc23.i386.rpm: md5 gpg OK
  495. Note
  496. If you are using RPM 4.1 and it complains about (GPG) NOT OK
  497. (MISSING KEYS: GPG#5072e1f5), even though you have imported the
  498. MySQL public build key into your own GPG keyring, you need to
  499. import the key into the RPM keyring first. RPM 4.1 no longer uses
  500. your personal GPG keyring (or GPG itself). Rather, it maintains
  501. its own keyring because it is a system-wide application and a
  502. user's GPG public keyring is a user-specific file. To import the
  503. MySQL public key into the RPM keyring, first obtain the key as
  504. described in Section 2.1.4.2, "Signature Checking Using GnuPG."
  505. Then use rpm --import to import the key. For example, if you have
  506. saved the public key in a file named mysql_pubkey.asc, import it
  507. using this command:
  508. shell> rpm --import mysql_pubkey.asc
  509. If you need to obtain the MySQL public key, see Section 2.1.4.2,
  510. "Signature Checking Using GnuPG."
  511. 2.1.5. Installation Layouts
  512. This section describes the default layout of the directories
  513. created by installing binary or source distributions provided by
  514. Oracle Corporation. A distribution provided by another vendor
  515. might use a layout different from those shown here.
  516. Installations created from our Linux RPM distributions result in
  517. files under the following system directories.
  518. Directory Contents of Directory
  519. /usr/bin Client programs and scripts
  520. /usr/sbin The mysqld server
  521. /var/lib/mysql Log files, databases
  522. /usr/share/info Manual in Info format
  523. /usr/share/man Unix manual pages
  524. /usr/include/mysql Include (header) files
  525. /usr/lib/mysql Libraries
  526. /usr/share/mysql Error message and character set files
  527. /usr/share/sql-bench Benchmarks
  528. On Unix, a tar file binary distribution is installed by unpacking
  529. it at the installation location you choose (typically
  530. /usr/local/mysql) and creates the following directories in that
  531. location.
  532. Directory Contents of Directory
  533. bin Client programs and the mysqld server
  534. data Log files, databases
  535. docs Manual in Info format
  536. man Unix manual pages
  537. include Include (header) files
  538. lib Libraries
  539. scripts mysql_install_db
  540. share/mysql Error message files
  541. sql-bench Benchmarks
  542. A source distribution is installed after you configure and compile
  543. it. By default, the installation step installs files under
  544. /usr/local, in the following subdirectories.
  545. Directory Contents of Directory
  546. bin Client programs and scripts
  547. include/mysql Include (header) files
  548. Docs Manual in Info, CHM formats
  549. man Unix manual pages
  550. lib/mysql Libraries
  551. libexec The mysqld server
  552. share/mysql Error message files
  553. sql-bench Benchmarks and crash-me test
  554. var Databases and log files
  555. Within its installation directory, the layout of a source
  556. installation differs from that of a binary installation in the
  557. following ways:
  558. * The mysqld server is installed in the libexec directory rather
  559. than in the bin directory.
  560. * The data directory is var rather than data.
  561. * mysql_install_db is installed in the bin directory rather than
  562. in the scripts directory.
  563. * The header file and library directories are include/mysql and
  564. lib/mysql rather than include and lib.
  565. You can create your own binary installation from a compiled source
  566. distribution by executing the scripts/make_binary_distribution
  567. script from the top directory of the source distribution.
  568. 2.2. Installing MySQL from Generic Binaries on Unix/Linux
  569. This section covers the installation of MySQL binary distributions
  570. that are provided for various platforms in the form of compressed
  571. tar files (files with a .tar.gz extension).
  572. To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
  573. Sun Microsystems, Inc. provides a set of binary distributions of
  574. MySQL. In addition to binaries provided in platform-specific
  575. package formats, we offer binary distributions for a number of
  576. platforms in the form of compressed tar files (.tar.gz files). For
  577. Windows distributions, see Section 2.5, "Installing MySQL on
  578. Windows."
  579. If you want to compile a debug version of MySQL from a source
  580. distribution, you should add --with-debug or --with-debug=full to
  581. the configure command used to configure the distribution and
  582. remove any -fomit-frame-pointer options.
  583. MySQL tar file binary distributions have names of the form
  584. mysql-VERSION-OS.tar.gz, where VERSION is a number (for example,
  585. 5.1.46), and OS indicates the type of operating system for which
  586. the distribution is intended (for example, pc-linux-i686).
  587. In addition to these generic packages, we also offer binaries in
  588. platform-specific package formats for selected platforms. See the
  589. platform specific sections for more information, for more
  590. information on how to install these.
  591. You need the following tools to install a MySQL tar file binary
  592. distribution:
  593. * GNU gunzip to uncompress the distribution.
  594. * A reasonable tar to unpack the distribution. GNU tar is known
  595. to work. Some operating systems come with a preinstalled
  596. version of tar that is known to have problems. For example,
  597. the tar provided with early versions of Mac OS X, SunOS 4.x,
  598. Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX
  599. are known to have problems with long file names. On Mac OS X,
  600. you can use the preinstalled gnutar program. On Solaris 10 and
  601. OpenSolaris you can use the preinstalled gtar. On other
  602. systems with a deficient tar, you should install GNU tar
  603. first.
  604. If you run into problems and need to file a bug report, please use
  605. the instructions in Section 1.7, "How to Report Bugs or Problems."
  606. The basic commands that you must execute to install and use a
  607. MySQL binary distribution are:
  608. shell> groupadd mysql
  609. shell> useradd -g mysql mysql
  610. shell> cd /usr/local
  611. shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
  612. shell> ln -s full-path-to-mysql-VERSION-OS mysql
  613. shell> cd mysql
  614. shell> chown -R mysql .
  615. shell> chgrp -R mysql .
  616. shell> scripts/mysql_install_db --user=mysql
  617. shell> chown -R root .
  618. shell> chown -R mysql data
  619. shell> bin/mysqld_safe --user=mysql &
  620. Note
  621. This procedure does not set up any passwords for MySQL accounts.
  622. After following the procedure, proceed to Section 2.13,
  623. "Post-Installation Setup and Testing."
  624. A more detailed version of the preceding description for
  625. installing a binary distribution follows:
  626. 1. Add a login user and group for mysqld to run as:
  627. shell> groupadd mysql
  628. shell> useradd -g mysql mysql
  629. These commands add the mysql group and the mysql user. The
  630. syntax for useradd and groupadd may differ slightly on
  631. different versions of Unix, or they may have different names
  632. such as adduser and addgroup.
  633. You might want to call the user and group something else
  634. instead of mysql. If so, substitute the appropriate name in
  635. the following steps.
  636. 2. Pick the directory under which you want to unpack the
  637. distribution and change location into it. In the following
  638. example, we unpack the distribution under /usr/local. (The
  639. instructions, therefore, assume that you have permission to
  640. create files and directories in /usr/local. If that directory
  641. is protected, you must perform the installation as root.)
  642. shell> cd /usr/local
  643. 3. Obtain a distribution file using the instructions in Section
  644. 2.1.3, "How to Get MySQL." For a given release, binary
  645. distributions for all platforms are built from the same MySQL
  646. source distribution.
  647. 4. Unpack the distribution, which creates the installation
  648. directory. Then create a symbolic link to that directory:
  649. shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
  650. shell> ln -s full-path-to-mysql-VERSION-OS mysql
  651. The tar command creates a directory named mysql-VERSION-OS.
  652. The ln command makes a symbolic link to that directory. This
  653. lets you refer more easily to the installation directory as
  654. /usr/local/mysql.
  655. With GNU tar, no separate invocation of gunzip is necessary.
  656. You can replace the first line with the following alternative
  657. command to uncompress and extract the distribution:
  658. shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
  659. 5. Change location into the installation directory:
  660. shell> cd mysql
  661. You will find several files and subdirectories in the mysql
  662. directory. The most important for installation purposes are
  663. the bin and scripts subdirectories:
  664. + The bin directory contains client programs and the
  665. server. You should add the full path name of this
  666. directory to your PATH environment variable so that your
  667. shell finds the MySQL programs properly. See Section
  668. 2.14, "Environment Variables."
  669. + The scripts directory contains the mysql_install_db
  670. script used to initialize the mysql database containing
  671. the grant tables that store the server access
  672. permissions.
  673. 6. Ensure that the distribution contents are accessible to mysql.
  674. If you unpacked the distribution as mysql, no further action
  675. is required. If you unpacked the distribution as root, its
  676. contents will be owned by root. Change its ownership to mysql
  677. by executing the following commands as root in the
  678. installation directory:
  679. shell> chown -R mysql .
  680. shell> chgrp -R mysql .
  681. The first command changes the owner attribute of the files to
  682. the mysql user. The second changes the group attribute to the
  683. mysql group.
  684. 7. If you have not installed MySQL before, you must create the
  685. MySQL data directory and initialize the grant tables:
  686. shell> scripts/mysql_install_db --user=mysql
  687. If you run the command as root, include the --user option as
  688. shown. If you run the command while logged in as that user,
  689. you can omit the --user option.
  690. The command should create the data directory and its contents
  691. with mysql as the owner.
  692. After creating or updating the grant tables, you need to
  693. restart the server manually.
  694. 8. Most of the MySQL installation can be owned by root if you
  695. like. The exception is that the data directory must be owned
  696. by mysql. To accomplish this, run the following commands as
  697. root in the installation directory:
  698. shell> chown -R root .
  699. shell> chown -R mysql data
  700. 9. If you want MySQL to start automatically when you boot your
  701. machine, you can copy support-files/mysql.server to the
  702. location where your system has its startup files. More
  703. information can be found in the support-files/mysql.server
  704. script itself and in Section 2.13.1.2, "Starting and Stopping
  705. MySQL Automatically."
  706. 10. You can set up new accounts using the bin/mysql_setpermission
  707. script if you install the DBI and DBD::mysql Perl modules. See
  708. Section 4.6.14, "mysql_setpermission --- Interactively Set
  709. Permissions in Grant Tables." For Perl module installation
  710. instructions, see Section 2.15, "Perl Installation Notes."
  711. 11. If you would like to use mysqlaccess and have the MySQL
  712. distribution in some nonstandard location, you must change the
  713. location where mysqlaccess expects to find the mysql client.
  714. Edit the bin/mysqlaccess script at approximately line 18.
  715. Search for a line that looks like this:
  716. $MYSQL = '/usr/local/bin/mysql'; # path to mysql executable
  717. Change the path to reflect the location where mysql actually
  718. is stored on your system. If you do not do this, a Broken pipe
  719. error will occur when you run mysqlaccess.
  720. After everything has been unpacked and installed, you should test
  721. your distribution. To start the MySQL server, use the following
  722. command:
  723. shell> bin/mysqld_safe --user=mysql &
  724. If you run the command as root, you must use the --user option as
  725. shown. The value of the option is the name of the login account
  726. that you created in the first step to use for running the server.
  727. If you run the command while logged in as mysql, you can omit the
  728. --user option.
  729. If the command fails immediately and prints mysqld ended, you can
  730. find some information in the host_name.err file in the data
  731. directory.
  732. More information about mysqld_safe is given in Section 4.3.2,
  733. "mysqld_safe --- MySQL Server Startup Script."
  734. Note
  735. The accounts that are listed in the MySQL grant tables initially
  736. have no passwords. After starting the server, you should set up
  737. passwords for them using the instructions in Section 2.13,
  738. "Post-Installation Setup and Testing."
  739. 2.3. MySQL Installation Using a Source Distribution
  740. Before you proceed with an installation from source, first check
  741. whether our binary is available for your platform and whether it
  742. works for you. We put a great deal of effort into ensuring that
  743. our binaries are built with the best possible options.
  744. To obtain a source distribution for MySQL, Section 2.1.3, "How to
  745. Get MySQL." If you want to build MySQL from source on Windows, see
  746. Section 2.5.10, "Installing MySQL from Source on Windows."
  747. MySQL source distributions are provided as compressed tar archives
  748. and have names of the form mysql-VERSION.tar.gz, where VERSION is
  749. a number like 5.1.46.
  750. You need the following tools to build and install MySQL from
  751. source:
  752. * GNU gunzip to uncompress the distribution.
  753. * A reasonable tar to unpack the distribution. GNU tar is known
  754. to work. Some operating systems come with a preinstalled
  755. version of tar that is known to have problems. For example,
  756. the tar provided with early versions of Mac OS X, SunOS 4.x,
  757. Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX
  758. are known to have problems with long file names. On Mac OS X,
  759. you can use the preinstalled gnutar program. On Solaris 10 and
  760. OpenSolaris you can use the preinstalled gtar. On other
  761. systems with a deficient tar, you should install GNU tar
  762. first.
  763. * A working ANSI C++ compiler. GCC 3.2 or later, Sun Studio 10
  764. or later, Visual Studio 2005 or later, and many current
  765. vendor-supplied compilers are known to work.
  766. * A good make program. GNU make is always recommended and is
  767. sometimes required. (BSD make fails, and vendor-provided make
  768. implementations may fail as well.) If you have problems, use
  769. GNU make 3.75 or newer.
  770. * libtool 1.5.24 or later is also recommended.
  771. If you are using a version of gcc recent enough to understand the
  772. -fno-exceptions option, it is very important that you use this
  773. option. Otherwise, you may compile a binary that crashes randomly.
  774. Also use -felide-constructors and -fno-rtti along with
  775. -fno-exceptions. When in doubt, do the following:
  776. CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
  777. -fno-exceptions -fno-rtti" ./configure \
  778. --prefix=/usr/local/mysql --enable-assembler \
  779. --with-mysqld-ldflags=-all-static
  780. On most systems, this gives you a fast and stable binary.
  781. If you run into problems and need to file a bug report, please use
  782. the instructions in Section 1.7, "How to Report Bugs or Problems."
  783. 2.3.1. Source Installation Overview
  784. The basic commands that you must execute to install a MySQL source
  785. distribution are:
  786. shell> groupadd mysql
  787. shell> useradd -g mysql mysql
  788. shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
  789. shell> cd mysql-VERSION
  790. shell> ./configure --prefix=/usr/local/mysql
  791. shell> make
  792. shell> make install
  793. shell> cp support-files/my-medium.cnf /etc/my.cnf
  794. shell> cd /usr/local/mysql
  795. shell> chown -R mysql .
  796. shell> chgrp -R mysql .
  797. shell> bin/mysql_install_db --user=mysql
  798. shell> chown -R root .
  799. shell> chown -R mysql var
  800. shell> bin/mysqld_safe --user=mysql &
  801. If you start from a source RPM, do the following:
  802. shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm
  803. This makes a binary RPM that you can install. For older versions
  804. of RPM, you may have to replace the command rpmbuild with rpm
  805. instead.
  806. Note
  807. This procedure does not set up any passwords for MySQL accounts.
  808. After following the procedure, proceed to Section 2.13,
  809. "Post-Installation Setup and Testing," for post-installation setup
  810. and testing.
  811. A more detailed version of the preceding description for
  812. installing MySQL from a source distribution follows:
  813. 1. Add a login user and group for mysqld to run as:
  814. shell> groupadd mysql
  815. shell> useradd -g mysql mysql
  816. These commands add the mysql group and the mysql user. The
  817. syntax for useradd and groupadd may differ slightly on
  818. different versions of Unix, or they may have different names
  819. such as adduser and addgroup.
  820. You might want to call the user and group something else
  821. instead of mysql. If so, substitute the appropriate name in
  822. the following steps.
  823. 2. Perform the following steps as the mysql user, except as
  824. noted.
  825. 3. Pick the directory under which you want to unpack the
  826. distribution and change location into it.
  827. 4. Obtain a distribution file using the instructions in Section
  828. 2.1.3, "How to Get MySQL."
  829. 5. Unpack the distribution into the current directory:
  830. shell> gunzip < /path/to/mysql-VERSION.tar.gz | tar xvf -
  831. This command creates a directory named mysql-VERSION.
  832. With GNU tar, no separate invocation of gunzip is necessary.
  833. You can use the following alternative command to uncompress
  834. and extract the distribution:
  835. shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
  836. 6. Change location into the top-level directory of the unpacked
  837. distribution:
  838. shell> cd mysql-VERSION
  839. Note that currently you must configure and build MySQL from
  840. this top-level directory. You cannot build it in a different
  841. directory.
  842. 7. Configure the release and compile everything:
  843. shell> ./configure --prefix=/usr/local/mysql
  844. shell> make
  845. When you run configure, you might want to specify other
  846. options. Run ./configure --help for a list of options. Section
  847. 2.3.2, "Typical configure Options," discusses some of the more
  848. useful options.
  849. If configure fails and you are going to send mail to a MySQL
  850. mailing list to ask for assistance, please include any lines
  851. from config.log that you think can help solve the problem.
  852. Also include the last couple of lines of output from
  853. configure. To file a bug report, please use the instructions
  854. in Section 1.7, "How to Report Bugs or Problems."
  855. If the compile fails, see Section 2.3.4, "Dealing with
  856. Problems Compiling MySQL," for help.
  857. 8. Install the distribution:
  858. shell> make install
  859. You might need to run this command as root.
  860. If you want to set up an option file, use one of those present
  861. in the support-files directory as a template. For example:
  862. shell> cp support-files/my-medium.cnf /etc/my.cnf
  863. You might need to run this command as root.
  864. If you want to configure support for InnoDB tables, you should
  865. edit the /etc/my.cnf file, remove the # character before the
  866. option lines that start with innodb_..., and modify the option
  867. values to be what you want. See Section 4.2.3.3, "Using Option
  868. Files," and Section 13.6.2, "InnoDB Configuration."
  869. 9. Change location into the installation directory:
  870. shell> cd /usr/local/mysql
  871. 10. If you ran the make install command as root, the installed
  872. files will be owned by root. Ensure that the installation is
  873. accessible to mysql by executing the following commands as
  874. root in the installation directory:
  875. shell> chown -R mysql .
  876. shell> chgrp -R mysql .
  877. The first command changes the owner attribute of the files to
  878. the mysql user. The second changes the group attribute to the
  879. mysql group.
  880. 11. If you have not installed MySQL before, you must create the
  881. MySQL data directory and initialize the grant tables:
  882. shell> bin/mysql_install_db --user=mysql
  883. If you run the command as root, include the --user option as
  884. shown. If you run the command while logged in as mysql, you
  885. can omit the --user option.
  886. The command should create the data directory and its contents
  887. with mysql as the owner.
  888. After using mysql_install_db to create the grant tables for
  889. MySQL, you must restart the server manually. The mysqld_safe
  890. command to do this is shown in a later step.
  891. 12. Most of the MySQL installation can be owned by root if you
  892. like. The exception is that the data directory must be owned
  893. by mysql. To accomplish this, run the following commands as
  894. root in the installation directory:
  895. shell> chown -R root .
  896. shell> chown -R mysql var
  897. 13. If you want MySQL to start automatically when you boot your
  898. machine, you can copy support-files/mysql.server to the
  899. location where your system has its startup files. More
  900. information can be found in the support-files/mysql.server
  901. script itself; see also Section 2.13.1.2, "Starting and
  902. Stopping MySQL Automatically."
  903. 14. You can set up new accounts using the bin/mysql_setpermission
  904. script if you install the DBI and DBD::mysql Perl modules. See
  905. Section 4.6.14, "mysql_setpermission --- Interactively Set
  906. Permissions in Grant Tables." For Perl module installation
  907. instructions, see Section 2.15, "Perl Installation Notes."
  908. After everything has been installed, you should test your
  909. distribution. To start the MySQL server, use the following
  910. command:
  911. shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &
  912. If you run the command as root, you should use the --user option
  913. as shown. The value of the option is the name of the login account
  914. that you created in the first step to use for running the server.
  915. If you run the command while logged in as that user, you can omit
  916. the --user option.
  917. If the command fails immediately and prints mysqld ended, you can
  918. find some information in the host_name.err file in the data
  919. directory.
  920. More information about mysqld_safe is given in Section 4.3.2,
  921. "mysqld_safe --- MySQL Server Startup Script."
  922. Note
  923. The accounts that are listed in the MySQL grant tables initially
  924. have no passwords. After starting the server, you should set up
  925. passwords for them using the instructions in Section 2.13,
  926. "Post-Installation Setup and Testing."
  927. 2.3.2. Typical configure Options
  928. The configure script gives you a great deal of control over how
  929. you configure a MySQL source distribution. Typically you do this
  930. using options on the configure command line. You can also affect
  931. configure using certain environment variables. See Section 2.14,
  932. "Environment Variables." For a full list of options supported by
  933. configure, run this command:
  934. shell> ./configure --help
  935. A list of the available configure options is provided in the table
  936. below.
  937. Table 2.1. Build (configure) Reference
  938. Formats Description Default Introduced Removed
  939. --bindir=DIR User executables EPREFIX/bin
  940. --build=BUILD Configure for building on BUILD guessed
  941. --cache-file=FILE Cache test results in FILE disabled
  942. -C Alias for `--cache-file=config.cache'
  943. --config-cache
  944. --datadir=DIR Read-only architecture-independent data PREFIX/share
  945. --disable-FEATURE Do not include FEATURE
  946. --disable-dependency-tracking Disable dependency tracking
  947. --disable-grant-options Disable GRANT options
  948. --disable-largefile Omit support for large files
  949. --disable-libtool-lock Disable libtool lock
  950. --disable-thread-safe-client Compile the client without threads
  951. 5.1.7
  952. --enable-FEATURE Enable FEATURE
  953. --enable-assembler Use assembler versions of some string functions
  954. if available
  955. --enable-debug-sync Compile in Debug Sync facility 5.1.41
  956. --enable-dependency-tracking Do not reject slow dependency
  957. extractors
  958. --enable-fast-install Optimize for fast installation yes
  959. --enable-local-infile Enable LOAD DATA LOCAL INFILE disabled
  960. --enable-shared Build shared libraries yes
  961. --enable-static Build static libraries yes
  962. --enable-thread-safe-client Compile the client with threads
  963. --exec-prefix=EPREFIX Install architecture-dependent files in
  964. EPREFIX
  965. -h Display this help and exit
  966. --help
  967. --help=short Display options specific to this package
  968. --help=recursive Display the short help of all the included
  969. packages
  970. --host=HOST Cross-compile to build programs to run on HOST
  971. --includedir=DIR C header files PREFIX/include
  972. --infodir=DIR Info documentation PREFIX/info
  973. --libdir=DIR Object code libraries EPREFIX/lib
  974. --libexecdir=DIR Program executables EPREFIX/libexec
  975. --localstatedir=DIR Modifiable single-machine data PREFIX/var
  976. --mandir=DIR man documentation PREFIX/man
  977. -n Do not create output files
  978. --no-create
  979. --oldincludedir=DIR C header files for non-gcc /usr/include
  980. --prefix=PREFIX Install architecture-independent files in PREFIX
  981. --program-prefix=PREFIX Prepend PREFIX to installed program names
  982. --program-suffix=SUFFIX Append SUFFIX to installed program names
  983. --program-transform-name=PROGRAM run sed PROGRAM on installed
  984. program names
  985. -q Do not print `checking...' messages
  986. --quiet
  987. --sbindir=DIR System admin executables EPREFIX/sbin
  988. --sharedstatedir=DIR Modifiable architecture-independent data
  989. PREFIX/com
  990. --srcdir=DIR Find the sources in DIR configure directory or ..
  991. --sysconfdir=DIR Read-only single-machine data PREFIX/etc
  992. --target=TARGET Configure for building compilers for TARGET
  993. -V Display version information and exit
  994. --version
  995. --with-PACKAGE Use PACKAGE
  996. --with-archive-storage-engine Enable the Archive Storage Engine no
  997. --with-atomic-ops Implement atomic operations using pthread
  998. rwlocks or atomic CPU instructions for multi-processor 5.1.12
  999. --with-berkeley-db Use BerkeleyDB located in DIR no
  1000. --with-berkeley-db-includes Find Berkeley DB headers in DIR
  1001. --with-berkeley-db-libs Find Berkeley DB libraries in DIR
  1002. --with-big-tables Support tables with more than 4 G rows even on
  1003. 32 bit platforms
  1004. --with-blackhole-storage-engine Enable the Blackhole Storage
  1005. Engine no
  1006. --with-charset Default character set
  1007. --with-client-ldflags Extra linking arguments for clients
  1008. --with-collation Default collation
  1009. --with-comment Comment about compilation environment
  1010. --with-csv-storage-engine Enable the CSV Storage Engine yes
  1011. --with-darwin-mwcc Use Metrowerks CodeWarrior wrappers on OS
  1012. X/Darwin
  1013. --with-debug Add debug code 5.1.7
  1014. --with-debug=full Add debug code (adds memory checker, very slow)
  1015. --with-embedded-privilege-control Build parts to check user's
  1016. privileges (only affects embedded library)
  1017. --with-embedded-server Build the embedded server
  1018. --with-error-inject Enable error injection in MySQL Server
  1019. 5.1.11
  1020. --with-example-storage-engine Enable the Example Storage Engine no
  1021. --with-extra-charsets Use charsets in addition to default
  1022. --with-fast-mutexes Compile with fast mutexes enabled 5.1.5
  1023. --with-federated-storage-engine Enable federated storage engine no
  1024. 5.1.3 5.1.9
  1025. --with-gnu-ld Assume the C compiler uses GNU ld no
  1026. --with-innodb Enable innobase storage engine no 5.1.3 5.1.9
  1027. --with-lib-ccflags Extra CC options for libraries
  1028. --with-libwrap=DIR Compile in libwrap (tcp_wrappers) support
  1029. --with-low-memory Try to use less memory to compile to avoid
  1030. memory limitations
  1031. --with-machine-type Set the machine type, like "powerpc"
  1032. --with-max-indexes=N Sets the maximum number of indexes per table
  1033. 64
  1034. --with-mysqld-ldflags Extra linking arguments for mysqld
  1035. --with-mysqld-libs Extra libraries to link with for mysqld
  1036. --with-mysqld-user What user the mysqld daemon shall be run as
  1037. --with-mysqlmanager Build the mysqlmanager binary Build if server
  1038. is built
  1039. --with-named-curses-libs Use specified curses libraries
  1040. --with-named-thread-libs Use specified thread libraries
  1041. --with-ndb-ccflags Extra CC options for ndb compile
  1042. --with-ndb-docs Include the NDB Cluster ndbapi and mgmapi
  1043. documentation
  1044. --with-ndb-port Port for NDB Cluster management server
  1045. --with-ndb-port-base Port for NDB Cluster management server
  1046. --with-ndb-sci=DIR Provide MySQL with a custom location of sci
  1047. library
  1048. --with-ndb-test Include the NDB Cluster ndbapi test programs
  1049. --with-ndbcluster Include the NDB Cluster table handler no
  1050. --with-openssl=DIR Include the OpenSSL support
  1051. --with-openssl-includes Find OpenSSL headers in DIR
  1052. --with-openssl-libs Find OpenSSL libraries in DIR
  1053. --with-other-libc=DIR Link against libc and other standard
  1054. libraries installed in the specified nonstandard location
  1055. --with-pic Try to use only PIC/non-PIC objects Use both
  1056. --with-plugin-PLUGIN Forces the named plugin to be linked into
  1057. mysqld statically 5.1.11
  1058. --with-plugins Plugins to include in mysqld none 5.1.11
  1059. --with-pstack Use the pstack backtrace library
  1060. --with-pthread Force use of pthread library
  1061. --with-row-based-replication Include row-based replication 5.1.5
  1062. 5.1.6
  1063. --with-server-suffix Append value to the version string
  1064. --with-ssl=DIR Include SSL support 5.1.11
  1065. --with-system-type Set the system type, like "sun-solaris10"
  1066. --with-tags Include additional configurations automatic
  1067. --with-tcp-port Which port to use for MySQL services 3306
  1068. --with-unix-socket-path Where to put the unix-domain socket
  1069. --with-yassl Include the yaSSL support
  1070. --with-zlib-dir=no|bundled|DIR Provide MySQL with a custom
  1071. location of compression library
  1072. --without-PACKAGE Do not use PACKAGE
  1073. --without-bench Skip building of the benchmark suite
  1074. --without-debug Build a production version without debugging code
  1075. --without-docs Skip building of the documentation
  1076. --without-extra-tools Skip building utilities in the tools
  1077. directory
  1078. --without-geometry Do not build geometry-related parts
  1079. --without-libedit Use system libedit instead of bundled copy
  1080. --without-man Skip building of the man pages
  1081. --without-ndb-binlog Disable ndb binlog 5.1.6
  1082. --without-ndb-debug Disable special ndb debug features
  1083. --without-plugin-PLUGIN Exclude PLUGIN 5.1.11
  1084. --without-query-cache Do not build query cache
  1085. --without-readline Use system readline instead of bundled copy
  1086. --without-row-based-replication Don't include row-based
  1087. replication 5.1.7 5.1.14
  1088. --without-server Only build the client
  1089. --without-uca Skip building of the national Unicode collations
  1090. Some of the configure options available are described here. For
  1091. options that may be of use if you have difficulties building
  1092. MySQL, see Section 2.3.4, "Dealing with Problems Compiling MySQL."
  1093. * To compile just the MySQL client libraries and client programs
  1094. and not the server, use the --without-server option:
  1095. shell> ./configure --without-server
  1096. If you have no C++ compiler, some client programs such as
  1097. mysql cannot be compiled because they require C++.. In this
  1098. case, you can remove the code in configure that tests for the
  1099. C++ compiler and then run ./configure with the
  1100. --without-server option. The compile step should still try to
  1101. build all clients, but you can ignore any warnings about files
  1102. such as mysql.cc. (If make stops, try make -k to tell it to
  1103. continue with the rest of the build even if errors occur.)
  1104. * If you want to build the embedded MySQL library (libmysqld.a),
  1105. use the --with-embedded-server option.
  1106. * If you don't want your log files and database directories
  1107. located under /usr/local/var, use a configure command
  1108. something like one of these:
  1109. shell> ./configure --prefix=/usr/local/mysql
  1110. shell> ./configure --prefix=/usr/local \
  1111. --localstatedir=/usr/local/mysql/data
  1112. The first command changes the installation prefix so that
  1113. everything is installed under /usr/local/mysql rather than the
  1114. default of /usr/local. The second command preserves the
  1115. default installation prefix, but overrides the default
  1116. location for database directories (normally /usr/local/var)
  1117. and changes it to /usr/local/mysql/data.
  1118. You can also specify the installation directory and data
  1119. directory locations at server startup time by using the
  1120. --basedir and --datadir options. These can be given on the
  1121. command line or in an MySQL option file, although it is more
  1122. common to use an option file. See Section 4.2.3.3, "Using
  1123. Option Files."
  1124. * This option specifies the port number on which the server
  1125. listens for TCP/IP connections. The default is port 3306. To
  1126. listen on a different port, use a configure command like this:
  1127. shell> ./configure --with-tcp-port=3307
  1128. * If you are using Unix and you want the MySQL socket file
  1129. location to be somewhere other than the default location
  1130. (normally in the directory /tmp or /var/run), use a configure
  1131. command like this:
  1132. shell> ./configure \
  1133. --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
  1134. The socket file name must be an absolute path name. You can
  1135. also change the location of mysql.sock at server startup by
  1136. using a MySQL option file. See Section B.5.4.5, "How to
  1137. Protect or Change the MySQL Unix Socket File."
  1138. * If you want to compile statically linked programs (for
  1139. example, to make a binary distribution, to get better
  1140. performance, or to work around problems with some Red Hat
  1141. Linux distributions), run configure like this:
  1142. shell> ./configure --with-client-ldflags=-all-static \
  1143. --with-mysqld-ldflags=-all-static
  1144. * If you are using gcc and don't have libg++ or libstdc++
  1145. installed, you can tell configure to use gcc as your C++
  1146. compiler:
  1147. shell> CC=gcc CXX=gcc ./configure
  1148. When you use gcc as your C++ compiler, it does not attempt to
  1149. link in libg++ or libstdc++. This may be a good thing to do
  1150. even if you have those libraries installed. Some versions of
  1151. them have caused strange problems for MySQL users in the past.
  1152. The following list indicates some compilers and environment
  1153. variable settings that are commonly used with each one.
  1154. + gcc 2.7.2:
  1155. CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors"
  1156. + gcc 2.95.2:
  1157. CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
  1158. -felide-constructors -fno-exceptions -fno-rtti"
  1159. + pgcc 2.90.29 or newer:
  1160. CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \
  1161. CXXFLAGS="-O3 -mpentiumpro -mstack-align-double \
  1162. -felide-constructors -fno-exceptions -fno-rtti"
  1163. In most cases, you can get a reasonably optimized MySQL binary
  1164. by using the options from the preceding list and adding the
  1165. following options to the configure line:
  1166. --prefix=/usr/local/mysql --enable-assembler \
  1167. --with-mysqld-ldflags=-all-static
  1168. The full configure line would, in other words, be something
  1169. like the following for all recent gcc versions:
  1170. CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
  1171. -felide-constructors -fno-exceptions -fno-rtti" ./configure \
  1172. --prefix=/usr/local/mysql --enable-assembler \
  1173. --with-mysqld-ldflags=-all-static
  1174. The binaries we provide on the MySQL Web site at
  1175. http://dev.mysql.com/downloads/ are all compiled with full
  1176. optimization and should be perfect for most users. See Section
  1177. 2.2, "Installing MySQL from Generic Binaries on Unix/Linux."
  1178. There are some configuration settings you can tweak to build
  1179. an even faster binary, but these are only for advanced users.
  1180. See Section 7.5.1, "How Compiling and Linking Affects the
  1181. Speed of MySQL."
  1182. If the build fails and produces errors about your compiler or
  1183. linker not being able to create the shared library
  1184. libmysqlclient.so.N (where N is a version number), you can
  1185. work around this problem by giving the --disable-shared option
  1186. to configure. In this case, configure does not build a shared
  1187. libmysqlclient.so.N library.
  1188. * By default, MySQL uses the latin1 (cp1252 West European)
  1189. character set. To change the default set, use the
  1190. --with-charset option:
  1191. shell> ./configure --with-charset=CHARSET
  1192. CHARSET may be one of binary, armscii8, ascii, big5, cp1250,
  1193. cp1251, cp1256, cp1257, cp850, cp852, cp866, cp932, dec8,
  1194. eucjpms, euckr, gb2312, gbk, geostd8, greek, hebrew, hp8,
  1195. keybcs2, koi8r, koi8u, latin1, latin2, latin5, latin7, macce,
  1196. macroman, sjis, swe7, tis620, ucs2, ujis, utf8. (Additional
  1197. character sets might be available. Check the output from
  1198. ./configure --help for the current list.)
  1199. The default collation may also be specified. MySQL uses the
  1200. latin1_swedish_ci collation by default. To change this, use
  1201. the --with-collation option:
  1202. shell> ./configure --with-collation=COLLATION
  1203. To change both the character set and the collation, use both
  1204. the --with-charset and --with-collation options. The collation
  1205. must be a legal collation for the character set. (Use the SHOW
  1206. COLLATION statement to determine which collations are
  1207. available for each character set.)
  1208. With the configure option --with-extra-charsets=LIST, you can
  1209. define which additional character sets should be compiled into
  1210. the server. LIST is one of the following:
  1211. + A list of character set names separated by spaces
  1212. + complex to include all character sets that can't be
  1213. dynamically loaded
  1214. + all to include all character sets into the binaries
  1215. Clients that want to convert characters between the server and
  1216. the client should use the SET NAMES statement. See Section
  1217. 5.1.5, "Session System Variables," and Section 9.1.4,
  1218. "Connection Character Sets and Collations."
  1219. * To configure MySQL with debugging code, use the --with-debug
  1220. option:
  1221. shell> ./configure --with-debug
  1222. This causes a safe memory allocator to be included that can
  1223. find some errors and that provides output about what is
  1224. happening. See MySQL Internals: Porting
  1225. (http://forge.mysql.com/wiki/MySQL_Internals_Porting).
  1226. As of MySQL 5.1.12, using --with-debug to configure MySQL with
  1227. debugging support enables you to use the
  1228. --debug="d,parser_debug" option when you start the server.
  1229. This causes the Bison parser that is used to process SQL
  1230. statements to dump a parser trace to the server's standard
  1231. error output. Typically, this output is written to the error
  1232. log.
  1233. * To cause the Debug Sync facility to be compiled into the
  1234. server, use the --enable-debug-sync option. This facility is
  1235. used for testing and debugging. When compiled in, Debug Sync
  1236. is disabled by default. To enable it, start mysqld with the
  1237. --debug-sync-timeout=N option, where N is a timeout value
  1238. greater than 0. (The default value is 0, which disables Debug
  1239. Sync.) N becomes the default timeout for individual
  1240. synchronization points.
  1241. Debug Sync is also compiled in if you configure with the
  1242. --with-debug option (which implies --enable-debug-sync),
  1243. unless you also use the --disable-debug-sync option.
  1244. For a description of the Debug Sync facility and how to use
  1245. synchronization points, see MySQL Internals: Test
  1246. Synchronization
  1247. (http://forge.mysql.com/wiki/MySQL_Internals_Test_Synchronizat
  1248. ion).
  1249. The --enable-debug-sync and --disable-debug-sync options were
  1250. added in MySQL 5.1.41.
  1251. * If your client programs are using threads, you must compile a
  1252. thread-safe version of the MySQL client library with the
  1253. --enable-thread-safe-client configure option. This creates a
  1254. libmysqlclient_r library with which you should link your
  1255. threaded applications. See Section 21.9.16.2, "How to Make a
  1256. Threaded Client."
  1257. * Some features require that the server be built with
  1258. compression library support, such as the COMPRESS() and
  1259. UNCOMPRESS() functions, and compression of the client/server
  1260. protocol. The --with-zlib-dir=no|bundled|DIR option provides
  1261. control over compression library support. The value no
  1262. explicitly disables compression support. bundled causes the
  1263. zlib library bundled in the MySQL sources to be used. A DIR
  1264. path name specifies the directory in which to find the
  1265. compression library sources.
  1266. * It is possible to build MySQL with large table support using
  1267. the --with-big-tables option.
  1268. This option causes the variables that store table row counts
  1269. to be declared as unsigned long long rather than unsigned
  1270. long. This enables tables to hold up to approximately
  1271. 1.844E+19 ((2^32)^2) rows rather than 2^32 (~4.295E+09) rows.
  1272. Previously it was necessary to pass -DBIG_TABLES to the
  1273. compiler manually in order to enable this feature.
  1274. * Run configure with the --disable-grant-options option to cause
  1275. the --bootstrap, --skip-grant-tables, and --init-file options
  1276. for mysqld to be disabled. For Windows, the configure.js
  1277. script recognizes the DISABLE_GRANT_OPTIONS flag, which has
  1278. the same effect. The capability is available as of MySQL
  1279. 5.1.15.
  1280. * This option allows MySQL Community Server features to be
  1281. enabled. Additional options may be required for individual
  1282. features, such as --enable-profiling to enable statement
  1283. profiling. This option was added in MySQL 5.1.24. It is
  1284. enabled by default as of MySQL 5.1.28; to disable it, use
  1285. --disable-community-features.
  1286. * When given with --enable-community-features, the
  1287. --enable-profiling option enables the statement profiling
  1288. capability exposed by the SHOW PROFILE and SHOW PROFILES
  1289. statements. (See Section 12.4.5.33, "SHOW PROFILES Syntax.")
  1290. This option was added in MySQL 5.1.24. It is enabled by
  1291. default as of MySQL 5.1.28; to disable it, use
  1292. --disable-profiling.
  1293. * See Section 2.1, "General Installation Guidance," for options
  1294. that pertain to particular operating systems.
  1295. * See Section 5.5.6.2, "Using SSL Connections," for options that
  1296. pertain to configuring MySQL to support secure (encrypted)
  1297. connections.
  1298. * Several configure options apply to plugin selection and
  1299. building:
  1300. --with-plugins=PLUGIN[,PLUGIN]...
  1301. --with-plugins=GROUP
  1302. --with-plugin-PLUGIN
  1303. --without-plugin-PLUGIN
  1304. PLUGIN is an individual plugin name such as csv or archive.
  1305. As shorthand, GROUP is a configuration group name such as none
  1306. (select no plugins) or all (select all plugins).
  1307. You can build a plugin as static (compiled into the server) or
  1308. dynamic (built as a dynamic library that must be installed
  1309. using the INSTALL PLUGIN statement before it can be used).
  1310. Some plugins might not support static or dynamic build.
  1311. configure --help shows the following information pertaining to
  1312. plugins:
  1313. + The plugin-related options
  1314. + The names of all available plugins
  1315. + For each plugin, a description of its purpose, which
  1316. build types it supports (static or dynamic), and which
  1317. plugin groups it is a part of.
  1318. --with-plugins can take a list of one or more plugin names
  1319. separated by commas, or a plugin group name. The named plugins
  1320. are configured to be built as static plugins.
  1321. --with-plugin-PLUGIN configures the given plugin to be built
  1322. as a static plugin.
  1323. --without-plugin-PLUGIN disables the given plugin from being
  1324. built.
  1325. If a plugin is named both with a --with and --without option,
  1326. the result is undefined.
  1327. For any plugin that is not explicitly selected or disabled, it
  1328. is selected to be built dynamically if it supports dynamic
  1329. build, and not built if it does not support dynamic build.
  1330. (Thus, in the case that no plugin options are given, all
  1331. plugins that support dynamic build are selected to be built as
  1332. dynamic plugins. Plugins that do not support dynamic build are
  1333. not built.)
  1334. 2.3.3. Installing from the Development Source Tree
  1335. Caution
  1336. You should read this section only if you are interested in helping
  1337. us test our new code. If you just want to get MySQL up and running
  1338. on your system, you should use a standard release distribution
  1339. (either a binary or source distribution).
  1340. To obtain the most recent development source tree, you must have
  1341. Bazaar installed. You can obtain Bazaar from the Bazaar VCS Web
  1342. site (http://bazaar-vcs.org). Bazaar is supported by any platform
  1343. that supports Python, and is therefore compatible with any Linux,
  1344. Unix, Windows or Mac OS X host. Instructions for downloading and
  1345. installing Bazaar on the different platforms are available on the
  1346. Bazaar Web site.
  1347. All MySQL projects are hosted on Launchpad
  1348. (http://launchpad.net/). MySQL projects, including MySQL server,
  1349. MySQL Workbench, and others are available from the Sun/MySQL
  1350. Engineering (http://launchpad.net/~mysql) page. For the
  1351. repositories related only to MySQL server, see the MySQL Server
  1352. (http://launchpad.net/mysql-server) page.
  1353. To build under Unix/Linux, you must have the following tools
  1354. installed:
  1355. * GNU make, available from http://www.gnu.org/software/make/.
  1356. Although some platforms come with their own make
  1357. implementations, it is highly recommended that you use GNU
  1358. make. It may already be available on your system as gmake.
  1359. * autoconf 2.58 (or newer), available from
  1360. http://www.gnu.org/software/autoconf/.
  1361. * automake 1.8.1, available from
  1362. http://www.gnu.org/software/automake/.
  1363. * libtool 1.5, available from
  1364. http://www.gnu.org/software/libtool/.
  1365. * m4, available from http://www.gnu.org/software/m4/.
  1366. * bison, available from http://www.gnu.org/software/bison/. You
  1367. should use the latest version of bison where possible. Version
  1368. 1.75 and version 2.1 are known to work. There have been
  1369. reported problems with bison 1.875. If you experience
  1370. problems, upgrade to a later, rather than earlier, version.
  1371. Versions of bison older than 1.75 may report this error:
  1372. sql_yacc.yy:#####: fatal error: maximum table size (32767) exceeded
  1373. The maximum table size is not actually exceeded; the error is
  1374. caused by bugs in older versions of bison.
  1375. To build under Windows you must have Microsoft Visual C++ 2005
  1376. Express Edition, Visual Studio .Net 2003 (7.1), or Visual Studio
  1377. 2005 (8.0) compiler system.
  1378. Once the necessary tools are installed, you must create a local
  1379. branch of the MySQL source code on your machine:
  1380. 1. To obtain a copy of the MySQL source code, you must create a
  1381. new Bazaar branch. If you do not already have a Bazaar
  1382. repository directory set up, you need to initialize a new
  1383. directory:
  1384. shell> mkdir mysql-server
  1385. shell> bzr init-repo --trees mysql-server
  1386. 2. Once you have an initialized directory, you can branch from
  1387. the public MySQL server repositories to create a local source
  1388. tree. To create a branch of a specific version:
  1389. shell> cd mysql-server
  1390. shell> bzr branch lp:mysql-server/5.1 mysql-5.1
  1391. 3. The initial download will take some time to complete,
  1392. depending on the speed of your connection. Please be patient.
  1393. Once you have downloaded the first tree, additional trees
  1394. should take significantly less time to download.
  1395. 4. When building from the Bazaar branch, you may want to create a
  1396. copy of your active branch so that you can make configuration
  1397. and other changes without affecting the original branch
  1398. contents. You can achieve this by branching from the original
  1399. branch:
  1400. shell> bzr branch mysql-5.1 mysql-5.1-build
  1401. 5. To obtain changes made after you have set up the branch
  1402. initially, update it using the pull option periodically. Use
  1403. this command in the top-level directory of the local copy:
  1404. shell> bzr pull
  1405. You can examine the changeset comments for the tree by using
  1406. the log option to bzr:
  1407. shell> bzr log
  1408. You can also browse changesets, comments, and source code
  1409. online. To browse this information for MySQL 5.1, go to the
  1410. Launchpad MySQL Server (http://launchpad.net/mysql-server)
  1411. page.
  1412. If you see diffs (changes) or code that you have a question
  1413. about, do not hesitate to send email to the MySQL internals
  1414. mailing list. See Section 1.6.1, "MySQL Mailing Lists." Also,
  1415. if you think you have a better idea on how to do something,
  1416. send an email message to the list with a patch.
  1417. After you have the local branch, you can build MySQL server from
  1418. the source code. On Windows, the build process is different from
  1419. Unix/Linux: see Section 2.5.10, "Installing MySQL from Source on
  1420. Windows."
  1421. On Unix/Linux, use the autoconf system to create the configure
  1422. script so that you can configure the build environment before
  1423. building. The following example shows the typical commands
  1424. required to build MySQL from a source tree.
  1425. 1. Change location to the top-level directory of the source tree;
  1426. replace mysql-5.1 with the appropriate directory name.
  1427. shell> cd mysql-5.1
  1428. 2. Prepare the source tree for configuration.
  1429. Prior to MySQL 5.1.12, you must separately configure the
  1430. InnoDB storage engine. Run the following command from the main
  1431. source directory:
  1432. shell> (cd storage/innobase; autoreconf --force --install)
  1433. You can omit the previous command for MySQL 5.1.12 and later,
  1434. or if you do not require InnoDB support.
  1435. Prepare the remainder of the source tree:
  1436. shell> autoreconf --force --install
  1437. As an alternative to the preceding autoreconf command, you can
  1438. use BUILD/autorun.sh, which acts as a shortcut for the
  1439. following sequence of commands:
  1440. shell> aclocal; autoheader
  1441. shell> libtoolize --automake --force
  1442. shell> automake --force --add-missing; autoconf
  1443. If you get some strange errors during this stage, verify that
  1444. you have the correct version of libtool installed.
  1445. 3. Configure the source tree and compile MySQL:
  1446. shell> ./configure # Add your favorite options here
  1447. shell> make
  1448. For a description of some configure options, see Section
  1449. 2.3.2, "Typical configure Options."
  1450. A collection of our standard configuration scripts is located
  1451. in the BUILD/ subdirectory. For example, you may find it more
  1452. convenient to use the BUILD/compile-pentium-debug script than
  1453. the preceding set of shell commands. To compile on a different
  1454. architecture, modify the script by removing flags that are
  1455. Pentium-specific, or use another script that may be more
  1456. appropriate. These scripts are provided on an "as-is" basis.
  1457. They are not officially maintained and their contents may
  1458. change from release to release.
  1459. 4. When the build is done, run make install. Be careful with this
  1460. on a production machine; the command may overwrite your live
  1461. release installation. If you already have MySQL installed and
  1462. do not want to overwrite it, run ./configure with values for
  1463. the --prefix, --with-tcp-port, and --with-unix-socket-path
  1464. options different from those used for your production server.
  1465. 5. Play hard with your new installation and try to make the new
  1466. features crash. Start by running make test. See Section
  1467. 22.1.2, "MySQL Test Suite."
  1468. 6. If you have gotten to the make stage, but the distribution
  1469. does not compile, please enter the problem into our bugs
  1470. database using the instructions given in Section 1.7, "How to
  1471. Report Bugs or Problems." If you have installed the latest
  1472. versions of the required GNU tools, and they crash trying to
  1473. process our configuration files, please report that also.
  1474. However, if you get a command not found error or a similar
  1475. problem for aclocal, configure, or other required tools, do
  1476. not report it. Instead, make sure that all the required tools
  1477. are installed and that your PATH variable is set correctly so
  1478. that your shell can find them.
  1479. 2.3.4. Dealing with Problems Compiling MySQL
  1480. All MySQL programs compile cleanly for us with no warnings on
  1481. Solaris or Linux using gcc. On other systems, warnings may occur
  1482. due to differences in system include files. See Section 2.3.5,
  1483. "MIT-pthreads Notes," for warnings that may occur when using
  1484. MIT-pthreads. For other problems, check the following list.
  1485. The solution to many problems involves reconfiguring. If you do
  1486. need to reconfigure, take note of the following:
  1487. * If configure is run after it has previously been run, it may
  1488. use information that was gathered during its previous
  1489. invocation. This information is stored in config.cache. When
  1490. configure starts up, it looks for that file and reads its
  1491. contents if it exists, on the assumption that the information
  1492. is still correct. That assumption is invalid when you
  1493. reconfigure.
  1494. * Each time you run configure, you must run make again to
  1495. recompile. However, you may want to remove old object files
  1496. from previous builds first because they were compiled using
  1497. different configuration options.
  1498. To prevent old configuration information or object files from
  1499. being used, run these commands before re-running configure:
  1500. shell> rm config.cache
  1501. shell> make clean
  1502. Alternatively, you can run make distclean.
  1503. The following list describes some of the problems when compiling
  1504. MySQL that have been found to occur most often:
  1505. * If you get errors such as the ones shown here when compiling
  1506. sql_yacc.cc, you probably have run out of memory or swap
  1507. space:
  1508. Internal compiler error: program cc1plus got fatal signal 11
  1509. Out of virtual memory
  1510. Virtual memory exhausted
  1511. The problem is that gcc requires a huge amount of memory to
  1512. compile sql_yacc.cc with inline functions. Try running
  1513. configure with the --with-low-memory option:
  1514. shell> ./configure --with-low-memory
  1515. This option causes -fno-inline to be added to the compile line
  1516. if you are using gcc and -O0 if you are using something else.
  1517. You should try the --with-low-memory option even if you have
  1518. so much memory and swap space that you think you can't
  1519. possibly have run out. This problem has been observed to occur
  1520. even on systems with generous hardware configurations, and the
  1521. --with-low-memory option usually fixes it.
  1522. * By default, configure picks c++ as the compiler name and GNU
  1523. c++ links with -lg++. If you are using gcc, that behavior can
  1524. cause problems during configuration such as this:
  1525. configure: error: installation or configuration problem:
  1526. C++ compiler cannot create executables.
  1527. You might also observe problems during compilation related to
  1528. g++, libg++, or libstdc++.
  1529. One cause of these problems is that you may not have g++, or
  1530. you may have g++ but not libg++, or libstdc++. Take a look at
  1531. the config.log file. It should contain the exact reason why
  1532. your C++ compiler didn't work. To work around these problems,
  1533. you can use gcc as your C++ compiler. Try setting the
  1534. environment variable CXX to "gcc -O3". For example:
  1535. shell> CXX="gcc -O3" ./configure
  1536. This works because gcc compiles C++ source files as well as
  1537. g++ does, but does not link in libg++ or libstdc++ by default.
  1538. Another way to fix these problems is to install g++, libg++,
  1539. and libstdc++. However, do not use libg++ or libstdc++ with
  1540. MySQL because this only increases the binary size of mysqld
  1541. without providing any benefits. Some versions of these
  1542. libraries have also caused strange problems for MySQL users in
  1543. the past.
  1544. * If your compile fails with errors such as any of the
  1545. following, you must upgrade your version of make to GNU make:
  1546. making all in mit-pthreads
  1547. make: Fatal error in reader: Makefile, line 18:
  1548. Badly formed macro assignment
  1549. Or:
  1550. make: file `Makefile' line 18: Must be a separator (:
  1551. Or:
  1552. pthread.h: No such file or directory
  1553. Solaris and FreeBSD are known to have troublesome make
  1554. programs.
  1555. GNU make 3.75 is known to work.
  1556. * If you want to define flags to be used by your C or C++
  1557. compilers, do so by adding the flags to the CFLAGS and
  1558. CXXFLAGS environment variables. You can also specify the
  1559. compiler names this way using CC and CXX. For example:
  1560. shell> CC=gcc
  1561. shell> CFLAGS=-O3
  1562. shell> CXX=gcc
  1563. shell> CXXFLAGS=-O3
  1564. shell> export CC CFLAGS CXX CXXFLAGS
  1565. See Section 2.2, "Installing MySQL from Generic Binaries on
  1566. Unix/Linux," for a list of flag definitions that have been
  1567. found to be useful on various systems.
  1568. * If you get errors such as those shown here when compiling
  1569. mysqld, configure did not correctly detect the type of the
  1570. last argument to accept(), getsockname(), or getpeername():
  1571. cxx: Error: mysqld.cc, line 645: In this statement, the referenced
  1572. type of the pointer value ''length'' is ''unsigned long'',
  1573. which is not compatible with ''int''.
  1574. new_sock = accept(sock, (struct sockaddr *)&cAddr, &length);
  1575. To fix this, edit the config.h file (which is generated by
  1576. configure). Look for these lines:
  1577. /* Define as the base type of the last arg to accept */
  1578. #define SOCKET_SIZE_TYPE XXX
  1579. Change XXX to size_t or int, depending on your operating
  1580. system. (You must do this each time you run configure because
  1581. configure regenerates config.h.)
  1582. * The sql_yacc.cc file is generated from sql_yacc.yy. Normally,
  1583. the build process does not need to create sql_yacc.cc because
  1584. MySQL comes with a pre-generated copy. However, if you do need
  1585. to re-create it, you might encounter this error:
  1586. "sql_yacc.yy", line xxx fatal: default action causes potential...
  1587. This is a sign that your version of yacc is deficient. You
  1588. probably need to install bison (the GNU version of yacc) and
  1589. use that instead.
  1590. * On Debian Linux 3.0, you need to install gawk instead of the
  1591. default mawk.
  1592. * If you need to debug mysqld or a MySQL client, run configure
  1593. with the --with-debug option, and then recompile and link your
  1594. clients with the new client library. See MySQL Internals:
  1595. Porting (http://forge.mysql.com/wiki/MySQL_Internals_Porting).
  1596. * If you get a compilation error on Linux (for example, SuSE
  1597. Linux 8.1 or Red Hat Linux 7.3) similar to the following one,
  1598. you probably do not have g++ installed:
  1599. libmysql.c:1329: warning: passing arg 5 of `gethostbyname_r' from
  1600. incompatible pointer type
  1601. libmysql.c:1329: too few arguments to function `gethostbyname_r'
  1602. libmysql.c:1329: warning: assignment makes pointer from integer
  1603. without a cast
  1604. make[2]: *** [libmysql.lo] Error 1
  1605. By default, the configure script attempts to determine the
  1606. correct number of arguments by using g++ (the GNU C++
  1607. compiler). This test yields incorrect results if g++ is not
  1608. installed. There are two ways to work around this problem:
  1609. + Make sure that the GNU C++ g++ is installed. On some
  1610. Linux distributions, the required package is called gpp;
  1611. on others, it is named gcc-c++.
  1612. + Use gcc as your C++ compiler by setting the CXX
  1613. environment variable to gcc:
  1614. export CXX="gcc"
  1615. You must run configure again after making either of those
  1616. changes.
  1617. 2.3.5. MIT-pthreads Notes
  1618. This section describes some of the issues involved in using
  1619. MIT-pthreads.
  1620. On Linux, you should not use MIT-pthreads. Use the installed
  1621. LinuxThreads implementation instead. See Section 2.6, "Installing
  1622. MySQL on Linux."
  1623. If your system does not provide native thread support, you should
  1624. build MySQL using the MIT-pthreads package. This includes older
  1625. FreeBSD systems, SunOS 4.x, Solaris 2.4 and earlier, and some
  1626. others. See Section 2.1, "General Installation Guidance."
  1627. MIT-pthreads is not part of the MySQL 5.1 source distribution. If
  1628. you require this package, you need to download it separately from
  1629. http://dev.mysql.com/Downloads/Contrib/pthreads-1_60_beta6-mysql.t
  1630. ar.gz
  1631. After downloading, extract this source archive into the top level
  1632. of the MySQL source directory. It creates a new subdirectory named
  1633. mit-pthreads.
  1634. * On most systems, you can force MIT-pthreads to be used by
  1635. running configure with the --with-mit-threads option:
  1636. shell> ./configure --with-mit-threads
  1637. Building in a nonsource directory is not supported when using
  1638. MIT-pthreads because we want to minimize our changes to this
  1639. code.
  1640. * The checks that determine whether to use MIT-pthreads occur
  1641. only during the part of the configuration process that deals
  1642. with the server code. If you have configured the distribution
  1643. using --without-server to build only the client code, clients
  1644. do not know whether MIT-pthreads is being used and use Unix
  1645. socket file connections by default. Because Unix socket files
  1646. do not work under MIT-pthreads on some platforms, this means
  1647. you need to use -h or --host with a value other than localhost
  1648. when you run client programs.
  1649. * When MySQL is compiled using MIT-pthreads, system locking is
  1650. disabled by default for performance reasons. You can tell the
  1651. server to use system locking with the --external-locking
  1652. option. This is needed only if you want to be able to run two
  1653. MySQL servers against the same data files, but that is not
  1654. recommended, anyway.
  1655. * Sometimes the pthread bind() command fails to bind to a socket
  1656. without any error message (at least on Solaris). The result is
  1657. that all connections to the server fail. For example:
  1658. shell> mysqladmin version
  1659. mysqladmin: connect to server at '' failed;
  1660. error: 'Can't connect to mysql server on localhost (146)'
  1661. The solution to this problem is to kill the mysqld server and
  1662. restart it. This has happened to us only when we have forcibly
  1663. stopped the server and restarted it immediately.
  1664. * With MIT-pthreads, the sleep() system call isn't interruptible
  1665. with SIGINT (break). This is noticeable only when you run
  1666. mysqladmin --sleep. You must wait for the sleep() call to
  1667. terminate before the interrupt is served and the process
  1668. stops.
  1669. * When linking, you might receive warning messages like these
  1670. (at least on Solaris); they can be ignored:
  1671. ld: warning: symbol `_iob' has differing sizes:
  1672. (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
  1673. file /usr/lib/libc.so value=0x140);
  1674. /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
  1675. ld: warning: symbol `__iob' has differing sizes:
  1676. (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
  1677. file /usr/lib/libc.so value=0x140);
  1678. /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
  1679. * Some other warnings also can be ignored:
  1680. implicit declaration of function `int strtoll(...)'
  1681. implicit declaration of function `int strtoul(...)'
  1682. * We have not been able to make readline work with MIT-pthreads.
  1683. (This is not necessary, but may be of interest to some.)
  1684. 2.4. Upgrading or Downgrading MySQL
  1685. 2.4.1. Upgrading MySQL
  1686. As a general rule, to upgrade from one release series to another,
  1687. you should go to the next series rather than skipping a series. To
  1688. upgrade from a release series previous to MySQL 5.0, upgrade to
  1689. each successive release series in turn until you have reached
  1690. MySQL 5.0, and then proceed with the upgrade to MySQL 5.1. For
  1691. example, if you currently are running MySQL 4.0 and wish to
  1692. upgrade to a newer series, upgrade to MySQL 4.1 first before
  1693. upgrading to 5.0, and so forth. For information on upgrading to
  1694. MySQL 5.0, see the MySQL 5.0 Reference Manual; for earlier
  1695. releases, see the MySQL 3.23, 4.0, 4.1 Reference Manual.
  1696. If you perform a binary (in-place) upgrade without dumping and
  1697. reloading tables, you cannot upgrade directly from MySQL 4.1 to
  1698. 5.1. This occurs due to an incompatible change in the MyISAM table
  1699. index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
  1700. repair all MyISAM tables (see Section 2.4.4, "Rebuilding or
  1701. Repairing Tables or Indexes"). Then upgrade from MySQL 5.0 to 5.1
  1702. and check and repair your tables.
  1703. To upgrade from MySQL 5.0 to 5.1, use the items in the following
  1704. checklist as a guide:
  1705. * Before any upgrade, back up your databases, including the
  1706. mysql database that contains the grant tables. See Section
  1707. 6.2, "Database Backup Methods."
  1708. * Read all the notes in Section 2.4.1.1, "Upgrading from MySQL
  1709. 5.0 to 5.1." These notes enable you to identify upgrade issues
  1710. that apply to your current MySQL installation. Some
  1711. incompatibilities discussed in that section require your
  1712. attention before upgrading. Others should be dealt with after
  1713. upgrading.
  1714. * Read Appendix C, "MySQL Change History" as well, which
  1715. provides information about features that are new in MySQL 5.1
  1716. or differ from those found in MySQL 5.0.
  1717. * After you upgrade to a new version of MySQL, run mysql_upgrade
  1718. (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
  1719. Upgrade"). This program checks your tables, and attempts to
  1720. repair them if necessary. It also updates your grant tables to
  1721. make sure that they have the current structure so that you can
  1722. take advantage of any new capabilities. (Some releases of
  1723. MySQL introduce changes to the structure of the grant tables
  1724. to add new privileges or features.)
  1725. * If you are running MySQL Server on Windows, see Section 2.5.7,
  1726. "Upgrading MySQL on Windows."
  1727. * If you are using replication, see Section 16.4.3, "Upgrading a
  1728. Replication Setup," for information on upgrading your
  1729. replication setup.
  1730. * If you are upgrading an installation originally produced by
  1731. installing multiple RPM packages, it is best to upgrade all
  1732. the packages, not just some. For example, if you previously
  1733. installed the server and client RPMs, do not upgrade just the
  1734. server RPM.
  1735. * As of MySQL 5.1.9, the mysqld-max server is included in binary
  1736. distributions. There is no separate MySQL-Max distribution. As
  1737. of MySQL 5.1.12, there is no mysqld-max server at all in
  1738. binary distributions. They contain a server that includes the
  1739. features previously included in mysqld-max.
  1740. * If you have created a user-defined function (UDF) with a given
  1741. name and upgrade MySQL to a version that implements a new
  1742. built-in function with the same name, the UDF becomes
  1743. inaccessible. To correct this, use DROP FUNCTION to drop the
  1744. UDF, and then use CREATE FUNCTION to re-create the UDF with a
  1745. different nonconflicting name. The same is true if the new
  1746. version of MySQL implements a built-in function with the same
  1747. name as an existing stored function. See Section 8.2.4,
  1748. "Function Name Parsing and Resolution," for the rules
  1749. describing how the server interprets references to different
  1750. kinds of functions.
  1751. You can always move the MySQL format files and data files between
  1752. different versions on systems with the same architecture as long
  1753. as you stay within versions for the same release series of MySQL.
  1754. If you are cautious about using new versions, you can always
  1755. rename your old mysqld before installing a newer one. For example,
  1756. if you are using MySQL 5.0.13 and want to upgrade to 5.1.10,
  1757. rename your current server from mysqld to mysqld-5.0.13. If your
  1758. new mysqld then does something unexpected, you can simply shut it
  1759. down and restart with your old mysqld.
  1760. If, after an upgrade, you experience problems with recompiled
  1761. client programs, such as Commands out of sync or unexpected core
  1762. dumps, you probably have used old header or library files when
  1763. compiling your programs. In this case, you should check the date
  1764. for your mysql.h file and libmysqlclient.a library to verify that
  1765. they are from the new MySQL distribution. If not, recompile your
  1766. programs with the new headers and libraries.
  1767. If problems occur, such as that the new mysqld server does not
  1768. start or that you cannot connect without a password, verify that
  1769. you do not have an old my.cnf file from your previous
  1770. installation. You can check this with the --print-defaults option
  1771. (for example, mysqld --print-defaults). If this command displays
  1772. anything other than the program name, you have an active my.cnf
  1773. file that affects server or client operation.
  1774. If your MySQL installation contains a large amount of data that
  1775. might take a long time to convert after an in-place upgrade, you
  1776. might find it useful to create a "dummy" database instance for
  1777. assessing what conversions might be needed and the work involved
  1778. to perform them. Make a copy of your MySQL instance that contains
  1779. a full copy of the mysql database, plus all other databases
  1780. without data. Run your upgrade procedure on this dummy instance to
  1781. see what actions might be needed so that you can better evaluate
  1782. the work involved when performing actual data conversion on your
  1783. original database instance.
  1784. It is a good idea to rebuild and reinstall the Perl DBD::mysql
  1785. module whenever you install a new release of MySQL. The same
  1786. applies to other MySQL interfaces as well, such as PHP mysql
  1787. extensions and the Python MySQLdb module.
  1788. 2.4.1.1. Upgrading from MySQL 5.0 to 5.1
  1789. After upgrading a 5.0 installation to 5.0.10 or above, it is
  1790. necessary to upgrade your grant tables. Otherwise, creating stored
  1791. procedures and functions might not work. To perform this upgrade,
  1792. run mysql_upgrade.
  1793. Note
  1794. It is good practice to back up your data before installing any new
  1795. version of software. Although MySQL works very hard to ensure a
  1796. high level of quality, you should protect your data by making a
  1797. backup.
  1798. To upgrade to 5.1 from any previous version, MySQL recommends that
  1799. you dump your tables with mysqldump before upgrading and reload
  1800. the dump file after upgrading.
  1801. If you perform a binary (in-place) upgrade without dumping and
  1802. reloading tables, you cannot upgrade directly from MySQL 4.1 to
  1803. 5.1. This occurs due to an incompatible change in the MyISAM table
  1804. index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
  1805. repair all MyISAM tables (see Section 2.4.4, "Rebuilding or
  1806. Repairing Tables or Indexes"). Then upgrade from MySQL 5.0 to 5.1
  1807. and check and repair your tables.
  1808. In general, you should do the following when upgrading from MySQL
  1809. 5.0 to 5.1:
  1810. * Read all the items in the following sections to see whether
  1811. any of them might affect your applications:
  1812. + Section 2.4.1, "Upgrading MySQL," has general update
  1813. information.
  1814. + The items in the change lists found later in this section
  1815. enable you to identify upgrade issues that apply to your
  1816. current MySQL installation.
  1817. + The MySQL 5.1 change history describes significant new
  1818. features you can use in 5.1 or that differ from those
  1819. found in MySQL 5.0. Some of these changes may result in
  1820. incompatibilities. See Section C.1, "Changes in Release
  1821. 5.1.x (Production)."
  1822. * Note particularly any changes that are marked Known issue or
  1823. Incompatible change. These incompatibilities with earlier
  1824. versions of MySQL may require your attention before you
  1825. upgrade.
  1826. Our aim is to avoid these changes, but occasionally they are
  1827. necessary to correct problems that would be worse than an
  1828. incompatibility between releases. If any upgrade issue
  1829. applicable to your installation involves an incompatibility
  1830. that requires special handling, follow the instructions given
  1831. in the incompatibility description. Often this will involve a
  1832. dump and reload, or use of a statement such as CHECK TABLE or
  1833. REPAIR TABLE.
  1834. For dump and reload instructions, see Section 2.4.4,
  1835. "Rebuilding or Repairing Tables or Indexes." Any procedure
  1836. that involves REPAIR TABLE with the USE_FRM option must be
  1837. done before upgrading. Use of this statement with a version of
  1838. MySQL different from the one used to create the table (that
  1839. is, using it after upgrading) may damage the table. See
  1840. Section 12.4.2.6, "REPAIR TABLE Syntax."
  1841. * After you upgrade to a new version of MySQL, run mysql_upgrade
  1842. (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
  1843. Upgrade"). This program checks your tables, and attempts to
  1844. repair them if necessary. It also updates your grant tables to
  1845. make sure that they have the current structure so that you can
  1846. take advantage of any new capabilities. (Some releases of
  1847. MySQL introduce changes to the structure of the grant tables
  1848. to add new privileges or features.)
  1849. * Check Section 2.4.3, "Checking Whether Tables or Indexes Must
  1850. Be Rebuilt," to see whether changes to table formats or to
  1851. character sets or collations were made between your current
  1852. version of MySQL and the version to which you are upgrading.
  1853. If so and these changes result in an incompatibility between
  1854. MySQL versions, you will need to upgrade the affected tables
  1855. using the instructions in Section 2.4.4, "Rebuilding or
  1856. Repairing Tables or Indexes."
  1857. * If you are running MySQL Server on Windows, see Section 2.5.7,
  1858. "Upgrading MySQL on Windows."
  1859. * If you are using replication, see Section 16.4.3, "Upgrading a
  1860. Replication Setup," for information on upgrading your
  1861. replication setup.
  1862. If your MySQL installation contains a large amount of data that
  1863. might take a long time to convert after an in-place upgrade, you
  1864. might find it useful to create a "dummy" database instance for
  1865. assessing what conversions might be needed and the work involved
  1866. to perform them. Make a copy of your MySQL instance that contains
  1867. a full copy of the mysql database, plus all other databases
  1868. without data. Run your upgrade procedure on this dummy instance to
  1869. see what actions might be needed so that you can better evaluate
  1870. the work involved when performing actual data conversion on your
  1871. original database instance.
  1872. MySQL Enterprise MySQL Enterprise subscribers will find more
  1873. information about upgrading in the Knowledge Base articles found
  1874. at Upgrading
  1875. (https://kb.mysql.com/search.php?cat=search&category=41). Access
  1876. to the MySQL Knowledge Base collection of articles is one of the
  1877. advantages of subscribing to MySQL Enterprise. For more
  1878. information, see
  1879. http://www.mysql.com/products/enterprise/advisors.html.
  1880. The following lists describe changes that may affect applications
  1881. and that you should watch out for when upgrading to MySQL 5.1.
  1882. Configuration Changes:
  1883. * Before MySQL 5.1.11, to build MySQL from source with SSL
  1884. support enabled, you would invoke configure with either the
  1885. --with-openssl or --with-yassl option. In MySQL 5.1.11, those
  1886. options both have been replaced by the --with-ssl option. By
  1887. default, --with-ssl causes the bundled yaSSL library to be
  1888. used. To select OpenSSL instead, give the option as
  1889. --with-ssl=path, where path is the directory where the OpenSSL
  1890. header files and libraries are located.
  1891. Server Changes:
  1892. * Known issue: After a binary upgrade to MySQL 5.1 from a MySQL
  1893. 5.0 installation that contains ARCHIVE tables, accessing those
  1894. tables will cause the server to crash, even if you have run
  1895. mysql_upgrade or CHECK TABLE ... FOR UPGRADE. To work around
  1896. this problem, use mysqldump to dump all ARCHIVE tables before
  1897. upgrading, and reload them into MySQL 5.1 after upgrading.
  1898. * Known issue: The fix for
  1899. Bug#23491: http://bugs.mysql.com/bug.php?id=23491 introduced a
  1900. problem with SHOW CREATE VIEW, which is used by mysqldump.
  1901. This causes an incompatibility when upgrading from versions
  1902. affected by that bug fix (MySQL 5.0.40 through 5.0.43, MySQL
  1903. 5.1.18 through 5.1.19): If you use mysqldump before upgrading
  1904. from an affected version and reload the data after upgrading
  1905. to a higher version, you must drop and recreate your views.
  1906. * Known issue: Dumps performed by using mysqldump to generate a
  1907. dump file before the upgrade and reloading the file after
  1908. upgrading are subject to the following problem:
  1909. Before MySQL 5.0.40, mysqldump displays SPATIAL index
  1910. definitions using prefix lengths for the indexed columns.
  1911. These prefix lengths are accepted in MySQL 5.0, but not as of
  1912. MySQL 5.1. If you use mysqldump from versions of MySQL older
  1913. than 5.0.40, any table containing SPATIAL indexes will cause
  1914. an error when the dump file is reloaded into MySQL 5.1 or
  1915. higher.
  1916. For example, a table definition might look like this when
  1917. dumped in MySQL 5.0:
  1918. CREATE TABLE `t` (
  1919. `g` geometry NOT NULL,
  1920. SPATIAL KEY `g` (`g`(32))
  1921. ) ENGINE=MyISAM DEFAULT CHARSET=latin1
  1922. The SPATIAL index definition will not be accepted in MySQL
  1923. 5.1. To work around this, edit the dump file to remove the
  1924. prefix:
  1925. CREATE TABLE `t` (
  1926. `g` geometry NOT NULL,
  1927. SPATIAL KEY `g` (`g`)
  1928. ) ENGINE=MyISAM DEFAULT CHARSET=latin1
  1929. Dump files can be large, so it may be preferable to dump table
  1930. definitions and data separately to make it easier to edit the
  1931. definitions:
  1932. shell> mysqldump --no-data other_args > definitions.sql
  1933. shell> mysqldump --no-create-info other_args > data.sql
  1934. Then edit definitions.sql before reloading definitions.sql and
  1935. data.sql, in that order.
  1936. If you upgrade to a version of MySQL 5.0 higher than 5.0.40
  1937. before upgrading to MySQL 5.1, this problem does not occur.
  1938. * Known issue: Before MySQL 5.1.30, the CHECK TABLE ... FOR
  1939. UPGRADE statement did not check for incompatible collation
  1940. changes made in MySQL 5.1.24. (This also affects mysqlcheck
  1941. and mysql_upgrade, which cause that statement to be executed.)
  1942. Prior to the fix made in 5.1.30, a binary upgrade (performed
  1943. without dumping tables with mysqldump before the upgrade and
  1944. reloading the dump file after the upgrade) would corrupt
  1945. tables. After the fix, CHECK TABLE ... FOR UPGRADE properly
  1946. detects the problem and warns about tables that need repair.
  1947. However, the fix is not backward compatible and can result in
  1948. a downgrading problem under these circumstances:
  1949. 1. Perform a binary upgrade to a version of MySQL that
  1950. includes the fix.
  1951. 2. Run CHECK TABLE ... FOR UPGRADE (or mysqlcheck or
  1952. mysql_upgrade) to upgrade tables.
  1953. 3. Perform a binary downgrade to a version of MySQL that
  1954. does not include the fix.
  1955. The solution is to dump tables with mysqldump before the
  1956. downgrade and reload the dump file after the downgrade.
  1957. Alternatively, drop and recreate affected indexes.
  1958. * Known issue: MySQL introduces encoding for table names that
  1959. have non-ASCII characters (see Section 8.2.3, "Mapping of
  1960. Identifiers to File Names"). After a binary upgrade from MySQL
  1961. 5.0 to 5.1 or higher, the server recognizes names that have
  1962. non-ASCII characters and adds a #mysql50# prefix to them.
  1963. As of MySQL 5.1.31, mysql_upgrade encodes these names by
  1964. executing the following command:
  1965. mysqlcheck --all-databases --check-upgrade --fix-db-names --fix-table
  1966. -names
  1967. Prior to MySQL 5.1.31, mysql_upgrade does not execute this
  1968. command, so you should execute it manually if you have
  1969. database or table names that contain nonalphanumeric
  1970. characters.
  1971. Prior to MySQL 5.1.23, the mysqlcheck command does not perform
  1972. the name encoding for views. To work around this problem, drop
  1973. each affected view and recreate it.
  1974. mysqlcheck cannot fix names that contain literal instances of
  1975. the @ character that is used for encoding special characters.
  1976. If you have databases or tables that contain this character,
  1977. use mysqldump to dump them before upgrading to MySQL 5.1, and
  1978. then reload the dump file after upgrading.
  1979. * Known issue: When upgrading from MySQL 5.0 to versions of 5.1
  1980. prior to 5.1.23, running mysqlcheck (or mysql_upgrade, which
  1981. runs mysqlcheck) to upgrade tables fails for names that must
  1982. be written as quoted identifiers. To work around this problem,
  1983. rename each affected table to a name that does not require
  1984. quoting:
  1985. RENAME TABLE `tab``le_a` TO table_a;
  1986. RENAME TABLE `table b` TO table_b;
  1987. After renaming the tables, run the mysql_upgrade program. Then
  1988. rename the tables back to their original names:
  1989. RENAME TABLE table_a TO `tab``le_a`;
  1990. RENAME TABLE table_b TO `table b`;
  1991. * Known issue: In connection with view creation, the server
  1992. created arc directories inside database directories and
  1993. maintained useless copies of .frm files there. Creation and
  1994. renaming procedures of those copies as well as creation of arc
  1995. directories has been discontinued in MySQL 5.1.29.
  1996. This change does cause a problem when downgrading to older
  1997. server versions which manifests itself under these
  1998. circumstances:
  1999. 1. Create a view v_orig in MySQL 5.1.29 or higher.
  2000. 2. Rename the view to v_new and then back to v_orig.
  2001. 3. Downgrade to an older 5.1.x server and run mysql_upgrade.
  2002. 4. Try to rename v_orig to v_new again. This operation
  2003. fails.
  2004. As a workaround to avoid this problem, use either of these
  2005. approaches:
  2006. + Dump your data using mysqldump before downgrading and
  2007. reload the dump file after downgrading.
  2008. + Instead of renaming a view after the downgrade, drop it
  2009. and recreate it.
  2010. * Incompatible change: Character set or collation changes were
  2011. made in MySQL 5.1.21, 5.1.23, and 5.1.24 that may require
  2012. table indexes to be rebuilt. For details, see Section 2.4.3,
  2013. "Checking Whether Tables or Indexes Must Be Rebuilt."
  2014. * Incompatible change: MySQL 5.1 implements support for a plugin
  2015. API that allows the loading and unloading of components at
  2016. runtime, without restarting the server. Section 22.2, "The
  2017. MySQL Plugin API." The plugin API requires the mysql.plugin
  2018. table. After upgrading from an older version of MySQL, you
  2019. should run the mysql_upgrade command to create this table. See
  2020. Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
  2021. Upgrade."
  2022. Plugins are installed in the directory named by the plugin_dir
  2023. system variable. This variable also controls the location from
  2024. which the server loads user-defined functions (UDFs), which is
  2025. a change from earlier versions of MySQL. That is, all UDF
  2026. library files now must be installed in the plugin directory.
  2027. When upgrading from an older version of MySQL, you must
  2028. migrate your UDF files to the plugin directory.
  2029. * Incompatible change: The table_cache system variable has been
  2030. renamed to table_open_cache. Any scripts that refer to
  2031. table_cache must be updated to use the new name.
  2032. * Incompatible change: In MySQL 5.1.36, options for loading
  2033. plugins such as pluggable storage engines were changed from
  2034. boolean to tristate format. The implementations overlap, but
  2035. if you previously used options of the form --plugin_name=0 or
  2036. --plugin_name=1, you should instead use --plugin_name=OFF or
  2037. --plugin_name=ON, respectively. For details, see Section
  2038. 5.1.3, "Server Options for Loading Plugins."
  2039. * Incompatible change: From MySQL 5.1.24 to 5.1.31, the UPDATE
  2040. statement was changed such that assigning NULL to a NOT NULL
  2041. column caused an error even when strict SQL mode was not
  2042. enabled. The original behavior before MySQL 5.1.24 was that
  2043. such assignments caused an error only in strict SQL mode, and
  2044. otherwise set the column to the implicit default value for the
  2045. column data type and generated a warning. (For information
  2046. about implicit default values, see Section 10.1.4, "Data Type
  2047. Default Values.")
  2048. The change caused compatibility problems for applications that
  2049. relied on the original behavior. It also caused replication
  2050. problems between servers that had the original behavior and
  2051. those that did not, for applications that assigned NULL to NOT
  2052. NULL columns in UPDATE statements without strict SQL mode
  2053. enabled. The change was reverted in MySQL 5.1.32 so that
  2054. UPDATE again had the original behavior. Problems can still
  2055. occur if you replicate between servers that have the modified
  2056. UPDATE behavior and those that do not.
  2057. * Incompatible change: As of MySQL 5.1.29, the default binary
  2058. logging mode has been changed from MIXED to STATEMENT for
  2059. compatibility with MySQL 5.0.
  2060. * Incompatible change: In MySQL 5.1.25, a change was made to the
  2061. way that the server handles prepared statements. This affects
  2062. prepared statements processed at the SQL level (using the
  2063. PREPARE statement) and those processed using the binary
  2064. client-server protocol (using the mysql_stmt_prepare() C API
  2065. function).
  2066. Previously, changes to metadata of tables or views referred to
  2067. in a prepared statement could cause a server crash when the
  2068. statement was next executed, or perhaps an error at execute
  2069. time with a crash occurring later. For example, this could
  2070. happen after dropping a table and recreating it with a
  2071. different definition.
  2072. Now metadata changes to tables or views referred to by
  2073. prepared statements are detected and cause automatic
  2074. repreparation of the statement when it is next executed.
  2075. Metadata changes occur for DDL statements such as those that
  2076. create, drop, alter, rename, or truncate tables, or that
  2077. analyze, optimize, or repair tables. Repreparation also occurs
  2078. after referenced tables or views are flushed from the table
  2079. definition cache, either implicitly to make room for new
  2080. entries in the cache, or explicitly due to FLUSH TABLES.
  2081. Repreparation is automatic, but to the extent that it occurs,
  2082. performance of prepared statements is diminished.
  2083. Table content changes (for example, with INSERT or UPDATE) do
  2084. not cause repreparation, nor do SELECT statements.
  2085. An incompatibility with previous versions of MySQL is that a
  2086. prepared statement may now return a different set of columns
  2087. or different column types from one execution to the next. For
  2088. example, if the prepared statement is SELECT * FROM t1,
  2089. altering t1 to contain a different number of columns causes
  2090. the next execution to return a number of columns different
  2091. from the previous execution.
  2092. Older versions of the client library cannot handle this change
  2093. in behavior. For applications that use prepared statements
  2094. with the new server, an upgrade to the new client library is
  2095. strongly recommended.
  2096. Along with this change to statement repreparation, the default
  2097. value of the table_definition_cache system variable has been
  2098. increased from 128 to 256. The purpose of this increase is to
  2099. lessen the chance that prepared statements will need
  2100. repreparation due to referred-to tables/views having been
  2101. flushed from the cache to make room for new entries.
  2102. A new status variable, Com_stmt_reprepare, has been introduced
  2103. to track the number of repreparations.
  2104. * Incompatible change: As of MySQL 5.1.23, within a stored
  2105. routine, it is no longer allowable to declare a cursor for a
  2106. SHOW or DESCRIBE statement. This happened to work in some
  2107. instances, but is no longer supported. In many cases, a
  2108. workaround for this change is to use the cursor with a SELECT
  2109. query to read from an INFORMATION_SCHEMA table that produces
  2110. the same information as the SHOW statement.
  2111. * Incompatible change: SHOW CREATE VIEW displays view
  2112. definitions using an AS alias_name clause for each column. If
  2113. a column is created from an expression, the default alias is
  2114. the expression text, which can be quite long. As of MySQL
  2115. 5.1.23, aliases for column names in CREATE VIEW statements are
  2116. checked against the maximum column length of 64 characters
  2117. (not the maximum alias length of 256 characters). As a result,
  2118. views created from the output of SHOW CREATE VIEW fail if any
  2119. column alias exceeds 64 characters. This can cause problems
  2120. for replication or loading dump files. For additional
  2121. information and workarounds, see Section D.4, "Restrictions on
  2122. Views."
  2123. * Incompatible change: Several issues were identified for stored
  2124. programs (stored procedures and functions, triggers, and
  2125. events) and views containing non-ASCII symbols. These issues
  2126. involved conversion errors due to incomplete character set
  2127. information when translating these objects to and from stored
  2128. format.
  2129. To address these problems, the representation for these
  2130. objects was changed in MySQL 5.1.21. However, the fixes affect
  2131. all stored programs and views. (For example, you will see
  2132. warnings about "no creation context.") To avoid warnings from
  2133. the server about the use of old definitions from any release
  2134. prior to 5.1.21, you should dump stored programs and views
  2135. with mysqldump after upgrading to 5.1.21 or higher, and then
  2136. reload them to recreate them with new definitions. Invoke
  2137. mysqldump with a --default-character-set option that names the
  2138. non-ASCII character set that was used for the definitions when
  2139. the objects were originally defined.
  2140. * Incompatible change: As of MySQL 5.1.20, mysqld_safe supports
  2141. error logging to syslog on systems that support the logger
  2142. command. The new --syslog and --skip-syslog options can be
  2143. used instead of the --log-error option to control logging
  2144. behavior, as described in Section 4.3.2, "mysqld_safe ---
  2145. MySQL Server Startup Script."
  2146. In 5.1.21 and up, the default is --skip-syslog, which is
  2147. compatible with the default behavior of writing an error log
  2148. file for releases prior to 5.1.20.
  2149. In 5.1.20 only, the following conditions apply: 1) The default
  2150. is to use syslog, which is not compatible with releases prior
  2151. to 5.1.20. 2) Logging to syslog may fail to operate correctly
  2152. in some cases. For these reasons, avoid using MySQL 5.1.20.
  2153. * Incompatible change: As of MySQL 5.1.18, the plugin interface
  2154. and its handling of system variables was changed. Command-line
  2155. options such as --skip-innodb now cause an error if InnoDB is
  2156. not built-in or plugin-loaded. You should use
  2157. --loose-skip-innodb if you do not want any error even if
  2158. InnoDB is not available. The --loose prefix modifier should be
  2159. used for all command-line options where you are uncertain
  2160. whether the plugin exists and when you want the operation to
  2161. proceed even if the option is necessarily ignored due to the
  2162. absence of the plugin. (For a desecription of how --loose
  2163. works, see Section 4.2.3.1, "Using Options on the Command
  2164. Line.")
  2165. * Incompatible change: As of MySQL 5.1.15, InnoDB rolls back
  2166. only the last statement on a transaction timeout. A new
  2167. option, --innodb_rollback_on_timeout, causes InnoDB to abort
  2168. and roll back the entire transaction if a transaction timeout
  2169. occurs (the same behavior as in MySQL 4.1).
  2170. * Incompatible change: As of MySQL 5.1.15, the following
  2171. conditions apply to enabling the read_only system variable:
  2172. + If you attempt to enable read_only while you have any
  2173. explicit locks (acquired with LOCK TABLES or have a
  2174. pending transaction, an error will occur.
  2175. + If other clients hold explicit table locks or have
  2176. pending transactions, the attempt to enable read_only
  2177. blocks until the locks are released and the transactions
  2178. end. While the attempt to enable read_only is pending,
  2179. requests by other clients for table locks or to begin
  2180. transactions also block until read_only has been set.
  2181. + read_only can be enabled while you hold a global read
  2182. lock (acquired with FLUSH TABLES WITH READ LOCK) because
  2183. that does not involve table locks.
  2184. Previously, the attempt to enable read_only would return
  2185. immediately even if explicit locks or transactions were
  2186. pending, so some data changes could occur for statements
  2187. executing in the server at the same time.
  2188. * Incompatible change: The number of function names affected by
  2189. IGNORE_SPACE was reduced significantly in MySQL 5.1.13, from
  2190. about 200 to about 30. (For details about IGNORE_SPACE, see
  2191. Section 8.2.4, "Function Name Parsing and Resolution.") This
  2192. change improves the consistency of parser operation. However,
  2193. it also introduces the possibility of incompatibility for old
  2194. SQL code that relies on the following conditions:
  2195. + IGNORE_SPACE is disabled.
  2196. + The presence or absence of whitespace following a
  2197. function name is used to distinguish between a built-in
  2198. function and stored function that have the same name (for
  2199. example, PI() versus PI ()).
  2200. For functions that are no longer affected by IGNORE_SPACE as
  2201. of MySQL 5.1.13, that strategy no longer works. Either of the
  2202. following approaches can be used if you have code that is
  2203. subject to the preceding incompatibility:
  2204. + If a stored function has a name that conflicts with a
  2205. built-in function, refer to the stored function with a
  2206. schema name qualifier, regardless of whether whitespace
  2207. is present. For example, write schema_name.PI() or
  2208. schema_name.PI ().
  2209. + Alternatively, rename the stored function to use a
  2210. nonconflicting name and change invocations of the
  2211. function to use the new name.
  2212. * Incompatible change: For utf8 columns, the full-text parser
  2213. incorrectly considered several nonword punctuation and
  2214. whitespace characters as word characters, causing some
  2215. searches to return incorrect results. The fix involves a
  2216. change to the full-text parser in MySQL 5.1.12, so as of
  2217. 5.1.12, any tables that have FULLTEXT indexes on utf8 columns
  2218. must be repaired with REPAIR TABLE:
  2219. REPAIR TABLE tbl_name QUICK;
  2220. * Incompatible change: Storage engines can be pluggable at
  2221. runtime, so the distinction between disabled and invalid
  2222. storage engines no longer applies. As of MySQL 5.1.12, this
  2223. affects the NO_ENGINE_SUBSTITUTION SQL mode, as described in
  2224. Section 5.1.8, "Server SQL Modes."
  2225. * Incompatible change: The structure of FULLTEXT indexes has
  2226. been changed in MySQL 5.1.6. After upgrading to MySQL 5.1.6 or
  2227. greater, any tables that have FULLTEXT indexes must be
  2228. repaired with REPAIR TABLE:
  2229. REPAIR TABLE tbl_name QUICK;
  2230. * Incompatible change: In MySQL 5.1.6, when log tables were
  2231. implemented, the default log destination for the general query
  2232. and slow query log was TABLE. As of MySQL 5.1.21, this default
  2233. has been changed to FILE, which is compatible with MySQL 5.0,
  2234. but incompatible with earlier releases of MySQL 5.1. If you
  2235. are upgrading from MySQL 5.0 to 5.1.21 or higher, no logging
  2236. option changes should be necessary. However, if you are
  2237. upgrading from 5.1.6 through 5.1.20 to 5.1.21 or higher and
  2238. were using TABLE logging, use the --log-output=TABLE option
  2239. explicitly to preserve your server's table-logging behavior.
  2240. * Incompatible change: For ENUM columns that had enumeration
  2241. values containing commas, the commas were mapped to 0xff
  2242. internally. However, this rendered the commas
  2243. indistinguishable from true 0xff characters in the values.
  2244. This no longer occurs. However, the fix requires that you dump
  2245. and reload any tables that have ENUM columns containing true
  2246. 0xff in their values: Dump the tables using mysqldump with the
  2247. current server before upgrading from a version of MySQL 5.1
  2248. older than 5.1.15 to version 5.1.15 or newer.
  2249. * As of MySQL 5.1.12, the lc_time_names system variable
  2250. specifies the locale that controls the language used to
  2251. display day and month names and abbreviations. This variable
  2252. affects the output from the DATE_FORMAT(), DAYNAME() and
  2253. MONTHNAME() functions. See Section 9.7, "MySQL Server Locale
  2254. Support."
  2255. * As of MySQL 5.1.9, mysqld_safe no longer implicitly invokes
  2256. mysqld-max if it exists. Instead, it invokes mysqld unless a
  2257. --mysqld or --mysqld-version option is given to specify
  2258. another server explicitly. If you previously relied on the
  2259. implicit invocation of mysqld-max, you should use an
  2260. appropriate option now. As of MySQL 5.1.12, there is no longer
  2261. any separate mysqld-max server, so no change should be
  2262. necessary.
  2263. SQL Changes:
  2264. * Known issue: Prior to MySQL 5.1.17, the parser accepted
  2265. invalid code in SQL condition handlers, leading to server
  2266. crashes or unexpected execution behavior in stored programs.
  2267. Specifically, the parser allowed a condition handler to refer
  2268. to labels for blocks that enclose the handler declaration.
  2269. This was incorrect because block label scope does not include
  2270. the code for handlers declared within the labeled block.
  2271. As of 5.1.17, the parser rejects this invalid construct, but
  2272. if you perform a binary upgrade (without dumping and reloading
  2273. your databases), existing handlers that contain the construct
  2274. still are invalid and should be rewritten even if they appear
  2275. to function as you expect.
  2276. To find affected handlers, use mysqldump to dump all stored
  2277. procedures and functions, triggers, and events. Then attempt
  2278. to reload them into an upgraded server. Handlers that contain
  2279. illegal label references will be rejected.
  2280. For more information about condition handlers and writing them
  2281. to avoid invalid jumps, see Section 12.7.4.2, "DECLARE for
  2282. Handlers."
  2283. * Incompatible change: The parser accepted statements that
  2284. contained /* ... */ that were not properly closed with */,
  2285. such as SELECT 1 /* + 2. As of MySQL 5.1.23, statements that
  2286. contain unclosed /*-comments now are rejected with a syntax
  2287. error.
  2288. This fix has the potential to cause incompatibilities. Because
  2289. of Bug#26302: http://bugs.mysql.com/bug.php?id=26302, which
  2290. caused the trailing */ to be truncated from comments in views,
  2291. stored routines, triggers, and events, it is possible that
  2292. objects of those types may have been stored with definitions
  2293. that now will be rejected as syntactically invalid. Such
  2294. objects should be dropped and re-created so that their
  2295. definitions do not contain truncated comments.
  2296. * Incompatible change: Multiple-table DELETE statements
  2297. containing ambiguous aliases could have unintended side
  2298. effects such as deleting rows from the wrong table. Example:
  2299. DELETE FROM t1 AS a2 USING t1 AS a1 INNER JOIN t2 AS a2;
  2300. As of MySQL 5.1.23, alias declarations can be declared only in
  2301. the table_references part. Elsewhere in the statement, alias
  2302. references are allowed but not alias declarations. Statements
  2303. containing aliases that are no longer allowed must be
  2304. rewritten.
  2305. * Incompatible change: As of MySQL 5.1.8, TYPE = engine_name is
  2306. still accepted as a synonym for the ENGINE = engine_name table
  2307. option but generates a warning. You should note that this
  2308. option is not available in MySQL 5.1.7, and is removed
  2309. altogether as of MySQL 5.4 and produces a syntax error.
  2310. TYPE has been deprecated since MySQL 4.0.
  2311. * Incompatible change: The namespace for triggers changed in
  2312. MySQL 5.0.10. Previously, trigger names had to be unique per
  2313. table. Now they must be unique within the schema (database).
  2314. An implication of this change is that DROP TRIGGER syntax now
  2315. uses a schema name instead of a table name (schema name is
  2316. optional and, if omitted, the current schema will be used).
  2317. When upgrading from a version of MySQL 5 older than 5.0.10 to
  2318. MySQL 5.0.10 or newer, you must drop all triggers and
  2319. re-create them or DROP TRIGGER will not work after the
  2320. upgrade. Here is a suggested procedure for doing this:
  2321. 1. Upgrade to MySQL 5.0.10 or later to be able to access
  2322. trigger information in the INFORMATION_SCHEMA.TRIGGERS
  2323. table. (This should work even for pre-5.0.10 triggers.)
  2324. 2. Dump all trigger definitions using the following SELECT
  2325. statement:
  2326. SELECT CONCAT('CREATE TRIGGER ', t.TRIGGER_SCHEMA, '.', t.TRIGGER_NAM
  2327. E,
  2328. ' ', t.ACTION_TIMING, ' ', t.EVENT_MANIPULATION, ' ON '
  2329. ,
  2330. t.EVENT_OBJECT_SCHEMA, '.', t.EVENT_OBJECT_TABLE,
  2331. ' FOR EACH ROW ', t.ACTION_STATEMENT, '//' )
  2332. INTO OUTFILE '/tmp/triggers.sql'
  2333. FROM INFORMATION_SCHEMA.TRIGGERS AS t;
  2334. The statement uses INTO OUTFILE, so you must have the
  2335. FILE privilege. The file will be created on the server
  2336. host. Use a different file name if you like. To be 100%
  2337. safe, inspect the trigger definitions in the triggers.sql
  2338. file, and perhaps make a backup of the file.
  2339. 3. Stop the server and drop all triggers by removing all
  2340. .TRG files in your database directories. Change location
  2341. to your data directory and issue this command:
  2342. shell> rm */*.TRG
  2343. 4. Start the server and re-create all triggers using the
  2344. triggers.sql file:
  2345. mysql> delimiter // ;
  2346. mysql> source /tmp/triggers.sql //
  2347. 5. Check that all triggers were successfully created using
  2348. the SHOW TRIGGERS statement.
  2349. * Incompatible change: MySQL 5.1.6 introduces the TRIGGER
  2350. privilege. Previously, the SUPER privilege was needed to
  2351. create or drop triggers. Now those operations require the
  2352. TRIGGER privilege. This is a security improvement because you
  2353. no longer need to grant users the SUPER privilege to enable
  2354. them to create triggers. However, the requirement that the
  2355. account named in a trigger's DEFINER clause must have the
  2356. SUPER privilege has changed to a requirement for the TRIGGER
  2357. privilege. When upgrading from a previous version of MySQL 5.0
  2358. or 5.1 to MySQL 5.1.6 or newer, be sure to update your grant
  2359. tables by running mysql_upgrade. This will assign the TRIGGER
  2360. privilege to all accounts that had the SUPER privilege. If you
  2361. fail to update the grant tables, triggers may fail when
  2362. activated. After updating the grant tables, you can revoke the
  2363. SUPER privilege from those accounts that no longer otherwise
  2364. require it.
  2365. * Some keywords may be reserved in MySQL 5.1 that were not
  2366. reserved in MySQL 5.0. See Section 8.3, "Reserved Words."
  2367. * The BACKUP TABLE, and RESTORE TABLE statements are deprecated.
  2368. mysqldump or mysqlhotcopy can be used as alternatives.
  2369. * The LOAD DATA FROM MASTER and LOAD TABLE FROM MASTER
  2370. statements are deprecated. See Section 12.5.2.2, "LOAD DATA
  2371. FROM MASTER Syntax," for recommended alternatives.
  2372. * The INSTALL PLUGIN and UNINSTALL PLUGIN statements that are
  2373. used for the plugin API are new. So is the WITH PARSER clause
  2374. for FULLTEXT index creation that associates a parser plugin
  2375. with a full-text index. Section 22.2, "The MySQL Plugin API."
  2376. C API Changes:
  2377. * Incompatible change: As of MySQL 5.1.7, the
  2378. mysql_stmt_attr_get() C API function returns a boolean rather
  2379. than an unsigned int for STMT_ATTR_UPDATE_MAX_LENGTH.
  2380. (Bug#16144: http://bugs.mysql.com/bug.php?id=16144)
  2381. 2.4.2. Downgrading MySQL
  2382. This section describes what you should do to downgrade to an older
  2383. MySQL version in the unlikely case that the previous version
  2384. worked better than the new one.
  2385. If you are downgrading within the same release series (for
  2386. example, from 5.0.13 to 5.0.12) the general rule is that you just
  2387. have to install the new binaries on top of the old ones. There is
  2388. no need to do anything with the databases. As always, however, it
  2389. is always a good idea to make a backup.
  2390. The following items form a checklist of things you should do
  2391. whenever you perform a downgrade:
  2392. * Read the upgrading section for the release series from which
  2393. you are downgrading to be sure that it does not have any
  2394. features you really need. See Section 2.4.1, "Upgrading
  2395. MySQL."
  2396. * If there is a downgrading section for that version, you should
  2397. read that as well.
  2398. * To see which new features were added between the version to
  2399. which you are downgrading and your current version, see the
  2400. change logs (Appendix C, "MySQL Change History").
  2401. * Check Section 2.4.3, "Checking Whether Tables or Indexes Must
  2402. Be Rebuilt," to see whether changes to table formats or to
  2403. character sets or collations were made between your current
  2404. version of MySQL and the version to which you are downgrading.
  2405. If so and these changes result in an incompatibility between
  2406. MySQL versions, you will need to downgrade the affected tables
  2407. using the instructions in Section 2.4.4, "Rebuilding or
  2408. Repairing Tables or Indexes."
  2409. In most cases, you can move the MySQL format files and data files
  2410. between different versions on the same architecture as long as you
  2411. stay within versions for the same release series of MySQL.
  2412. If you downgrade from one release series to another, there may be
  2413. incompatibilities in table storage formats. In this case, use
  2414. mysqldump to dump your tables before downgrading. After
  2415. downgrading, reload the dump file using mysql or mysqlimport to
  2416. re-create your tables. For examples, see Section 2.4.5, "Copying
  2417. MySQL Databases to Another Machine."
  2418. A typical symptom of a downward-incompatible table format change
  2419. when you downgrade is that you cannot open tables. In that case,
  2420. use the following procedure:
  2421. 1. Stop the older MySQL server that you are downgrading to.
  2422. 2. Restart the newer MySQL server you are downgrading from.
  2423. 3. Dump any tables that were inaccessible to the older server by
  2424. using mysqldump to create a dump file.
  2425. 4. Stop the newer MySQL server and restart the older one.
  2426. 5. Reload the dump file into the older server. Your tables should
  2427. be accessible.
  2428. It might also be the case that system tables in the mysql database
  2429. have changed and that downgrading introduces some loss of
  2430. functionality or requires some adjustments. Here are some
  2431. examples:
  2432. * Trigger creation requires the TRIGGER privilege as of MySQL
  2433. 5.1. In MySQL 5.0, there is no TRIGGER privilege and SUPER is
  2434. required instead. If you downgrade from MySQL 5.1 to 5.0, you
  2435. will need to give the SUPER privilege to those accounts that
  2436. had the TRIGGER privilege in 5.1.
  2437. * Triggers were added in MySQL 5.0, so if you downgrade from 5.0
  2438. to 4.1, you cannot use triggers at all.
  2439. * The mysql.proc.comment column definition changed between MySQL
  2440. 5.1 and 5.5. After a downgrade from 5.5 to 5.1, this table is
  2441. seen as corrupt and in need of repair. To workaround this
  2442. problem, execute mysql_upgrade from the version of MySQL to
  2443. which you downgraded.
  2444. 2.4.2.1. Downgrading to MySQL 5.0
  2445. When downgrading to MySQL 5.0 from MySQL 5.1, you should keep in
  2446. mind the following issues relating to features found in MySQL 5.1,
  2447. but not in MySQL 5.0:
  2448. * Partitioning. MySQL 5.0 does not support user-defined
  2449. partitioning. If a table was created as a partitioned table in
  2450. 5.1 (or if an table created in a previous version of MySQL was
  2451. altered to include partitions after an upgrade to 5.1), the
  2452. table is accessible after downgrade only if you do one of the
  2453. following:
  2454. + Export the table using mysqldump and then drop it in
  2455. MySQL 5.1; import the table again following the downgrade
  2456. to MySQL 5.0.
  2457. + Prior to the downgrade, remove the table's partitioning
  2458. using ALTER TABLE table_name REMOVE PARTITIONING.
  2459. * Event Scheduler. MySQL 5.0 does not support scheduled events.
  2460. If your databases contain scheduled event definitions, you
  2461. should prevent them from being dumped when you use mysqldump
  2462. by using the --skip-events option. (See Section 4.5.4,
  2463. "mysqldump --- A Database Backup Program.")
  2464. * Stored routines. MySQL 5.1.21 added a number of new columns
  2465. to the mysql.proc table in which stored routine definitions
  2466. are stored. If you are downgrading from MySQL 5.1.21 or later
  2467. to MySQL 5.0, you cannot import the MySQL 5.1 routine
  2468. definitions into MySQL 5.0.46 or earlier using the dump of
  2469. mysql.proc created by mysqldump (such as when using the
  2470. --all-databases option). Instead, you should run mysqldump
  2471. --routines prior to performing the downgrade and run the
  2472. stored routines DDL statements following the downgrade.
  2473. See Bug#11986: http://bugs.mysql.com/bug.php?id=11986,
  2474. Bug#30029: http://bugs.mysql.com/bug.php?id=30029, and
  2475. Bug#30660: http://bugs.mysql.com/bug.php?id=30660, for more
  2476. information.
  2477. * Triggers. Trigger creation requires the TRIGGER privilege as
  2478. of MySQL 5.1. In MySQL 5.0, there is no TRIGGER privilege and
  2479. SUPER is required instead. If you downgrade from MySQL 5.1 to
  2480. 5.0, you will need to give the SUPER privilege to those
  2481. accounts that had the TRIGGER privilege in 5.1.
  2482. 2.4.3. Checking Whether Tables or Indexes Must Be Rebuilt
  2483. A binary upgrade or downgrade is one that installs one version of
  2484. MySQL "in place" over an existing version, without dumping and
  2485. reloading tables:
  2486. 1. Stop the server for the existing version if it is running.
  2487. 2. Install a different version of MySQL. This is an upgrade if
  2488. the new version is higher than the original version, a
  2489. downgrade if the version is lower.
  2490. 3. Start the server for the new version.
  2491. In many cases, the tables from the previous version of MySQL can
  2492. be used without problem by the new version. However, sometimes
  2493. changes occur that require tables or table indexes to be rebuilt,
  2494. as described in this section. If you have tables that are affected
  2495. by any of the issues described here, rebuild the tables or indexes
  2496. as necessary using the instructions given in Section 2.4.4,
  2497. "Rebuilding or Repairing Tables or Indexes."
  2498. Table Incompatibilities
  2499. After a binary upgrade to MySQL 5.1 from a MySQL 5.0 installation
  2500. that contains ARCHIVE tables, accessing those tables causes the
  2501. server to crash, even if you have run mysql_upgrade or CHECK TABLE
  2502. ... FOR UPGRADE. To work around this problem, use mysqldump to
  2503. dump all ARCHIVE tables before upgrading, and reload them into
  2504. MySQL 5.1 after upgrading. The same problem occurs for binary
  2505. downgrades from MySQL 5.1 to 5.0.
  2506. Index Incompatibilities
  2507. If you perform a binary upgrade without dumping and reloading
  2508. tables, you cannot upgrade directly from MySQL 4.1 to 5.1 or
  2509. higher. This occurs due to an incompatible change in the MyISAM
  2510. table index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
  2511. repair all MyISAM tables. Then upgrade from MySQL 5.0 to 5.1 and
  2512. check and repair your tables.
  2513. Modifications to the handling of character sets or collations
  2514. might change the character sort order, which causes the ordering
  2515. of entries in any index that uses an affected character set or
  2516. collation to be incorrect. Such changes result in several possible
  2517. problems:
  2518. * Comparison results that differ from previous results
  2519. * Inability to find some index values due to misordered index
  2520. entries
  2521. * Misordered ORDER BY results
  2522. * Tables that CHECK TABLE reports as being in need of repair
  2523. The solution to these problems is to rebuild any indexes that use
  2524. an affected character set or collation, either by dropping and
  2525. re-creating the indexes, or by dumping and reloading the entire
  2526. table. For information about rebuilding indexes, see Section
  2527. 2.4.4, "Rebuilding or Repairing Tables or Indexes."
  2528. To check whether a table has indexes that must be rebuilt, consult
  2529. the following list. It indicates which versions of MySQL
  2530. introduced character set or collation changes that require indexes
  2531. to be rebuilt. Each entry indicates the version in which the
  2532. change occurred and the character sets or collations that the
  2533. change affects. If the change is associated with a particular bug
  2534. report, the bug number is given.
  2535. The list applies both for binary upgrades and downgrades. For
  2536. example, Bug#27877: http://bugs.mysql.com/bug.php?id=27877 was
  2537. fixed in MySQL 5.1.24 and 5.4.0, so it applies to upgrades from
  2538. versions older than 5.1.24 to 5.1.24 or newer, and to downgrades
  2539. from 5.1.24 or newer to versions older than 5.1.24.
  2540. In many cases, you can use CHECK TABLE ... FOR UPGRADE to identify
  2541. tables for which index rebuilding is required. (It will report:
  2542. Table upgrade required. Please do "REPAIR TABLE `tbl_name`" or
  2543. dump/reload to fix it!) In these cases, you can also use
  2544. mysqlcheck --check-upgrade or mysql_upgrade, which execute CHECK
  2545. TABLE. However, the use of CHECK TABLE applies only after
  2546. upgrades, not downgrades. Also, CHECK TABLE is not applicable to
  2547. all storage engines. For details about which storage engines CHECK
  2548. TABLE supports, see Section 12.4.2.3, "CHECK TABLE Syntax."
  2549. Changes that cause index rebuilding to be necessary:
  2550. * MySQL 5.0.48, 5.1.21
  2551. (Bug#29461: http://bugs.mysql.com/bug.php?id=29461)
  2552. Affects indexes for columns that use any of these character
  2553. sets: eucjpms, euc_kr, gb2312, latin7, macce, ujis
  2554. Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
  2555. as of MySQL 5.1.29, 5.4.0 (see
  2556. Bug#39585: http://bugs.mysql.com/bug.php?id=39585).
  2557. * MySQL 5.0.48, 5.1.23
  2558. (Bug#27562: http://bugs.mysql.com/bug.php?id=27562)
  2559. Affects indexes that use the ascii_general_ci collation for
  2560. columns that contain any of these characters: '`' GRAVE
  2561. ACCENT, '[' LEFT SQUARE BRACKET, '\' REVERSE SOLIDUS, ']'
  2562. RIGHT SQUARE BRACKET, '~' TILDE
  2563. Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
  2564. as of MySQL 5.1.29, 5.4.0 (see
  2565. Bug#39585: http://bugs.mysql.com/bug.php?id=39585).
  2566. * MySQL 5.1.24, 5.4.0
  2567. (Bug#27877: http://bugs.mysql.com/bug.php?id=27877)
  2568. Affects indexes that use the utf8_general_ci or
  2569. ucs2_general_ci collation for columns that contain 'ß' LATIN
  2570. SMALL LETTER SHARP S (German).
  2571. Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
  2572. as of MySQL 5.1.30, 5.4.0 (see
  2573. Bug#40053: http://bugs.mysql.com/bug.php?id=40053).
  2574. 2.4.4. Rebuilding or Repairing Tables or Indexes
  2575. This section describes how to rebuild a table. This can be
  2576. necessitated by changes to MySQL such as how data types are
  2577. handled or changes to character set handling. For example, an
  2578. error in a collation might have been corrected, necessitating a
  2579. table rebuild to update the indexes for character columns that use
  2580. the collation. (For examples, see Section 2.4.3, "Checking Whether
  2581. Tables or Indexes Must Be Rebuilt.") It might also be that a table
  2582. repair or upgrade should be done as indicated by a table check
  2583. operation such as that performed by CHECK TABLE, mysqlcheck, or
  2584. mysql_upgrade.
  2585. Methods for rebuilding a table include dumping and reloading it,
  2586. or using ALTER TABLE or REPAIR TABLE.
  2587. Note
  2588. If you are rebuilding tables because a different version of MySQL
  2589. will not handle them after a binary (in-place) upgrade or
  2590. downgrade, you must use the dump-and-reload method. Dump the
  2591. tables before upgrading or downgrading using your original version
  2592. of MySQL. Then reload the tables after upgrading or downgrading.
  2593. If you use the dump-and-reload method of rebuilding tables only
  2594. for the purpose of rebuilding indexes, you can perform the dump
  2595. either before or after upgrading or downgrading. Reloading still
  2596. must be done afterward.
  2597. To rebuild a table by dumping and reloading it, use mysqldump to
  2598. create a dump file and mysql to reload the file:
  2599. shell> mysqldump db_name t1 > dump.sql
  2600. shell> mysql db_name < dump.sql
  2601. To rebuild all the tables in a single database, specify the
  2602. database name without any following table name:
  2603. shell> mysqldump db_name > dump.sql
  2604. shell> mysql db_name < dump.sql
  2605. To rebuild all tables in all databases, use the --all-databases
  2606. option:
  2607. shell> mysqldump --all-databases > dump.sql
  2608. shell> mysql < dump.sql
  2609. To rebuild a table with ALTER TABLE, use a "null" alteration; that
  2610. is, an ALTER TABLE statement that "changes" the table to use the
  2611. storage engine that it already has. For example, if t1 is a MyISAM
  2612. table, use this statement:
  2613. mysql> ALTER TABLE t1 ENGINE = MyISAM;
  2614. If you are not sure which storage engine to specify in the ALTER
  2615. TABLE statement, use SHOW CREATE TABLE to display the table
  2616. definition.
  2617. If you must rebuild a table because a table checking operation
  2618. indicates that the table is corrupt or needs an upgrade, you can
  2619. use REPAIR TABLE if that statement supports the table's storage
  2620. engine. For example, to repair a MyISAM table, use this statement:
  2621. mysql> REPAIR TABLE t1;
  2622. For storage engines such as InnoDB that REPAIR TABLE does not
  2623. support, use mysqldump to create a dump file and mysql to reload
  2624. the file, as described earlier.
  2625. For specifics about which storage engines REPAIR TABLE supports,
  2626. see Section 12.4.2.6, "REPAIR TABLE Syntax."
  2627. mysqlcheck --repair provides command-line access to the REPAIR
  2628. TABLE statement. This can be a more convenient means of repairing
  2629. tables because you can use the --databases or --all-databases
  2630. option to repair all tables in specific databases or all
  2631. databases, respectively:
  2632. shell> mysqlcheck --repair --databases db_name ...
  2633. shell> mysqlcheck --repair --all-databases
  2634. 2.4.5. Copying MySQL Databases to Another Machine
  2635. You can copy the .frm, .MYI, and .MYD files for MyISAM tables
  2636. between different architectures that support the same
  2637. floating-point format. (MySQL takes care of any byte-swapping
  2638. issues.) See Section 13.5, "The MyISAM Storage Engine."
  2639. In cases where you need to transfer databases between different
  2640. architectures, you can use mysqldump to create a file containing
  2641. SQL statements. You can then transfer the file to the other
  2642. machine and feed it as input to the mysql client.
  2643. Use mysqldump --help to see what options are available.
  2644. The easiest (although not the fastest) way to move a database
  2645. between two machines is to run the following commands on the
  2646. machine on which the database is located:
  2647. shell> mysqladmin -h 'other_hostname' create db_name
  2648. shell> mysqldump db_name | mysql -h 'other_hostname' db_name
  2649. If you want to copy a database from a remote machine over a slow
  2650. network, you can use these commands:
  2651. shell> mysqladmin create db_name
  2652. shell> mysqldump -h 'other_hostname' --compress db_name | mysql db_na
  2653. me
  2654. You can also store the dump in a file, transfer the file to the
  2655. target machine, and then load the file into the database there.
  2656. For example, you can dump a database to a compressed file on the
  2657. source machine like this:
  2658. shell> mysqldump --quick db_name | gzip > db_name.gz
  2659. Transfer the file containing the database contents to the target
  2660. machine and run these commands there:
  2661. shell> mysqladmin create db_name
  2662. shell> gunzip < db_name.gz | mysql db_name
  2663. You can also use mysqldump and mysqlimport to transfer the
  2664. database. For large tables, this is much faster than simply using
  2665. mysqldump. In the following commands, DUMPDIR represents the full
  2666. path name of the directory you use to store the output from
  2667. mysqldump.
  2668. First, create the directory for the output files and dump the
  2669. database:
  2670. shell> mkdir DUMPDIR
  2671. shell> mysqldump --tab=DUMPDIR db_name
  2672. Then transfer the files in the DUMPDIR directory to some
  2673. corresponding directory on the target machine and load the files
  2674. into MySQL there:
  2675. shell> mysqladmin create db_name # create database
  2676. shell> cat DUMPDIR/*.sql | mysql db_name # create tables in databas
  2677. e
  2678. shell> mysqlimport db_name DUMPDIR/*.txt # load data into tables
  2679. Do not forget to copy the mysql database because that is where the
  2680. grant tables are stored. You might have to run commands as the
  2681. MySQL root user on the new machine until you have the mysql
  2682. database in place.
  2683. After you import the mysql database on the new machine, execute
  2684. mysqladmin flush-privileges so that the server reloads the grant
  2685. table information.
  2686. 2.5. Installing MySQL on Windows
  2687. This section describes the process for installing MySQL on
  2688. Windows.
  2689. To run MySQL on Windows, you need the following:
  2690. * A Windows operating system such as Windows 2000, Windows XP,
  2691. Windows Vista, Windows Server 2003, or Windows Server 2008.
  2692. Both 32-bit and 64-bit versions are supported.
  2693. In addition to running MySQL as a standard application, you
  2694. can also run the MySQL server as a Windows service. By using a
  2695. service you can monitor and control the operation of the
  2696. server through the standard Windows service management tools.
  2697. For more information, see Section 2.5.5.6, "Starting MySQL as
  2698. a Windows Service."
  2699. Generally, you should install MySQL on Windows using an
  2700. account that has administrator rights. Otherwise, you may
  2701. encounter problems with certain operations such as editing the
  2702. PATH environment variable or accessing the Service Control
  2703. Manager. Once installed, MySQL does not need to be executed
  2704. using a user with Administrator privileges.
  2705. * TCP/IP protocol support.
  2706. * Enough space on the hard drive to unpack, install, and create
  2707. the databases in accordance with your requirements (generally
  2708. a minimum of 200 megabytes is recommended.)
  2709. For a list of limitations within the Windows version of MySQL, see
  2710. Section D.7.3, "Windows Platform Limitations."
  2711. In addition to the MySQL Server package, you may need or want
  2712. additional components to use MySQL with your application or
  2713. development environment. These include, but are not limited to:
  2714. * If you plan to connect to the MySQL server via ODBC, you need
  2715. a Connector/ODBC driver. For more information, including
  2716. installation and configuration instructions, see Section 21.1,
  2717. "MySQL Connector/ODBC."
  2718. * If you plan to use MySQL server with .NET applications, you
  2719. need the Connector/NET driver. For more information, including
  2720. installation and configuration instructions, see Section 21.2,
  2721. "MySQL Connector/NET."
  2722. MySQL distributions for Windows can be downloaded from
  2723. http://dev.mysql.com/downloads/. See Section 2.1.3, "How to Get
  2724. MySQL."
  2725. MySQL for Windows is available in several distribution formats,
  2726. detailed below. Generally speaking, you should use a binary
  2727. distribution that includes an installer. It is simpler to use than
  2728. the others, and you need no additional tools to get MySQL up and
  2729. running. The installer for the Windows version of MySQL, combined
  2730. with a GUI Config Wizard, automatically installs MySQL, creates an
  2731. option file, starts the server, and secures the default user
  2732. accounts.
  2733. * Binary installer distribution. The installable distribution
  2734. comes packaged as a Microsoft Windows Installer (MSI) package
  2735. that you can install manually or automatically on your
  2736. systems. Two formats are available, an essentials package that
  2737. contains all the files you need to install and configure
  2738. MySQL, but no additional components, and a complete package
  2739. that includes MySQL, configuration tools, benchmarks and other
  2740. components. For more information on the specific differences,
  2741. see Section 2.5.2, "Choosing An Installation Package"
  2742. For instructions on installing MySQL using one of the MSI
  2743. installation packages, see Section 2.5.3, "Installing MySQL
  2744. with the MSI Package."
  2745. * Standard binary distribution format packaged as a Zip file
  2746. containing all of the necessary files that you unpack into
  2747. your chosen location. This package contains all of the files
  2748. in the full Windows MSI Installer package, but does not
  2749. including an installation program.
  2750. For instructions on installing MySQL using the Zip file, see
  2751. Section 2.5.5, "Installing MySQL from a noinstall Zip
  2752. Archive."
  2753. * The source distribution contains all the code and support
  2754. files for building the executables using the Visual Studio
  2755. compiler system.
  2756. For instructions on building MySQL from source on Windows, see
  2757. Section 2.5.10, "Installing MySQL from Source on Windows."
  2758. MySQL on Windows considerations:
  2759. * Large Table Support
  2760. If you need tables with a size larger than 4GB, install MySQL
  2761. on an NTFS or newer file system. Don't forget to use MAX_ROWS
  2762. and AVG_ROW_LENGTH when you create tables. See Section
  2763. 12.1.17, "CREATE TABLE Syntax."
  2764. * MySQL and Virus Checking Software
  2765. Using virus scanning software such as Norton/Symantec
  2766. Anti-Virus on directories containing MySQL data and temporary
  2767. tables can cause issues, both in terms of the performance of
  2768. MySQL and the virus-scanning software mis-identifying the
  2769. contents of the files as containing spam. This is because of
  2770. the fingerprinting mechanism used by the virus scanning
  2771. software, and the way in which MySQL rapidly updates different
  2772. files, which may be identified as a potential security risk.
  2773. After installing MySQL Server, it is recommended that you
  2774. disable virus scanning on the main directory (datadir) being
  2775. used to store your MySQL table data. There is usually a system
  2776. built into the virus scanning software to allow certain
  2777. directories to be specifically ignored during virus scanning.
  2778. In addition, by default, MySQL creates temporary files in the
  2779. standard Windows temporary directory. To prevent the temporary
  2780. files also being scanned, you should configure a separate
  2781. temporary directory for MySQL temporary files and add this to
  2782. the virus scanning exclusion list. To do this, add a
  2783. configuration option for the tmpdir parameter to your my.ini
  2784. configuration file. For more information, see Section 2.5.5.2,
  2785. "Creating an Option File."
  2786. 2.5.1. Windows Installation Layout
  2787. For MySQL 5.1 on Windows, the default installation directory is
  2788. C:\Program Files\MySQL\MySQL Server 5.1. Some Windows users prefer
  2789. to install in C:\mysql, the directory that formerly was used as
  2790. the default. However, the layout of the subdirectories remains the
  2791. same.
  2792. For MySQL 5.1.23 and earlier, all of the files are located within
  2793. this parent directory, using the following structure:
  2794. Table 2.2. Installation Layout for Windows using MySQL 5.1.23 and
  2795. earlier
  2796. Directory Contents of Directory
  2797. bin Client programs and the mysqld server
  2798. data Log files, databases
  2799. Docs Manual in CHM format
  2800. examples Example programs and scripts
  2801. include Include (header) files
  2802. lib Libraries
  2803. scripts Utility scripts
  2804. share Error message files
  2805. For MySQL 5.1.24 and later, the default location of data directory
  2806. was changed. The remainder of the directory structure remains the
  2807. same:
  2808. Table 2.3. Installation Layout for Windows using MySQL 5.1.24 and
  2809. later
  2810. Directory Contents of Directory
  2811. bin Client programs and the mysqld server
  2812. C:\Documents and Settings\All Users\Application Data\MySQL Log
  2813. files, databases
  2814. Docs Manual in CHM format
  2815. examples Example programs and scripts
  2816. include Include (header) files
  2817. lib Libraries
  2818. scripts Utility scripts
  2819. share Error message files
  2820. 2.5.2. Choosing An Installation Package
  2821. For MySQL 5.1, there are three installation packages to choose
  2822. from when installing MySQL on Windows:
  2823. Packaging
  2824. Feature Essentials Complete Zip (No-install)
  2825. Installer Yes Yes No
  2826. Directory-only
  2827. MySQL Server Instance Config Wizard Yes Yes No
  2828. Test Suite No Yes Yes
  2829. MySQL Server Yes Yes Yes
  2830. MySQL Client Programs Yes Yes Yes
  2831. C Headers/Libraries Yes Yes Yes
  2832. Embedded Server No Optional Yes
  2833. Scripts and Examples No Optional Yes
  2834. In the above table:
  2835. * Yes indiciates that the component is installed by default.
  2836. * No indicates that the component is not installed or included.
  2837. * Optional indicates that the component is included with the
  2838. package, but not installed unless explicitly requested using
  2839. the Custom installation mode.
  2840. The workflow for installing using the MSI installer is shown
  2841. below:
  2842. Figure 2.1. Installation Workflow for Windows using MSI
  2843. Installation Workflow for Windows using MSI
  2844. The workflow for installing using the MSI installer is shown
  2845. below:
  2846. Figure 2.2. Installation Workflow for Windows using Zip
  2847. Installation Workflow for Windows using Zip
  2848. Note
  2849. For the Essentials and Complete packages in the MSI installer, you
  2850. can select individual components to be installed by using the
  2851. Custom mode, including disable the components confiurated for
  2852. installation by default.
  2853. Full details on the components are suggested uses are provided
  2854. below for reference:
  2855. * Windows Essentials --- this package has a file name similar to
  2856. mysql-essential-5.1.46-win32.msi and is supplied as a
  2857. Microsoft Installer (MSI) package. The package includes the
  2858. minimum set of files needed to install MySQL on Windows,
  2859. including the MySQL Server Instance Config Wizard. This
  2860. package does not include optional components such as the
  2861. embedded server, developer headers and libraries or benchmark
  2862. suite.
  2863. To install using this package, see Section 2.5.3, "Installing
  2864. MySQL with the MSI Package."
  2865. * Windows MSI Installer (Complete) --- this package has a file
  2866. name similar to mysql-5.1.46-win32.zip and contains all files
  2867. needed for a complete Windows installation, including the
  2868. MySQL Server Instance Config Wizard. This package includes
  2869. optional components such as the embedded server and benchmark
  2870. suite.
  2871. To install using this package, see Section 2.5.3, "Installing
  2872. MySQL with the MSI Package."
  2873. * Without installer --- this package has a file name similar to
  2874. mysql-noinstall-5.1.46-win32.zip and contains all the files
  2875. found in the Complete install package, with the exception of
  2876. the MySQL Server Instance Config Wizard. This package does not
  2877. include an automated installer, and must be manually installed
  2878. and configured.
  2879. The Essentials package is recommended for most users. Both the
  2880. Essentials and Complete distributions are available as an .msi
  2881. file for use with the Windows Installer. The Noinstall
  2882. distribution is packaged as Zip archives. To use Zip archives, you
  2883. must have a tool that can unpack .zip files.
  2884. When using the MSI installers you can automate the installation
  2885. process. For more information, see Section 2.5.3.2, "Installing
  2886. MySQL Automatically using MSI." To automate the creation of a
  2887. MySQL instance, see Section 2.5.4.13, "Creating an Instance from
  2888. the Command Line."
  2889. Your choice of install package affects the installation process
  2890. you must follow. If you choose to install either the Essentials or
  2891. Complete install packages, see Section 2.5.3, "Installing MySQL
  2892. with the MSI Package." If you choose to install MySQL from the
  2893. Noinstall archive, see Section 2.5.5, "Installing MySQL from a
  2894. noinstall Zip Archive."
  2895. 2.5.3. Installing MySQL with the MSI Package
  2896. The MSI package are designed to install and configure MySQL in
  2897. such a way that you can immediately get started using MySQL.
  2898. The MySQL Installation Wizard and MySQL Config Wizard are
  2899. available in the Essentials and Complete install packages. They
  2900. are recommended for most standard MySQL installations. Exceptions
  2901. include users who need to install multiple instances of MySQL on a
  2902. single server host and advanced users who want complete control of
  2903. server configuration.
  2904. * For information on installing using the GUI MSI installer
  2905. process, see Section 2.5.3, "Installing MySQL with the MSI
  2906. Package."
  2907. * For information on installing using the command line using the
  2908. MSI package, see Section 2.5.3.2, "Installing MySQL
  2909. Automatically using MSI."
  2910. * If you have previously installed MySQL using the MSI package
  2911. and want to remove MySQL, see Section 2.5.3.3, "Removing MySQL
  2912. Installed from the MSI Package."
  2913. The workflow sequence for using the installer is shown in the
  2914. figure below:
  2915. Figure 2.3. Installation Workflow for Windows using MSI Installer
  2916. Installation Workflow for Windows using MSI Installer
  2917. Note
  2918. Microsoft Windows XP and later include a firewall which
  2919. specifically blocks ports. If you plan on using MySQL through a
  2920. network port then you should open and create an exception for this
  2921. port before performing the installation. To check and if necessary
  2922. add an exception to the firewall settings:
  2923. 1. First ensure that you are logged in as an Administrator or a
  2924. user with Administrator privileges.
  2925. 2. Go to the Control Panel, and double click the Windows Firewall
  2926. icon.
  2927. 3. Choose the Allow a program through Windows Firewall option and
  2928. click the Add port button.
  2929. 4. Enter MySQL into the Name text box and 3306 (or the port of
  2930. your choice) into the Port number text box.
  2931. 5. Also ensure that the TCP protocol radio button is selected.
  2932. 6. If you wish, you can also limit access to the MySQL server by
  2933. choosing the Change scope button.
  2934. 7. Confirm your choices by clicking the OK button.
  2935. Additionally, when running the MySQL Installation Wizard on
  2936. Windows Vista, ensure that you are logged in as a user with
  2937. administrative rights.
  2938. Note
  2939. When using Windows Vista, you may want to disable User Account
  2940. Control (UAC) before performing the installation. If you do not do
  2941. so, then MySQL may be identified as a security risk, which will
  2942. mean that you need to enable MySQL. You can disable the security
  2943. checking by following these instructions:
  2944. 1. Open Control Panel.
  2945. 2. Under the User Accounts and Family Safety, select Add or
  2946. remove user accounts.
  2947. 3. Click on the Got to the main User Accounts page link.
  2948. 4. Click on Turn User Account Control on or off. You may be
  2949. prompted to provide permission to change this setting. Click
  2950. Continue.
  2951. 5. Deselect or unceck the checkbox next to Use User Account
  2952. Control (UAC) to help protect your computer. Click OK to save
  2953. the setting.
  2954. You will need to restart to complete the process. Click Restart
  2955. Now to reboot the machine and apply the changes. You can then
  2956. follow the instructions below for installing Windows.
  2957. 2.5.3.1. Using the MySQL Installation Wizard
  2958. MySQL Installation Wizard is an installer for the MySQL server
  2959. that uses the latest installer technologies for Microsoft Windows.
  2960. The MySQL Installation Wizard, in combination with the MySQL
  2961. Config Wizard, allows a user to install and configure a MySQL
  2962. server that is ready for use immediately after installation.
  2963. The MySQL Installation Wizard uses the standard Microsoft
  2964. Installer Engine (MSI) system is the standard installer for all
  2965. MySQL server distributions, version 4.1.5 and higher. Users of
  2966. previous versions of MySQL need to shut down and remove their
  2967. existing MySQL installations manually before installing MySQL with
  2968. the MySQL Installation Wizard. See Section 2.5.3.1.6, "Upgrading
  2969. MySQL with the Installation Wizard," for more information on
  2970. upgrading from a previous version.
  2971. If you are upgrading an installation from MySQL 5.1.31 or earlier
  2972. to MySQL 5.1.32 or later, read the notes provided in Section
  2973. 2.5.3.1.6, "Upgrading MySQL with the Installation Wizard."
  2974. The Microsoft Windows Installer Engine was updated with the
  2975. release of Windows XP; those using a previous version of Windows
  2976. can reference this Microsoft Knowledge Base article
  2977. (http://support.microsoft.com/default.aspx?scid=kb;EN-US;292539)
  2978. for information on upgrading to the latest version of the Windows
  2979. Installer Engine.
  2980. In addition, Microsoft has introduced the WiX (Windows Installer
  2981. XML) toolkit. This is the first highly acknowledged Open Source
  2982. project from Microsoft. We have switched to WiX because it is an
  2983. Open Source project and it allows us to handle the complete
  2984. Windows installation process in a flexible manner using scripts.
  2985. Improving the MySQL Installation Wizard depends on the support and
  2986. feedback of users like you. If you find that the MySQL
  2987. Installation Wizard is lacking some feature important to you, or
  2988. if you discover a bug, please report it in our bugs database using
  2989. the instructions given in Section 1.7, "How to Report Bugs or
  2990. Problems."
  2991. 2.5.3.1.1. Downloading and Starting the MySQL Installation Wizard
  2992. The MySQL installation packages can be downloaded from
  2993. http://dev.mysql.com/downloads/. If the package you download is
  2994. contained within a Zip archive, you need to extract the archive
  2995. first.
  2996. The process for starting the wizard depends on the contents of the
  2997. installation package you download. If there is a setup.exe file
  2998. present, double-click it to start the installation process. If
  2999. there is an .msi file present, double-click it to start the
  3000. installation process.
  3001. 2.5.3.1.2. Choosing an Install Type
  3002. There are three installation types available: Typical, Complete,
  3003. and Custom.
  3004. The Typical installation type installs the MySQL server, the mysql
  3005. command-line client, and the command-line utilities. The
  3006. command-line clients and utilities include mysqldump, myisamchk,
  3007. and several other tools to help you manage the MySQL server.
  3008. The Complete installation type installs all components included in
  3009. the installation package. The full installation package includes
  3010. components such as the embedded server library, the benchmark
  3011. suite, support scripts, and documentation.
  3012. The Custom installation type gives you complete control over which
  3013. packages you wish to install and the installation path that is
  3014. used. See Section 2.5.3.1.3, "The Custom Install Dialog," for more
  3015. information on performing a custom install.
  3016. If you choose the Typical or Complete installation types and click
  3017. the Next button, you advance to the confirmation screen to verify
  3018. your choices and begin the installation. If you choose the Custom
  3019. installation type and click the Next button, you advance to the
  3020. custom installation dialog, described in Section 2.5.3.1.3, "The
  3021. Custom Install Dialog."
  3022. 2.5.3.1.3. The Custom Install Dialog
  3023. If you wish to change the installation path or the specific
  3024. components that are installed by the MySQL Installation Wizard,
  3025. choose the Custom installation type.
  3026. A tree view on the left side of the custom install dialog lists
  3027. all available components. Components that are not installed have a
  3028. red X icon; components that are installed have a gray icon. To
  3029. change whether a component is installed, click on that component's
  3030. icon and choose a new option from the drop-down list that appears.
  3031. You can change the default installation path by clicking the
  3032. Change... button to the right of the displayed installation path.
  3033. After choosing your installation components and installation path,
  3034. click the Next button to advance to the confirmation dialog.
  3035. 2.5.3.1.4. The Confirmation Dialog
  3036. Once you choose an installation type and optionally choose your
  3037. installation components, you advance to the confirmation dialog.
  3038. Your installation type and installation path are displayed for you
  3039. to review.
  3040. To install MySQL if you are satisfied with your settings, click
  3041. the Install button. To change your settings, click the Back
  3042. button. To exit the MySQL Installation Wizard without installing
  3043. MySQL, click the Cancel button.
  3044. After installation is complete, you have the option of registering
  3045. with the MySQL web site. Registration gives you access to post in
  3046. the MySQL forums at forums.mysql.com (http://forums.mysql.com),
  3047. along with the ability to report bugs at bugs.mysql.com
  3048. (http://bugs.mysql.com) and to subscribe to our newsletter. The
  3049. final screen of the installer provides a summary of the
  3050. installation and gives you the option to launch the MySQL Config
  3051. Wizard, which you can use to create a configuration file, install
  3052. the MySQL service, and configure security settings.
  3053. 2.5.3.1.5. Changes Made by MySQL Installation Wizard
  3054. Once you click the Install button, the MySQL Installation Wizard
  3055. begins the installation process and makes certain changes to your
  3056. system which are described in the sections that follow.
  3057. Changes to the Registry
  3058. The MySQL Installation Wizard creates one Windows registry key in
  3059. a typical install situation, located in
  3060. HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB.
  3061. The MySQL Installation Wizard creates a key named after the major
  3062. version of the server that is being installed, such as MySQL
  3063. Server 5.1. It contains two string values, Location and Version.
  3064. The Location string contains the path to the installation
  3065. directory. In a default installation it contains C:\Program
  3066. Files\MySQL\MySQL Server 5.1\. The Version string contains the
  3067. release number. For example, for an installation of MySQL Server
  3068. 5.1.46, the key contains a value of 5.1.46.
  3069. These registry keys are used to help external tools identify the
  3070. installed location of the MySQL server, preventing a complete scan
  3071. of the hard-disk to determine the installation path of the MySQL
  3072. server. The registry keys are not required to run the server, and
  3073. if you install MySQL using the noinstall Zip archive, the registry
  3074. keys are not created.
  3075. Changes to the Start Menu
  3076. The MySQL Installation Wizard creates a new entry in the Windows
  3077. Start menu under a common MySQL menu heading named after the major
  3078. version of MySQL that you have installed. For example, if you
  3079. install MySQL 5.1, the MySQL Installation Wizard creates a MySQL
  3080. Server 5.1 section in the Start menu.
  3081. The following entries are created within the new Start menu
  3082. section:
  3083. * MySQL Command Line Client: This is a shortcut to the mysql
  3084. command-line client and is configured to connect as the root
  3085. user. The shortcut prompts for a root user password when you
  3086. connect.
  3087. * MySQL Server Instance Config Wizard: This is a shortcut to the
  3088. MySQL Config Wizard. Use this shortcut to configure a newly
  3089. installed server, or to reconfigure an existing server.
  3090. * MySQL Documentation: This is a link to the MySQL server
  3091. documentation that is stored locally in the MySQL server
  3092. installation directory. This option is not available when the
  3093. MySQL server is installed using the Essentials installation
  3094. package.
  3095. Changes to the File System
  3096. The MySQL Installation Wizard by default installs the MySQL 5.1
  3097. server to C:\Program Files\MySQL\MySQL Server 5.1, where Program
  3098. Files is the default location for applications in your system, and
  3099. 5.1 is the major version of your MySQL server. This is the
  3100. recommended location for the MySQL server, replacing the former
  3101. default location C:\mysql.
  3102. By default, all MySQL applications are stored in a common
  3103. directory at C:\Program Files\MySQL, where Program Files is the
  3104. default location for applications in your Windows installation. A
  3105. typical MySQL installation on a developer machine might look like
  3106. this:
  3107. C:\Program Files\MySQL\MySQL Server 5.1
  3108. C:\Program Files\MySQL\MySQL Workbench 5.1 OSS
  3109. This approach makes it easier to manage and maintain all MySQL
  3110. applications installed on a particular system.
  3111. In MySQL 5.1.23 and earlier, the default location for the data
  3112. files used by MySQL is located within the corresponding MySQL
  3113. Server installation directory. For MySQL 5.1.24 and later, the
  3114. default location of the data directory is the AppData directory
  3115. configured for the user that installed the MySQL application.
  3116. 2.5.3.1.6. Upgrading MySQL with the Installation Wizard
  3117. The MySQL Installation Wizard can perform server upgrades
  3118. automatically using the upgrade capabilities of MSI. That means
  3119. you do not need to remove a previous installation manually before
  3120. installing a new release. The installer automatically shuts down
  3121. and removes the previous MySQL service before installing the new
  3122. version.
  3123. Automatic upgrades are available only when upgrading between
  3124. installations that have the same major and minor version numbers.
  3125. For example, you can upgrade automatically from MySQL 5.1.34 to
  3126. MySQL 5.1.37, but not from MySQL 5.0 to MySQL 5.1.
  3127. In MySQL 5.1.32 and later, the EXE version of the MSI installer
  3128. packages were removed. When upgrading an existing MySQL
  3129. installation from the old EXE based installer to the MSI based
  3130. installer, please keep the following notes in mind:
  3131. * The MSI installer will not identify an existing installation
  3132. that was installed using the old EXE installer. This means
  3133. that the installer will not stop the existing server, or
  3134. detect that the existing password is required before
  3135. installing the new version. To work around this:
  3136. 1. Stop the current server manually using net stop or
  3137. mysqladmin shutdown.
  3138. 2. Remove the existing installation manually by using the
  3139. Add/Remove Programs control panel. This will keep the
  3140. existing configuration and data files, as these are not
  3141. removed automatically.
  3142. 3. Install the new version of MySQL using the MSI installer.
  3143. When running the installation, skip updating the security
  3144. by deselecting the checkbox on the security screen.
  3145. 4. Complete the installation, and then start the server
  3146. again. You should be able to login with your existing
  3147. user and password credentials.
  3148. * You can only upgrade the version and release using the MSI
  3149. installer. For example, you can upgrade an open source
  3150. installation with an open source installer. You cannot upgrade
  3151. an open source installation using the enterprise installer.
  3152. See Section 2.5.7, "Upgrading MySQL on Windows."
  3153. 2.5.3.2. Installing MySQL Automatically using MSI
  3154. The Microsoft Installer (MSI) supports a both a quiet and a
  3155. passive mode that can be used to install MySQL automatically
  3156. without requireing intervention. You can use this either in
  3157. scripts to automatically install MySQL or through a terminal
  3158. connection such as Telnet where you do not have access to the
  3159. standard Windows user interface. The MSI packages can also be used
  3160. in combination with Microsoft's Group Policy system (part of
  3161. Windows Server 2003 and Windows Server 2008) to install MySQL
  3162. across multiple machines.
  3163. To install MySQL from one of the MSI packages automatically from
  3164. the command line (or within a script), you need to use the
  3165. msiexec.exe tool. For example, to perform a quiet installation
  3166. (which shows no dialog boxes or progress):
  3167. shell> msiexec /i /quiet mysql-5.1.39.msi
  3168. The /i indicates that you want to perform an installation. The
  3169. /quiet option indicates that you want no interactive elements.
  3170. To provide a dialog box showing the progress during installation,
  3171. and the dialog boxes providing information on the installation and
  3172. registration of MySQL, use /passive mode instead of /quiet:
  3173. shell> msiexec /i /passive mysql-5.1.39.msi
  3174. Regardless of the mode of the installation, installing the package
  3175. in this manner performs a 'Typical' installation, and installs the
  3176. default components into the standard location.
  3177. You can also use this method to uninstall MySQL by using the
  3178. /uninstall or /x options:
  3179. shell> msiexec /x /quiet mysql-5.1.39.msi
  3180. To install MySQL and configure a MySQL instance from the command
  3181. line, see Section 2.5.4.13, "Creating an Instance from the Command
  3182. Line."
  3183. For information on using MSI packages to install software
  3184. automatically using Group Policy, see How to use Group Policy to
  3185. remotely install software in Windows Server 2003
  3186. (http://support.microsoft.com/kb/816102).
  3187. 2.5.3.3. Removing MySQL Installed from the MSI Package
  3188. To uninstall a MySQL where you have used the MSI packages, you
  3189. must use the Add/Remove Programs tool within Control Panel. To do
  3190. this:
  3191. 1. Right click on the start menu and choose Control Panel.
  3192. 2. If the Control Panel is set to category mode (you will see
  3193. Pick a category at the top of the Control Panel window),
  3194. double click on Add or Remove Programs. If the Control is set
  3195. to classic mode, doubgle click on the Add or Remove Programs
  3196. icon.
  3197. 3. Find MySQL in the list of installed software. MySQL Server is
  3198. installed against major version numbers (MySQL 5.0, MySQL 5.1,
  3199. etc.). Select the version that you want to remove and click
  3200. Remove.
  3201. 4. You will be prompted to confirm the removal. Click Yes to
  3202. remove MySQL.
  3203. When MySQL is removed using this method, only the installed
  3204. components are removed. Any database information (including the
  3205. tables and data), import or export files, log files, and binary
  3206. logs produced during execution are kept in their configured
  3207. location.
  3208. 2.5.4. MySQL Server Instance Config Wizard
  3209. The MySQL Server Instance Config Wizard helps automate the process
  3210. of configuring your server. It creates a custom MySQL
  3211. configuration file (my.ini or my.cnf) by asking you a series of
  3212. questions and then applying your responses to a template to
  3213. generate the configuration file that is tuned to your
  3214. installation.
  3215. The complete and essential MSI installation packages include the
  3216. MySQL Server Instance Config Wizard in the MySQL 5.1 server. The
  3217. MySQL Server Instance Config Wizard is only available for Windows.
  3218. The workflow sequence for using the MySQL Server Instance Config
  3219. Wizard is shown in the figure below:
  3220. Figure 2.4. MySQL Server Instance Config Wizard Workflow
  3221. MySQL Server Instance Config Wizard Workflow
  3222. 2.5.4.1. Starting the MySQL Server Instance Config Wizard
  3223. The MySQL Server Instance Config Wizard is normally started as
  3224. part of the installation process. You should only need to run the
  3225. MySQL Server Instance Config Wizard again when you need to change
  3226. the configuration parameters of your server.
  3227. If you chose not to open a port prior to installing MySQL on
  3228. Windows Vista, you can choose to use the MySQL Server Instance
  3229. Config Wizard after installation. However, you must open a port in
  3230. the Windows Firewall. To do this see the instructions given in
  3231. Section 2.5.3.1.1, "Downloading and Starting the MySQL
  3232. Installation Wizard." Rather than opening a port, you also have
  3233. the option of adding MySQL as a program that bypasses the Windows
  3234. Firewall. One or the other option is sufficient --- you need not
  3235. do both. Additionally, when running the MySQL Server Config Wizard
  3236. on Windows Vista ensure that you are logged in as a user with
  3237. administrative rights.
  3238. MySQL Server Instance Config Wizard
  3239. You can launch the MySQL Config Wizard by clicking the MySQL
  3240. Server Instance Config Wizard entry in the MySQL section of the
  3241. Windows Start menu.
  3242. Alternatively, you can navigate to the bin directory of your MySQL
  3243. installation and launch the MySQLInstanceConfig.exe file directly.
  3244. The MySQL Server Instance Config Wizard places the my.ini file in
  3245. the installation directory for the MySQL server. This helps
  3246. associate configuration files with particular server instances.
  3247. To ensure that the MySQL server knows where to look for the my.ini
  3248. file, an argument similar to this is passed to the MySQL server as
  3249. part of the service installation:
  3250. --defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini"
  3251. Here, C:\Program Files\MySQL\MySQL Server 5.1 is replaced with the
  3252. installation path to the MySQL Server. The --defaults-file option
  3253. instructs the MySQL server to read the specified file for
  3254. configuration options when it starts.
  3255. Apart from making changes to the my.ini file by running the MySQL
  3256. Server Instance Config Wizard again, you can modify it by opening
  3257. it with a text editor and making any necessary changes. You can
  3258. also modify the server configuration with the
  3259. http://www.mysql.com/products/administrator/ utility. For more
  3260. information about server configuration, see Section 5.1.2, "Server
  3261. Command Options."
  3262. MySQL clients and utilities such as the mysql and mysqldump
  3263. command-line clients are not able to locate the my.ini file
  3264. located in the server installation directory. To configure the
  3265. client and utility applications, create a new my.ini file in the
  3266. Windows installation directory (for example, C:\WINDOWS).
  3267. Under Windows Server 2003, Windows Server 2000, Windows XP, and
  3268. Windows Vista MySQL Server Instance Config Wizard will configure
  3269. MySQL to work as a Windows service. To start and stop MySQL you
  3270. use the Services application that is supplied as part of the
  3271. Windows Administrator Tools.
  3272. 2.5.4.2. Choosing a Maintenance Option
  3273. If the MySQL Server Instance Config Wizard detects an existing
  3274. configuration file, you have the option of either reconfiguring
  3275. your existing server, or removing the server instance by deleting
  3276. the configuration file and stopping and removing the MySQL
  3277. service.
  3278. To reconfigure an existing server, choose the Re-configure
  3279. Instance option and click the Next button. Any existing
  3280. configuration file is not overwritten, but renamed (within the
  3281. same directory) using a timestamp (Windows) or sequential number
  3282. (Linux). To remove the existing server instance, choose the Remove
  3283. Instance option and click the Next button.
  3284. If you choose the Remove Instance option, you advance to a
  3285. confirmation window. Click the Execute button. The MySQL Server
  3286. Config Wizard stops and removes the MySQL service, and then
  3287. deletes the configuration file. The server installation and its
  3288. data folder are not removed.
  3289. If you choose the Re-configure Instance option, you advance to the
  3290. Configuration Type dialog where you can choose the type of
  3291. installation that you wish to configure.
  3292. 2.5.4.3. Choosing a Configuration Type
  3293. When you start the MySQL Server Instance Config Wizard for a new
  3294. MySQL installation, or choose the Re-configure Instance option for
  3295. an existing installation, you advance to the Configuration Type
  3296. dialog.
  3297. MySQL Server Instance Config Wizard: Configuration Type
  3298. There are two configuration types available: Detailed
  3299. Configuration and Standard Configuration. The Standard
  3300. Configuration option is intended for new users who want to get
  3301. started with MySQL quickly without having to make many decisions
  3302. about server configuration. The Detailed Configuration option is
  3303. intended for advanced users who want more fine-grained control
  3304. over server configuration.
  3305. If you are new to MySQL and need a server configured as a
  3306. single-user developer machine, the Standard Configuration should
  3307. suit your needs. Choosing the Standard Configuration option causes
  3308. the MySQL Config Wizard to set all configuration options
  3309. automatically with the exception of Service Options and Security
  3310. Options.
  3311. The Standard Configuration sets options that may be incompatible
  3312. with systems where there are existing MySQL installations. If you
  3313. have an existing MySQL installation on your system in addition to
  3314. the installation you wish to configure, the Detailed Configuration
  3315. option is recommended.
  3316. To complete the Standard Configuration, please refer to the
  3317. sections on Service Options and Security Options in Section
  3318. 2.5.4.10, "The Service Options Dialog," and Section 2.5.4.11, "The
  3319. Security Options Dialog," respectively.
  3320. 2.5.4.4. The Server Type Dialog
  3321. There are three different server types available to choose from.
  3322. The server type that you choose affects the decisions that the
  3323. MySQL Server Instance Config Wizard makes with regard to memory,
  3324. disk, and processor usage.
  3325. MySQL Server Instance Config Wizard: Server Type
  3326. * Developer Machine: Choose this option for a typical desktop
  3327. workstation where MySQL is intended only for personal use. It
  3328. is assumed that many other desktop applications are running.
  3329. The MySQL server is configured to use minimal system
  3330. resources.
  3331. * Server Machine: Choose this option for a server machine where
  3332. the MySQL server is running alongside other server
  3333. applications such as FTP, email, and Web servers. The MySQL
  3334. server is configured to use a moderate portion of the system
  3335. resources.
  3336. * Dedicated MySQL Server Machine: Choose this option for a
  3337. server machine that is intended to run only the MySQL server.
  3338. It is assumed that no other applications are running. The
  3339. MySQL server is configured to use all available system
  3340. resources.
  3341. Note
  3342. By selecting one of the preconfigured configurations, the values
  3343. and settings of various options in your my.cnf or my.ini will be
  3344. altered accordingly. The default values and options as described
  3345. in the reference manual may therefore be different to the options
  3346. and values that were created during the execution of the Config
  3347. Wizard.
  3348. 2.5.4.5. The Database Usage Dialog
  3349. The Database Usage dialog allows you to indicate the storage
  3350. engines that you expect to use when creating MySQL tables. The
  3351. option you choose determines whether the InnoDB storage engine is
  3352. available and what percentage of the server resources are
  3353. available to InnoDB.
  3354. MySQL Server Instance Config Wizard: Usage Dialog
  3355. * Multifunctional Database: This option enables both the InnoDB
  3356. and MyISAM storage engines and divides resources evenly
  3357. between the two. This option is recommended for users who use
  3358. both storage engines on a regular basis.
  3359. * Transactional Database Only: This option enables both the
  3360. InnoDB and MyISAM storage engines, but dedicates most server
  3361. resources to the InnoDB storage engine. This option is
  3362. recommended for users who use InnoDB almost exclusively and
  3363. make only minimal use of MyISAM.
  3364. * Non-Transactional Database Only: This option disables the
  3365. InnoDB storage engine completely and dedicates all server
  3366. resources to the MyISAM storage engine. This option is
  3367. recommended for users who do not use InnoDB.
  3368. The Config Wizard uses a template to generate the server
  3369. configuration file. The Database Usage dialog sets one of the
  3370. following option strings:
  3371. Multifunctional Database: MIXED
  3372. Transactional Database Only: INNODB
  3373. Non-Transactional Database Only: MYISAM
  3374. When these options are processed through the default template
  3375. (my-template.ini) the result is:
  3376. Multifunctional Database:
  3377. default-storage-engine=InnoDB
  3378. _myisam_pct=50
  3379. Transactional Database Only:
  3380. default-storage-engine=InnoDB
  3381. _myisam_pct=5
  3382. Non-Transactional Database Only:
  3383. default-storage-engine=MyISAM
  3384. _myisam_pct=100
  3385. skip-innodb
  3386. The _myisam_pct value is used to calculate the percentage of
  3387. resources dedicated to MyISAM. The remaining resources are
  3388. allocated to InnoDB.
  3389. 2.5.4.6. The InnoDB Tablespace Dialog
  3390. Some users may want to locate the InnoDB tablespace files in a
  3391. different location than the MySQL server data directory. Placing
  3392. the tablespace files in a separate location can be desirable if
  3393. your system has a higher capacity or higher performance storage
  3394. device available, such as a RAID storage system.
  3395. MySQL Server Instance Config Wizard: InnoDB Data Tablespace
  3396. To change the default location for the InnoDB tablespace files,
  3397. choose a new drive from the drop-down list of drive letters and
  3398. choose a new path from the drop-down list of paths. To create a
  3399. custom path, click the ... button.
  3400. If you are modifying the configuration of an existing server, you
  3401. must click the Modify button before you change the path. In this
  3402. situation you must move the existing tablespace files to the new
  3403. location manually before starting the server.
  3404. 2.5.4.7. The Concurrent Connections Dialog
  3405. To prevent the server from running out of resources, it is
  3406. important to limit the number of concurrent connections to the
  3407. MySQL server that can be established. The Concurrent Connections
  3408. dialog allows you to choose the expected usage of your server, and
  3409. sets the limit for concurrent connections accordingly. It is also
  3410. possible to set the concurrent connection limit manually.
  3411. MySQL Server Instance Config Wizard: Connections
  3412. * Decision Support (DSS)/OLAP: Choose this option if your server
  3413. does not require a large number of concurrent connections. The
  3414. maximum number of connections is set at 100, with an average
  3415. of 20 concurrent connections assumed.
  3416. * Online Transaction Processing (OLTP): Choose this option if
  3417. your server requires a large number of concurrent connections.
  3418. The maximum number of connections is set at 500.
  3419. * Manual Setting: Choose this option to set the maximum number
  3420. of concurrent connections to the server manually. Choose the
  3421. number of concurrent connections from the drop-down box
  3422. provided, or enter the maximum number of connections into the
  3423. drop-down box if the number you desire is not listed.
  3424. 2.5.4.8. The Networking and Strict Mode Options Dialog
  3425. Use the Networking Options dialog to enable or disable TCP/IP
  3426. networking and to configure the port number that is used to
  3427. connect to the MySQL server.
  3428. MySQL Server Instance Config Wizard: Network Configuration
  3429. TCP/IP networking is enabled by default. To disable TCP/IP
  3430. networking, uncheck the box next to the Enable TCP/IP Networking
  3431. option.
  3432. Port 3306 is used by default. To change the port used to access
  3433. MySQL, choose a new port number from the drop-down box or type a
  3434. new port number directly into the drop-down box. If the port
  3435. number you choose is in use, you are prompted to confirm your
  3436. choice of port number.
  3437. Set the Server SQL Mode to either enable or disable strict mode.
  3438. Enabling strict mode (default) makes MySQL behave more like other
  3439. database management systems. If you run applications that rely on
  3440. MySQL's old "forgiving" behavior, make sure to either adapt those
  3441. applications or to disable strict mode. For more information about
  3442. strict mode, see Section 5.1.8, "Server SQL Modes."
  3443. 2.5.4.9. The Character Set Dialog
  3444. The MySQL server supports multiple character sets and it is
  3445. possible to set a default server character set that is applied to
  3446. all tables, columns, and databases unless overridden. Use the
  3447. Character Set dialog to change the default character set of the
  3448. MySQL server.
  3449. MySQL Server Instance Config Wizard: Character Set
  3450. * Standard Character Set: Choose this option if you want to use
  3451. latin1 as the default server character set. latin1 is used for
  3452. English and many Western European languages.
  3453. * Best Support For Multilingualism: Choose this option if you
  3454. want to use utf8 as the default server character set. This is
  3455. a Unicode character set that can store characters from many
  3456. different languages.
  3457. * Manual Selected Default Character Set / Collation: Choose this
  3458. option if you want to pick the server's default character set
  3459. manually. Choose the desired character set from the provided
  3460. drop-down list.
  3461. 2.5.4.10. The Service Options Dialog
  3462. On Windows platforms, the MySQL server can be installed as a
  3463. Windows service. When installed this way, the MySQL server can be
  3464. started automatically during system startup, and even restarted
  3465. automatically by Windows in the event of a service failure.
  3466. The MySQL Server Instance Config Wizard installs the MySQL server
  3467. as a service by default, using the service name MySQL. If you do
  3468. not wish to install the service, uncheck the box next to the
  3469. Install As Windows Service option. You can change the service name
  3470. by picking a new service name from the drop-down box provided or
  3471. by entering a new service name into the drop-down box.
  3472. Note
  3473. Service names can include any legal character except forward (/)
  3474. or backward (\) slashes, and must be less than 256 characters
  3475. long.
  3476. Warning
  3477. If you are installing multiple versions of MySQL onto the same
  3478. machine, you must choose a different service name for each version
  3479. that you install. If you do not choose a different service for
  3480. each installed version then the service manager information will
  3481. be inconsistent and this will cause problems when you try to
  3482. uninstall a previous version.
  3483. If you have already installed multiple versions using the same
  3484. service name, you must manually edit the contents of the
  3485. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services parameters
  3486. within the Windows registry to update the association of the
  3487. service name with the correct server version.
  3488. Typically, when installing multiple versions you create a service
  3489. name based on the version information. For example, you might
  3490. install MySQL 5.x as mysql5, or specific versions such as MySQL
  3491. 5.1.30 as mysql50130.
  3492. To install the MySQL server as a service but not have it started
  3493. automatically at startup, uncheck the box next to the Launch the
  3494. MySQL Server Automatically option.
  3495. 2.5.4.11. The Security Options Dialog
  3496. The content of the security options portion of the MySQL Server
  3497. Instance Configuration Wizard will depend on whether this is a new
  3498. installation, or modifying an existing installation.
  3499. * Setting the root password for a new installation
  3500. It is strongly recommended that you set a root password for
  3501. your MySQL server, and the MySQL Server Instance Config Wizard
  3502. requires by default that you do so. If you do not wish to set
  3503. a root password, uncheck the box next to the Modify Security
  3504. Settings option.
  3505. MySQL Server Instance Config Wizard: Security
  3506. * To set the root password, enter the desired password into both
  3507. the New root password and Confirm boxes.
  3508. Setting the root password for an existing installation
  3509. If you are modifying the configuration of an existing
  3510. configuration, or you are installing an upgrade and the MySQL
  3511. Server Instance Configuration Wizard has detected an existing
  3512. MySQL system, then you must enter the existing password for
  3513. root before changing the configuration information.
  3514. MySQL Server Instance Config Wizard: Security (Existing
  3515. Installation)
  3516. If you want to change the current root password, enter the
  3517. desired new password into both the New root password and
  3518. Confirm boxes.
  3519. To allow root logins from across the network, check the box next
  3520. to the Enable root access from remote machines option. This
  3521. decreases the security of your root account.
  3522. To create an anonymous user account, check the box next to the
  3523. Create An Anonymous Account option. Creating an anonymous account
  3524. can decrease server security and cause login and permission
  3525. difficulties. For this reason, it is not recommended.
  3526. 2.5.4.12. The Confirmation Dialog
  3527. The final dialog in the MySQL Server Instance Config Wizard is the
  3528. Confirmation Dialog. To start the configuration process, click the
  3529. Execute button. To return to a previous dialog, click the Back
  3530. button. To exit the MySQL Server Instance Config Wizard without
  3531. configuring the server, click the Cancel button.
  3532. MySQL Server Instance Config Wizard: Confirmation
  3533. After you click the Execute button, the MySQL Server Instance
  3534. Config Wizard performs a series of tasks and displays the progress
  3535. onscreen as the tasks are performed.
  3536. The MySQL Server Instance Config Wizard first determines
  3537. configuration file options based on your choices using a template
  3538. prepared by MySQL developers and engineers. This template is named
  3539. my-template.ini and is located in your server installation
  3540. directory.
  3541. The MySQL Config Wizard then writes these options to the
  3542. corresponding configuration file.
  3543. If you chose to create a service for the MySQL server, the MySQL
  3544. Server Instance Config Wizard creates and starts the service. If
  3545. you are reconfiguring an existing service, the MySQL Server
  3546. Instance Config Wizard restarts the service to apply your
  3547. configuration changes.
  3548. If you chose to set a root password, the MySQL Config Wizard
  3549. connects to the server, sets your new root password, and applies
  3550. any other security settings you may have selected.
  3551. After the MySQL Server Instance Config Wizard has completed its
  3552. tasks, it displays a summary. Click the Finish button to exit the
  3553. MySQL Server Config Wizard.
  3554. 2.5.4.13. Creating an Instance from the Command Line
  3555. In addition to using the GUI interface to the MySQL Server
  3556. Instance Config Wizard, you can also create instances
  3557. automatically from the command line.
  3558. To use the MySQL Server Instance Config Wizard on the command
  3559. line, you need to use the MySQLInstanceConfig.exe command that is
  3560. installed with MySQL in the bin directory within the installation
  3561. directory. MySQLInstanceConfig.exe takes a number of command-line
  3562. arguments the set the properties that would normally be selected
  3563. through the GUI interface, and then creates a new configuration
  3564. file (my.ini) by combining these selections with a template
  3565. configuration file to produce the working configuration file.
  3566. The main command line options are provided in the table below.
  3567. Some of the options are required, while some options are optional.
  3568. Table 2.4. MySQL Server Instance Config Wizard Command Line
  3569. Options
  3570. Option Description
  3571. Required Parameters
  3572. -nPRODUCTNAME The name of the instance when installed
  3573. -pPATH Path of the base directory for installation. This is
  3574. equivalent to the directory when using the basedir configuration
  3575. parameter
  3576. -vVERSION The version tag to use for this installation
  3577. Action to Perform
  3578. -i Install an instance
  3579. -r Remove an instance
  3580. -s Stop an existing instance
  3581. -q Perform the operation quietly
  3582. -lFILENAME Sae the installation progress in a logfile
  3583. Config File to Use
  3584. -tFILENAME Path to the template config file that will be used to
  3585. generate the installed configuration file
  3586. -cFILENAME Path to a config file to be generated
  3587. The -t and -c options work together to set the configuration
  3588. parameters for a new instance. The -t option specifies the
  3589. template configuration file to use as the basic configuration,
  3590. which are then merged with the configuration parameters generated
  3591. by the MySQL Server Instance Config Wizard into the configuration
  3592. file specified by the -c option.
  3593. A sample template file, my-template.ini is provided in the
  3594. toplevel MySQL installation directory. The file contains elements
  3595. are replaced automatically by the MySQL Server Instance Config
  3596. Wizard during configuration.
  3597. If you specify a configuration file that already exists, the
  3598. existing configuration file will be saved in the file with the
  3599. original, with the date and time added. For example, the mysql.ini
  3600. will be copied to mysql 2009-10-27 1646.ini.bak.
  3601. The parameters that you can specify on the command line are listed
  3602. in the table below.
  3603. Table 2.5. MySQL Server Instance Config Wizard Parameters
  3604. Parameter Description
  3605. ServiceName=$ Specify the name of the service to be created
  3606. AddBinToPath={yes | no} Specifies whether to add the binary
  3607. directory of MySQL to the standard PATH environment variable
  3608. ServerType={DEVELOPMENT | SERVER | DEDICATED} Specify the server
  3609. type. For more information, see Section 2.5.4.4, "The Server Type
  3610. Dialog"
  3611. DatabaseType={MIXED | INNODB | MYISAM} Specify the default
  3612. database type. For more information, see Section 2.5.4.5, "The
  3613. Database Usage Dialog"
  3614. ConnectionUsage={DSS | OLTP} Specify the type of connection
  3615. support, this automates the setting for the number of concurrent
  3616. connections (see the ConnectionCount parameter). For more
  3617. information, see Section 2.5.4.7, "The Concurrent Connections
  3618. Dialog"
  3619. ConnectionCount=# Specify the number of concurrent connections to
  3620. support. For more information, see Section 2.5.4.4, "The Server
  3621. Type Dialog"
  3622. SkipNetworking={yes | no} Specify whether network support should
  3623. be supported. Specifying yes disables network access altogether
  3624. Port=# Specify the network port number to use for network
  3625. connections. For more information, see Section 2.5.4.8, "The
  3626. Networking and Strict Mode Options Dialog"
  3627. StrictMode={yes | no} Specify whether to use the strict SQL mode.
  3628. For more information, see Section 2.5.4.8, "The Networking and
  3629. Strict Mode Options Dialog"
  3630. Charset=$ Specify the default character set. For more information,
  3631. see Section 2.5.4.9, "The Character Set Dialog"
  3632. RootPassword=$ Specify the root password
  3633. RootCurrentPassword=$ Specify the current root password then
  3634. stopping and/or reconfiguring an existing service
  3635. Note
  3636. When specifying options on the command line, you can enclose the
  3637. entire command-line option and the value you are specifying using
  3638. double quotes. This enables you to use spaces in the options. For
  3639. example, "-cC:\mysql.ini".
  3640. The following command installs a MySQL Server 5.1 instance from
  3641. the directory C:\Program Files\MySQL\MySQL Server 5.1 using the
  3642. service name MySQL51 and setting the root password to 1234.
  3643. shell> MySQLInstanceConfig.exe -i -q "-lC:\mysql_install_log.txt" »
  3644. "-nMySQL Server 5.1" "-pC:\Program Files\MySQL\MySQL Server 5.1" -
  3645. v5.1.39 »
  3646. "-tmy-template.ini" "-cC:\mytest.ini" ServerType=DEVELOPMENT Datab
  3647. aseType=MIXED »
  3648. ConnectionUsage=DSS Port=3311 ServiceName=MySQL51 RootPassword=123
  3649. 4
  3650. In the above example, a log file will be generated in
  3651. mysql_install_log.txt containing the information about the
  3652. instance creation process. The log file generated by the above
  3653. example is shown below:
  3654. Welcome to the MySQL Server Instance Configuration Wizard 1.0.16.0
  3655. Date: 2009-10-27 17:07:21
  3656. Installing service ...
  3657. Product Name: MySQL Server 5.1
  3658. Version: 5.1.39
  3659. Installation Path: C:\Program Files\MySQL\MySQL Server 5.1\
  3660. Creating configuration file C:\mytest.ini using template my-template.
  3661. ini.
  3662. Options:
  3663. DEVELOPMENT
  3664. MIXED
  3665. DSS
  3666. STRICTMODE
  3667. Variables:
  3668. port: 3311
  3669. default-character-set: latin1
  3670. basedir: "C:/Program Files/MySQL/MySQL Server 5.1/"
  3671. datadir: "C:/Program Files/MySQL/MySQL Server 5.1/Data/"
  3672. Creating Windows service entry.
  3673. Service name: "MySQL51"
  3674. Parameters: "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --
  3675. defaults-file="C:\mytest.ini" MySQL51.
  3676. Windows service MySQL51 installed.
  3677. When using the command-line, the return values in the following
  3678. table indicate an error performing the specified option.
  3679. Table 2.6. Return Value from MySQL Server Instance Config Wizard
  3680. Value Description
  3681. 2 Configuration template file cannot be found
  3682. 3 The Windows service entry cannot be created
  3683. 4 Could not connect to the Service Control Manager
  3684. 5 The MySQL service cannot be started
  3685. 6 The MySQL service cannot be stopped
  3686. 7 The security settings cannot be applied
  3687. 8 The configuration file cannot be written
  3688. 9 The Windows service entry cannot be removed
  3689. You can perform an installation of MySQL automatically using the
  3690. MSI packe. For more information, see Section 2.5.3.2, "Installing
  3691. MySQL Automatically using MSI."
  3692. 2.5.5. Installing MySQL from a noinstall Zip Archive
  3693. Users who are installing from the noinstall package can use the
  3694. instructions in this section to manually install MySQL. The
  3695. process for installing MySQL from a Zip archive is as follows:
  3696. 1. Extract the archive to the desired install directory
  3697. 2. Create an option file
  3698. 3. Choose a MySQL server type
  3699. 4. Start the MySQL server
  3700. 5. Secure the default user accounts
  3701. This process is described in the sections that follow.
  3702. 2.5.5.1. Extracting the Install Archive
  3703. To install MySQL manually, do the following:
  3704. 1. If you are upgrading from a previous version please refer to
  3705. Section 2.5.7, "Upgrading MySQL on Windows," before beginning
  3706. the upgrade process.
  3707. 2. Make sure that you are logged in as a user with administrator
  3708. privileges.
  3709. 3. Choose an installation location. Traditionally, the MySQL
  3710. server is installed in C:\mysql. The MySQL Installation Wizard
  3711. installs MySQL under C:\Program Files\MySQL. If you do not
  3712. install MySQL at C:\mysql, you must specify the path to the
  3713. install directory during startup or in an option file. See
  3714. Section 2.5.5.2, "Creating an Option File."
  3715. 4. Extract the install archive to the chosen installation
  3716. location using your preferred Zip archive tool. Some tools may
  3717. extract the archive to a folder within your chosen
  3718. installation location. If this occurs, you can move the
  3719. contents of the subfolder into the chosen installation
  3720. location.
  3721. 2.5.5.2. Creating an Option File
  3722. If you need to specify startup options when you run the server,
  3723. you can indicate them on the command line or place them in an
  3724. option file. For options that are used every time the server
  3725. starts, you may find it most convenient to use an option file to
  3726. specify your MySQL configuration. This is particularly true under
  3727. the following circumstances:
  3728. * The installation or data directory locations are different
  3729. from the default locations (C:\Program Files\MySQL\MySQL
  3730. Server 5.1 and C:\Program Files\MySQL\MySQL Server 5.1\data).
  3731. * You need to tune the server settings, such as memory, cache,
  3732. or InnoDB configuration information.
  3733. When the MySQL server starts on Windows, it looks for option files
  3734. in several locations, such as the Windows directory, C:\, and the
  3735. MySQL installation directory (for the full list of locations, see
  3736. Section 4.2.3.3, "Using Option Files"). The Windows directory
  3737. typically is named something like C:\WINDOWS. You can determine
  3738. its exact location from the value of the WINDIR environment
  3739. variable using the following command:
  3740. C:\> echo %WINDIR%
  3741. MySQL looks for options in each location first in the my.ini file,
  3742. and then in the my.cnf file. However, to avoid confusion, it is
  3743. best if you use only one file. If your PC uses a boot loader where
  3744. C: is not the boot drive, your only option is to use the my.ini
  3745. file. Whichever option file you use, it must be a plain text file.
  3746. You can also make use of the example option files included with
  3747. your MySQL distribution; see Section 4.2.3.3.2, "Preconfigured
  3748. Option Files."
  3749. An option file can be created and modified with any text editor,
  3750. such as Notepad. For example, if MySQL is installed in E:\mysql
  3751. and the data directory is in E:\mydata\data, you can create an
  3752. option file containing a [mysqld] section to specify values for
  3753. the basedir and datadir options:
  3754. [mysqld]
  3755. # set basedir to your installation path
  3756. basedir=E:/mysql
  3757. # set datadir to the location of your data directory
  3758. datadir=E:/mydata/data
  3759. Note that Windows path names are specified in option files using
  3760. (forward) slashes rather than backslashes. If you do use
  3761. backslashes, double them:
  3762. [mysqld]
  3763. # set basedir to your installation path
  3764. basedir=E:\\mysql
  3765. # set datadir to the location of your data directory
  3766. datadir=E:\\mydata\\data
  3767. The rules for use of backslash in option file values are given in
  3768. Section 4.2.3.3, "Using Option Files."
  3769. MySQL Enterprise For expert advice on the start-up options
  3770. appropriate to your circumstances, subscribe to the MySQL
  3771. Enterprise Monitor. For more information, see
  3772. http://www.mysql.com/products/enterprise/advisors.html.
  3773. In MySQL 5.1.23 and earlier, the MySQL installer places the data
  3774. directory directly under the directory where you install MySQL. On
  3775. MySQL 5.1.24 and later, the data directory is located within the
  3776. AppData directory for the user running MySQL.
  3777. If you would like to use a data directory in a different location,
  3778. you should copy the entire contents of the data directory to the
  3779. new location. For example, if you want to use E:\mydata as the
  3780. data directory instead, you must do two things:
  3781. 1. Move the entire data directory and all of its contents from
  3782. the default location (for example C:\Program Files\MySQL\MySQL
  3783. Server 5.1\data) to E:\mydata.
  3784. 2. Use a --datadir option to specify the new data directory
  3785. location each time you start the server.
  3786. 2.5.5.3. Selecting a MySQL Server Type
  3787. The following table shows the available servers for Windows in
  3788. MySQL 5.1.20 and earlier.
  3789. Binary Description
  3790. mysqld-nt Optimized binary with named-pipe support
  3791. mysqld Optimized binary without named-pipe support
  3792. mysqld-debug Like mysqld-nt, but compiled with full debugging and
  3793. automatic memory allocation checking
  3794. The following table shows the available servers for Windows in
  3795. MySQL 5.1.21 and later.
  3796. Binary Description
  3797. mysqld Optimized binary with named-pipe support
  3798. mysqld-debug Like mysqld, but compiled with full debugging and
  3799. automatic memory allocation checking
  3800. All of the preceding binaries are optimized for modern Intel
  3801. processors, but should work on any Intel i386-class or higher
  3802. processor.
  3803. Each of the servers in a distribution support the same set of
  3804. storage engines. The SHOW ENGINES statement displays which engines
  3805. a given server supports.
  3806. All Windows MySQL 5.1 servers have support for symbolic linking of
  3807. database directories.
  3808. MySQL supports TCP/IP on all Windows platforms. MySQL servers on
  3809. Windows support named pipes as indicated in the following list.
  3810. However, the default is to use TCP/IP regardless of platform.
  3811. (Named pipes are slower than TCP/IP in many Windows
  3812. configurations.)
  3813. Use of named pipes is subject to these conditions:
  3814. * Named pipes are enabled only if you start the server with the
  3815. --enable-named-pipe option. It is necessary to use this option
  3816. explicitly because some users have experienced problems with
  3817. shutting down the MySQL server when named pipes were used.
  3818. * For MySQL 5.1.20 and earlier, named-pipe connections are
  3819. allowed only by the mysqld-nt and mysqld-debug servers. For
  3820. MySQL 5.1.21 and later, the mysqld and mysqld-debug servers
  3821. both contain support for named-pipe connections.
  3822. Note
  3823. Most of the examples in this manual use mysqld as the server name.
  3824. If you choose to use a different server, such as mysqld-nt or
  3825. mysqld-debug, make the appropriate substitutions in the commands
  3826. that are shown in the examples.
  3827. 2.5.5.4. Starting the Server for the First Time
  3828. This section gives a general overview of starting the MySQL
  3829. server. The following sections provide more specific information
  3830. for starting the MySQL server from the command line or as a
  3831. Windows service.
  3832. The information here applies primarily if you installed MySQL
  3833. using the Noinstall version, or if you wish to configure and test
  3834. MySQL manually rather than with the GUI tools.
  3835. The examples in these sections assume that MySQL is installed
  3836. under the default location of C:\Program Files\MySQL\MySQL Server
  3837. 5.1. Adjust the path names shown in the examples if you have MySQL
  3838. installed in a different location.
  3839. Clients have two options. They can use TCP/IP, or they can use a
  3840. named pipe if the server supports named-pipe connections.
  3841. MySQL for Windows also supports shared-memory connections if the
  3842. server is started with the --shared-memory option. Clients can
  3843. connect through shared memory by using the --protocol=MEMORY
  3844. option.
  3845. For information about which server binary to run, see Section
  3846. 2.5.5.3, "Selecting a MySQL Server Type."
  3847. Testing is best done from a command prompt in a console window (or
  3848. "DOS window"). In this way you can have the server display status
  3849. messages in the window where they are easy to see. If something is
  3850. wrong with your configuration, these messages make it easier for
  3851. you to identify and fix any problems.
  3852. To start the server, enter this command:
  3853. C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --console
  3854. For a server that includes InnoDB support, you should see the
  3855. messages similar to those following as it starts (the path names
  3856. and sizes may differ):
  3857. InnoDB: The first specified datafile c:\ibdata\ibdata1 did not exist:
  3858. InnoDB: a new database to be created!
  3859. InnoDB: Setting file c:\ibdata\ibdata1 size to 209715200
  3860. InnoDB: Database physically writes the file full: wait...
  3861. InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be creat
  3862. ed
  3863. InnoDB: Setting log file c:\iblogs\ib_logfile0 size to 31457280
  3864. InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be creat
  3865. ed
  3866. InnoDB: Setting log file c:\iblogs\ib_logfile1 size to 31457280
  3867. InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be creat
  3868. ed
  3869. InnoDB: Setting log file c:\iblogs\ib_logfile2 size to 31457280
  3870. InnoDB: Doublewrite buffer not found: creating new
  3871. InnoDB: Doublewrite buffer created
  3872. InnoDB: creating foreign key constraint system tables
  3873. InnoDB: foreign key constraint system tables created
  3874. 011024 10:58:25 InnoDB: Started
  3875. When the server finishes its startup sequence, you should see
  3876. something like this, which indicates that the server is ready to
  3877. service client connections:
  3878. mysqld: ready for connections
  3879. Version: '5.1.46' socket: '' port: 3306
  3880. The server continues to write to the console any further
  3881. diagnostic output it produces. You can open a new console window
  3882. in which to run client programs.
  3883. If you omit the --console option, the server writes diagnostic
  3884. output to the error log in the data directory (C:\Program
  3885. Files\MySQL\MySQL Server 5.1\data by default). The error log is
  3886. the file with the .err extension.
  3887. Note
  3888. The accounts that are listed in the MySQL grant tables initially
  3889. have no passwords. After starting the server, you should set up
  3890. passwords for them using the instructions in Section 2.13,
  3891. "Post-Installation Setup and Testing."
  3892. 2.5.5.5. Starting MySQL from the Windows Command Line
  3893. The MySQL server can be started manually from the command line.
  3894. This can be done on any version of Windows.
  3895. To start the mysqld server from the command line, you should start
  3896. a console window (or "DOS window") and enter this command:
  3897. C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
  3898. The path to mysqld may vary depending on the install location of
  3899. MySQL on your system.
  3900. You can stop the MySQL server by executing this command:
  3901. C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root
  3902. shutdown
  3903. Note
  3904. If the MySQL root user account has a password, you need to invoke
  3905. mysqladmin with the -p option and supply the password when
  3906. prompted.
  3907. This command invokes the MySQL administrative utility mysqladmin
  3908. to connect to the server and tell it to shut down. The command
  3909. connects as the MySQL root user, which is the default
  3910. administrative account in the MySQL grant system. Note that users
  3911. in the MySQL grant system are wholly independent from any login
  3912. users under Windows.
  3913. If mysqld doesn't start, check the error log to see whether the
  3914. server wrote any messages there to indicate the cause of the
  3915. problem. The error log is located in the C:\Program
  3916. Files\MySQL\MySQL Server 5.1\data directory. It is the file with a
  3917. suffix of .err. You can also try to start the server as mysqld
  3918. --console; in this case, you may get some useful information on
  3919. the screen that may help solve the problem.
  3920. The last option is to start mysqld with the --standalone and
  3921. --debug options. In this case, mysqld writes a log file
  3922. C:\mysqld.trace that should contain the reason why mysqld doesn't
  3923. start. See MySQL Internals: Porting
  3924. (http://forge.mysql.com/wiki/MySQL_Internals_Porting).
  3925. Use mysqld --verbose --help to display all the options that mysqld
  3926. supports.
  3927. 2.5.5.6. Starting MySQL as a Windows Service
  3928. On Windows, the recommended way to run MySQL is to install it as a
  3929. Windows service, whereby MySQL starts and stops automatically when
  3930. Windows starts and stops. A MySQL server installed as a service
  3931. can also be controlled from the command line using NET commands,
  3932. or with the graphical Services utility. Generally, to install
  3933. MySQL as a Windows service you should be logged in using an
  3934. account that has administrator rights.
  3935. The Services utility (the Windows Service Control Manager) can be
  3936. found in the Windows Control Panel (under Administrative Tools on
  3937. Windows 2000, XP, Vista and Server 2003). To avoid conflicts, it
  3938. is advisable to close the Services utility while performing server
  3939. installation or removal operations from the command line.
  3940. Before installing MySQL as a Windows service, you should first
  3941. stop the current server if it is running by using the following
  3942. command:
  3943. C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin"
  3944. -u root shutdown
  3945. Note
  3946. If the MySQL root user account has a password, you need to invoke
  3947. mysqladmin with the -p option and supply the password when
  3948. prompted.
  3949. This command invokes the MySQL administrative utility mysqladmin
  3950. to connect to the server and tell it to shut down. The command
  3951. connects as the MySQL root user, which is the default
  3952. administrative account in the MySQL grant system. Note that users
  3953. in the MySQL grant system are wholly independent from any login
  3954. users under Windows.
  3955. Install the server as a service using this command:
  3956. C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install
  3957. The service-installation command does not start the server.
  3958. Instructions for that are given later in this section.
  3959. To make it easier to invoke MySQL programs, you can add the path
  3960. name of the MySQL bin directory to your Windows system PATH
  3961. environment variable:
  3962. * On the Windows desktop, right-click on the My Computer icon,
  3963. and select Properties.
  3964. * Next select the Advanced tab from the System Properties menu
  3965. that appears, and click the Environment Variables button.
  3966. * Under System Variables, select Path, and then click the Edit
  3967. button. The Edit System Variable dialogue should appear.
  3968. * Place your cursor at the end of the text appearing in the
  3969. space marked Variable Value. (Use the End key to ensure that
  3970. your cursor is positioned at the very end of the text in this
  3971. space.) Then enter the complete path name of your MySQL bin
  3972. directory (for example, C:\Program Files\MySQL\MySQL Server
  3973. 5.1\bin), Note that there should be a semicolon separating
  3974. this path from any values present in this field. Dismiss this
  3975. dialogue, and each dialogue in turn, by clicking OK until all
  3976. of the dialogues that were opened have been dismissed. You
  3977. should now be able to invoke any MySQL executable program by
  3978. typing its name at the DOS prompt from any directory on the
  3979. system, without having to supply the path. This includes the
  3980. servers, the mysql client, and all MySQL command-line
  3981. utilities such as mysqladmin and mysqldump.
  3982. You should not add the MySQL bin directory to your Windows
  3983. PATH if you are running multiple MySQL servers on the same
  3984. machine.
  3985. Warning
  3986. You must exercise great care when editing your system PATH by
  3987. hand; accidental deletion or modification of any portion of the
  3988. existing PATH value can leave you with a malfunctioning or even
  3989. unusable system.
  3990. The following additional arguments can be used in MySQL 5.1 when
  3991. installing the service:
  3992. * You can specify a service name immediately following the
  3993. --install option. The default service name is MySQL.
  3994. * If a service name is given, it can be followed by a single
  3995. option. By convention, this should be
  3996. --defaults-file=file_name to specify the name of an option
  3997. file from which the server should read options when it starts.
  3998. The use of a single option other than --defaults-file is
  3999. possible but discouraged. --defaults-file is more flexible
  4000. because it enables you to specify multiple startup options for
  4001. the server by placing them in the named option file.
  4002. * You can also specify a --local-service option following the
  4003. service name. This causes the server to run using the
  4004. LocalService Windows account that has limited system
  4005. privileges. This account is available only for Windows XP or
  4006. newer. If both --defaults-file and --local-service are given
  4007. following the service name, they can be in any order.
  4008. For a MySQL server that is installed as a Windows service, the
  4009. following rules determine the service name and option files that
  4010. the server uses:
  4011. * If the service-installation command specifies no service name
  4012. or the default service name (MySQL) following the --install
  4013. option, the server uses the a service name of MySQL and reads
  4014. options from the [mysqld] group in the standard option files.
  4015. * If the service-installation command specifies a service name
  4016. other than MySQL following the --install option, the server
  4017. uses that service name. It reads options from the [mysqld]
  4018. group and the group that has the same name as the service in
  4019. the standard option files. This allows you to use the [mysqld]
  4020. group for options that should be used by all MySQL services,
  4021. and an option group with the service name for use by the
  4022. server installed with that service name.
  4023. * If the service-installation command specifies a
  4024. --defaults-file option after the service name, the server
  4025. reads options only from the [mysqld] group of the named file
  4026. and ignores the standard option files.
  4027. As a more complex example, consider the following command:
  4028. C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
  4029. --install MySQL --defaults-file=C:\my-opts.cnf
  4030. Here, the default service name (MySQL) is given after the
  4031. --install option. If no --defaults-file option had been given,
  4032. this command would have the effect of causing the server to read
  4033. the [mysqld] group from the standard option files. However,
  4034. because the --defaults-file option is present, the server reads
  4035. options from the [mysqld] option group, and only from the named
  4036. file.
  4037. You can also specify options as Start parameters in the Windows
  4038. Services utility before you start the MySQL service.
  4039. Once a MySQL server has been installed as a service, Windows
  4040. starts the service automatically whenever Windows starts. The
  4041. service also can be started immediately from the Services utility,
  4042. or by using a NET START MySQL command. The NET command is not case
  4043. sensitive.
  4044. When run as a service, mysqld has no access to a console window,
  4045. so no messages can be seen there. If mysqld does not start, check
  4046. the error log to see whether the server wrote any messages there
  4047. to indicate the cause of the problem. The error log is located in
  4048. the MySQL data directory (for example, C:\Program
  4049. Files\MySQL\MySQL Server 5.1\data). It is the file with a suffix
  4050. of .err.
  4051. When a MySQL server has been installed as a service, and the
  4052. service is running, Windows stops the service automatically when
  4053. Windows shuts down. The server also can be stopped manually by
  4054. using the Services utility, the NET STOP MySQL command, or the
  4055. mysqladmin shutdown command.
  4056. You also have the choice of installing the server as a manual
  4057. service if you do not wish for the service to be started
  4058. automatically during the boot process. To do this, use the
  4059. --install-manual option rather than the --install option:
  4060. C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install-m
  4061. anual
  4062. To remove a server that is installed as a service, first stop it
  4063. if it is running by executing NET STOP MySQL. Then use the
  4064. --remove option to remove it:
  4065. C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --remove
  4066. If mysqld is not running as a service, you can start it from the
  4067. command line. For instructions, see Section 2.5.5.5, "Starting
  4068. MySQL from the Windows Command Line."
  4069. Please see Section 2.5.6, "Troubleshooting a MySQL Installation
  4070. Under Windows," if you encounter difficulties during installation.
  4071. 2.5.5.7. Testing The MySQL Installation
  4072. You can test whether the MySQL server is working by executing any
  4073. of the following commands:
  4074. C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow"
  4075. C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow" -u root
  4076. mysql
  4077. C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" version
  4078. status proc
  4079. C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql" test
  4080. Note
  4081. By default, mysqlshow will try to connect using the ODBC user.
  4082. This user is not created by default. You should specify a valid
  4083. user, or root with the right password to check the operation of
  4084. the server.
  4085. If mysqld is slow to respond to TCP/IP connections from client
  4086. programs, there is probably a problem with your DNS. In this case,
  4087. start mysqld with the --skip-name-resolve option and use only
  4088. localhost and IP numbers in the Host column of the MySQL grant
  4089. tables.
  4090. You can force a MySQL client to use a named-pipe connection rather
  4091. than TCP/IP by specifying the --pipe or --protocol=PIPE option, or
  4092. by specifying . (period) as the host name. Use the --socket option
  4093. to specify the name of the pipe if you do not want to use the
  4094. default pipe name.
  4095. Note that if you have set a password for the root account, deleted
  4096. the anonymous account, or created a new user account, then you
  4097. must use the appropriate -u and -p options with the commands shown
  4098. above in order to connect with the MySQL Server. See Section
  4099. 4.2.2, "Connecting to the MySQL Server."
  4100. For more information about mysqlshow, see Section 4.5.6,
  4101. "mysqlshow --- Display Database, Table, and Column Information."
  4102. 2.5.6. Troubleshooting a MySQL Installation Under Windows
  4103. When installing and running MySQL for the first time, you may
  4104. encounter certain errors that prevent the MySQL server from
  4105. starting. The purpose of this section is to help you diagnose and
  4106. correct some of these errors.
  4107. Your first resource when troubleshooting server issues is the
  4108. error log. The MySQL server uses the error log to record
  4109. information relevant to the error that prevents the server from
  4110. starting. The error log is located in the data directory specified
  4111. in your my.ini file. The default data directory location is
  4112. C:\Program Files\MySQL\MySQL Server 5.1\data. See Section 5.2.2,
  4113. "The Error Log."
  4114. Another source of information regarding possible errors is the
  4115. console messages displayed when the MySQL service is starting. Use
  4116. the NET START MySQL command from the command line after installing
  4117. mysqld as a service to see any error messages regarding the
  4118. starting of the MySQL server as a service. See Section 2.5.5.6,
  4119. "Starting MySQL as a Windows Service."
  4120. The following examples show other common error messages you may
  4121. encounter when installing MySQL and starting the server for the
  4122. first time:
  4123. * If the MySQL server cannot find the mysql privileges database
  4124. or other critical files, you may see these messages:
  4125. System error 1067 has occurred.
  4126. Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't
  4127. exist
  4128. These messages often occur when the MySQL base or data
  4129. directories are installed in different locations than the
  4130. default locations (C:\Program Files\MySQL\MySQL Server 5.1 and
  4131. C:\Program Files\MySQL\MySQL Server 5.1\data, respectively).
  4132. This situation may occur when MySQL is upgraded and installed
  4133. to a new location, but the configuration file is not updated
  4134. to reflect the new location. In addition, there may be old and
  4135. new configuration files that conflict. Be sure to delete or
  4136. rename any old configuration files when upgrading MySQL.
  4137. If you have installed MySQL to a directory other than
  4138. C:\Program Files\MySQL\MySQL Server 5.1, you need to ensure
  4139. that the MySQL server is aware of this through the use of a
  4140. configuration (my.ini) file. The my.ini file needs to be
  4141. located in your Windows directory, typically C:\WINDOWS. You
  4142. can determine its exact location from the value of the WINDIR
  4143. environment variable by issuing the following command from the
  4144. command prompt:
  4145. C:\> echo %WINDIR%
  4146. An option file can be created and modified with any text
  4147. editor, such as Notepad. For example, if MySQL is installed in
  4148. E:\mysql and the data directory is D:\MySQLdata, you can
  4149. create the option file and set up a [mysqld] section to
  4150. specify values for the basedir and datadir options:
  4151. [mysqld]
  4152. # set basedir to your installation path
  4153. basedir=E:/mysql
  4154. # set datadir to the location of your data directory
  4155. datadir=D:/MySQLdata
  4156. Note that Windows path names are specified in option files
  4157. using (forward) slashes rather than backslashes. If you do use
  4158. backslashes, double them:
  4159. [mysqld]
  4160. # set basedir to your installation path
  4161. basedir=C:\\Program Files\\MySQL\\MySQL Server 5.1
  4162. # set datadir to the location of your data directory
  4163. datadir=D:\\MySQLdata
  4164. The rules for use of backslash in option file values are given
  4165. in Section 4.2.3.3, "Using Option Files."
  4166. If you change the datadir value in your MySQL configuration
  4167. file, you must move the contents of the existing MySQL data
  4168. directory before restarting the MySQL server.
  4169. See Section 2.5.5.2, "Creating an Option File."
  4170. * If you reinstall or upgrade MySQL without first stopping and
  4171. removing the existing MySQL service and install MySQL using
  4172. the MySQL Config Wizard, you may see this error:
  4173. Error: Cannot create Windows service for MySql. Error: 0
  4174. This occurs when the Config Wizard tries to install the
  4175. service and finds an existing service with the same name.
  4176. One solution to this problem is to choose a service name other
  4177. than mysql when using the configuration wizard. This allows
  4178. the new service to be installed correctly, but leaves the
  4179. outdated service in place. Although this is harmless, it is
  4180. best to remove old services that are no longer in use.
  4181. To permanently remove the old mysql service, execute the
  4182. following command as a user with administrative privileges, on
  4183. the command-line:
  4184. C:\> sc delete mysql
  4185. [SC] DeleteService SUCCESS
  4186. If the sc utility is not available for your version of
  4187. Windows, download the delsrv utility from
  4188. http://www.microsoft.com/windows2000/techinfo/reskit/tools/exi
  4189. sting/delsrv-o.asp and use the delsrv mysql syntax.
  4190. 2.5.7. Upgrading MySQL on Windows
  4191. This section lists some of the steps you should take when
  4192. upgrading MySQL on Windows.
  4193. 1. Review Section 2.4.1, "Upgrading MySQL," for additional
  4194. information on upgrading MySQL that is not specific to
  4195. Windows.
  4196. 2. You should always back up your current MySQL installation
  4197. before performing an upgrade. See Section 6.2, "Database
  4198. Backup Methods."
  4199. 3. Download the latest Windows distribution of MySQL from
  4200. http://dev.mysql.com/downloads/.
  4201. 4. Before upgrading MySQL, you must stop the server. If the
  4202. server is installed as a service, stop the service with the
  4203. following command from the command prompt:
  4204. C:\> NET STOP MySQL
  4205. If you are not running the MySQL server as a service, use the
  4206. following command to stop it:
  4207. C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root
  4208. shutdown
  4209. Note
  4210. If the MySQL root user account has a password, you need to
  4211. invoke mysqladmin with the -p option and supply the password
  4212. when prompted.
  4213. 5. When upgrading to MySQL 5.1 from a version previous to 4.1.5,
  4214. or when upgrading from a version of MySQL installed from a Zip
  4215. archive to a version of MySQL installed with the MySQL
  4216. Installation Wizard, you must manually remove the previous
  4217. installation and MySQL service (if the server is installed as
  4218. a service).
  4219. To remove the MySQL service, use the following command:
  4220. C:\> C:\mysql\bin\mysqld --remove
  4221. If you do not remove the existing service, the MySQL
  4222. Installation Wizard may fail to properly install the new MySQL
  4223. service.
  4224. 6. When upgrading from MySQL 5.1.23 to MySQL 5.1.24, the change
  4225. in the default location of the data directory from a directory
  4226. within the MySQL installation to the AppData folder means that
  4227. you must manually copy the data files from your old
  4228. installation to the new location.
  4229. 7. If you are using the MySQL Installation Wizard, start the
  4230. wizard as described in Section 2.5.3.1, "Using the MySQL
  4231. Installation Wizard."
  4232. 8. If you are installing MySQL from a Zip archive, extract the
  4233. archive. You may either overwrite your existing MySQL
  4234. installation (usually located at C:\mysql), or install it into
  4235. a different directory, such as C:\mysql5. Overwriting the
  4236. existing installation is recommended.
  4237. 9. If you were running MySQL as a Windows service and you had to
  4238. remove the service earlier in this procedure, reinstall the
  4239. service. (See Section 2.5.5.6, "Starting MySQL as a Windows
  4240. Service.")
  4241. 10. Restart the server. For example, use NET START MySQL if you
  4242. run MySQL as a service, or invoke mysqld directly otherwise.
  4243. 11. If you encounter errors, see Section 2.5.6, "Troubleshooting a
  4244. MySQL Installation Under Windows."
  4245. 2.5.8. Windows Post-Installation Procedures
  4246. On Windows, the data directory and the grant tables do not have to
  4247. be created. MySQL Windows distributions include the grant tables
  4248. with a set of preinitialized accounts in the mysql database under
  4249. the data directory. It is unnecessary to run the mysql_install_db
  4250. script that is used on Unix. Regarding passwords, if you installed
  4251. MySQL using the Windows Installation Wizard, you may have already
  4252. assigned passwords to the accounts. (See Section 2.5.3.1, "Using
  4253. the MySQL Installation Wizard.") Otherwise, use the
  4254. password-assignment procedure given in Section 2.13.2, "Securing
  4255. the Initial MySQL Accounts."
  4256. Before setting up passwords, you might want to try running some
  4257. client programs to make sure that you can connect to the server
  4258. and that it is operating properly. Make sure that the server is
  4259. running (see Section 2.5.5.4, "Starting the Server for the First
  4260. Time"), and then issue the following commands to verify that you
  4261. can retrieve information from the server. The output should be
  4262. similar to what is shown here:
  4263. C:\> C:\mysql\bin\mysqlshow
  4264. +--------------------+
  4265. | Databases |
  4266. +--------------------+
  4267. | information_schema |
  4268. | mysql |
  4269. | test |
  4270. +--------------------+
  4271. Note
  4272. The above may not work if the correct user does not exist. If you
  4273. installed using the MSI packages and used the MySQL Server
  4274. Instance Config Wizard, then the root will haqve been created
  4275. automatically with the password you supplied. In this case, you
  4276. should use the -u and -p options where you will be prompted for
  4277. the password.
  4278. Note
  4279. The list of installed databases may vary, but will always include
  4280. the minimum of mysql and information_schema. In most cases, the
  4281. test database will also be installed automatically.
  4282. If you specify the name of the database, then a list of the tables
  4283. within a given database will be displayed:
  4284. C:\> C:\mysql\bin\mysqlshow mysql
  4285. Database: mysql
  4286. +---------------------------+
  4287. | Tables |
  4288. +---------------------------+
  4289. | columns_priv |
  4290. | db |
  4291. | event |
  4292. | func |
  4293. | general_log |
  4294. | help_category |
  4295. | help_keyword |
  4296. | help_relation |
  4297. | help_topic |
  4298. | host |
  4299. | plugin |
  4300. | proc |
  4301. | procs_priv |
  4302. | servers |
  4303. | slow_log |
  4304. | tables_priv |
  4305. | time_zone |
  4306. | time_zone_leap_second |
  4307. | time_zone_name |
  4308. | time_zone_transition |
  4309. | time_zone_transition_type |
  4310. | user |
  4311. +---------------------------+
  4312. C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM db" mysql
  4313. +------+-------+------+
  4314. | host | db | user |
  4315. +------+-------+------+
  4316. | % | test% | |
  4317. +------+-------+------+
  4318. You may need to specify a different directory from the one shown;
  4319. if you used the Windows Installation Wizard, then the default
  4320. directory is C:\Program Files\MySQL\MySQL Server 5.1, and the
  4321. mysql and mysqlshow client programs are in C:\Program
  4322. Files\MySQL\MySQL Server 5.1\bin. See Section 2.5.3.1, "Using the
  4323. MySQL Installation Wizard," for more information.
  4324. If you have already secured the initial MySQL accounts, you may
  4325. need to use the -u and -p options to supply a user name and
  4326. password to the mysqlshow and mysql client programs; otherwise the
  4327. programs may fail with an error, or you may not be able to view
  4328. all databases. For example, if you have assigned the password
  4329. "secretpass" to the MySQL root account, then you can invoke
  4330. mysqlshow and mysql as shown here:
  4331. C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass
  4332. +--------------------+
  4333. | Databases |
  4334. +--------------------+
  4335. | information_schema |
  4336. | mysql |
  4337. | test |
  4338. +--------------------+
  4339. C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass mysql
  4340. Database: mysql
  4341. +---------------------------+
  4342. | Tables |
  4343. +---------------------------+
  4344. | columns_priv |
  4345. | db |
  4346. | event |
  4347. | func |
  4348. | general_log |
  4349. | help_category |
  4350. | help_keyword |
  4351. | help_relation |
  4352. | help_topic |
  4353. | host |
  4354. | plugin |
  4355. | proc |
  4356. | procs_priv |
  4357. | servers |
  4358. | slow_log |
  4359. | tables_priv |
  4360. | time_zone |
  4361. | time_zone_leap_second |
  4362. | time_zone_name |
  4363. | time_zone_transition |
  4364. | time_zone_transition_type |
  4365. | user |
  4366. +---------------------------+
  4367. C:\> C:\mysql\bin\mysql -uroot -psecretpass -e "SELECT Host,Db,User F
  4368. ROM db" mysql
  4369. +------+-------+------+
  4370. | host | db | user |
  4371. +------+-------+------+
  4372. | % | test% | |
  4373. +------+-------+------+
  4374. For more information about these programs, see Section 4.5.6,
  4375. "mysqlshow --- Display Database, Table, and Column Information,"
  4376. and Section 4.5.1, "mysql --- The MySQL Command-Line Tool."
  4377. If you are running a version of Windows that supports services and
  4378. you want the MySQL server to run automatically when Windows
  4379. starts, see Section 2.5.5.6, "Starting MySQL as a Windows
  4380. Service."
  4381. 2.5.9. MySQL on Windows Compared to MySQL on Unix
  4382. MySQL for Windows has proven itself to be very stable. The Windows
  4383. version of MySQL has the same features as the corresponding Unix
  4384. version, with the following exceptions:
  4385. * Limited number of ports
  4386. Windows systems have about 4,000 ports available for client
  4387. connections, and after a connection on a port closes, it takes
  4388. two to four minutes before the port can be reused. In
  4389. situations where clients connect to and disconnect from the
  4390. server at a high rate, it is possible for all available ports
  4391. to be used up before closed ports become available again. If
  4392. this happens, the MySQL server appears to be unresponsive even
  4393. though it is running. Note that ports may be used by other
  4394. applications running on the machine as well, in which case the
  4395. number of ports available to MySQL is lower.
  4396. For more information about this problem, see
  4397. http://support.microsoft.com/default.aspx?scid=kb;en-us;196271
  4398. .
  4399. * Concurrent reads
  4400. MySQL depends on the pread() and pwrite() system calls to be
  4401. able to mix INSERT and SELECT. Currently, we use mutexes to
  4402. emulate pread() and pwrite(). We intend to replace the file
  4403. level interface with a virtual interface in the future so that
  4404. we can use the readfile()/writefile() interface to get more
  4405. speed. The current implementation limits the number of open
  4406. files that MySQL 5.1 can use to 2,048, which means that you
  4407. cannot run as many concurrent threads on Windows as on Unix.
  4408. * Blocking read
  4409. MySQL uses a blocking read for each connection. That has the
  4410. following implications if named-pipe connections are enabled:
  4411. + A connection is not disconnected automatically after
  4412. eight hours, as happens with the Unix version of MySQL.
  4413. + If a connection hangs, it is not possible to break it
  4414. without killing MySQL.
  4415. + mysqladmin kill does not work on a sleeping connection.
  4416. + mysqladmin shutdown cannot abort as long as there are
  4417. sleeping connections.
  4418. We plan to fix this problem in the future.
  4419. * ALTER TABLE
  4420. While you are executing an ALTER TABLE statement, the table is
  4421. locked from being used by other threads. This has to do with
  4422. the fact that on Windows, you can't delete a file that is in
  4423. use by another thread. In the future, we may find some way to
  4424. work around this problem.
  4425. * DATA DIRECTORY and INDEX DIRECTORY
  4426. The DATA DIRECTORY and INDEX DIRECTORY options for CREATE
  4427. TABLE are ignored on Windows, because Windows doesn't support
  4428. symbolic links. These options also are ignored on systems that
  4429. have a nonfunctional realpath() call.
  4430. * DROP DATABASE
  4431. You cannot drop a database that is in use by another thread.
  4432. * Case-insensitive names
  4433. File names are not case sensitive on Windows, so MySQL
  4434. database and table names are also not case sensitive on
  4435. Windows. The only restriction is that database and table names
  4436. must be specified using the same case throughout a given
  4437. statement. See Section 8.2.2, "Identifier Case Sensitivity."
  4438. * Directory and file names
  4439. On Windows, MySQL Server supports only directory and file
  4440. names that are compatible with the current ANSI code pages.
  4441. For example, the following Japanese directory name will not
  4442. work in the Western locale (code page 1252):
  4443. datadir="C:/私たちのプロジェクトのデータ"
  4444. The same limitation applies to directory and file names
  4445. referred to in SQL statements, such as the data file path name
  4446. in LOAD DATA INFILE.
  4447. * The "\" path name separator character
  4448. Path name components in Windows are separated by the "\"
  4449. character, which is also the escape character in MySQL. If you
  4450. are using LOAD DATA INFILE or SELECT ... INTO OUTFILE, use
  4451. Unix-style file names with "/" characters:
  4452. mysql> LOAD DATA INFILE 'C:/tmp/skr.txt' INTO TABLE skr;
  4453. mysql> SELECT * INTO OUTFILE 'C:/tmp/skr.txt' FROM skr;
  4454. Alternatively, you must double the "\" character:
  4455. mysql> LOAD DATA INFILE 'C:\\tmp\\skr.txt' INTO TABLE skr;
  4456. mysql> SELECT * INTO OUTFILE 'C:\\tmp\\skr.txt' FROM skr;
  4457. * Problems with pipes
  4458. Pipes do not work reliably from the Windows command-line
  4459. prompt. If the pipe includes the character ^Z / CHAR(24),
  4460. Windows thinks that it has encountered end-of-file and aborts
  4461. the program.
  4462. This is mainly a problem when you try to apply a binary log as
  4463. follows:
  4464. C:\> mysqlbinlog binary_log_file | mysql --user=root
  4465. If you have a problem applying the log and suspect that it is
  4466. because of a ^Z / CHAR(24) character, you can use the
  4467. following workaround:
  4468. C:\> mysqlbinlog binary_log_file --result-file=/tmp/bin.sql
  4469. C:\> mysql --user=root --execute "source /tmp/bin.sql"
  4470. The latter command also can be used to reliably read in any
  4471. SQL file that may contain binary data.
  4472. * Access denied for user error
  4473. If MySQL cannot resolve your host name properly, you may get
  4474. the following error when you attempt to run a MySQL client
  4475. program to connect to a server running on the same machine:
  4476. Access denied for user 'some_user'@'unknown'
  4477. to database 'mysql'
  4478. To fix this problem, you should create a file named
  4479. \windows\hosts containing the following information:
  4480. 127.0.0.1 localhost
  4481. Here are some open issues for anyone who might want to help us
  4482. improve MySQL on Windows:
  4483. * Add macros to use the faster thread-safe increment/decrement
  4484. methods provided by Windows.
  4485. 2.5.10. Installing MySQL from Source on Windows
  4486. These instructions describe how to build binaries from source for
  4487. MySQL 5.1 on Windows. Instructions are provided for building
  4488. binaries from a standard source distribution or from the Bazaar
  4489. tree that contains the latest development source.
  4490. Note
  4491. The instructions here are strictly for users who want to test
  4492. MySQL on Microsoft Windows from the latest source distribution or
  4493. from the Bazaar tree. For production use, we do not advise using a
  4494. MySQL server built by yourself from source. Normally, it is best
  4495. to use precompiled binary distributions of MySQL that are built
  4496. specifically for optimal performance on Windows by Oracle
  4497. Corporation. Instructions for installing binary distributions are
  4498. available in Section 2.5, "Installing MySQL on Windows."
  4499. To build MySQL on Windows from source, you must satisfy the
  4500. following system, compiler, and resource requirements:
  4501. * Windows 2000, Windows XP, or newer version.
  4502. Windows Vista is supported when using Visual Studio 2005
  4503. provided you have installed the following updates:
  4504. + Microsoft Visual Studio 2005 Professional Edition - ENU
  4505. Service Pack 1 (KB926601)
  4506. (http://support.microsoft.com/?kbid=926601)
  4507. + Security Update for Microsoft Visual Studio 2005
  4508. Professional Edition - ENU (KB937061)
  4509. (http://support.microsoft.com/?kbid=937061)
  4510. + Update for Microsoft Visual Studio 2005 Professional
  4511. Edition - ENU (KB932232)
  4512. (http://support.microsoft.com/?kbid=932232)
  4513. * CMake, which can be downloaded from http://www.cmake.org.
  4514. After installing, modify your path to include the cmake
  4515. binary.
  4516. * Microsoft Visual C++ 2005 Express Edition, Visual Studio .Net
  4517. 2003 (7.1), or Visual Studio 2005 (8.0) compiler system.
  4518. * If you are using Visual C++ 2005 Express Edition, you must
  4519. also install an appropriate Platform SDK. More information and
  4520. links to downloads for various Windows platforms is available
  4521. from
  4522. http://www.microsoft.com/downloads/details.aspx?familyid=0baf2
  4523. b35-c656-4969-ace8-e4c0c0716adb.
  4524. * If you are compiling from a Bazaar tree or making changes to
  4525. the parser, you need bison for Windows, which can be
  4526. downloaded from
  4527. http://gnuwin32.sourceforge.net/packages/bison.htm. Download
  4528. the package labeled "Complete package, excluding sources".
  4529. After installing the package, modify your path to include the
  4530. bison binary and ensure that this binary is accessible from
  4531. Visual Studio.
  4532. * Cygwin might be necessary if you want to run the test script
  4533. or package the compiled binaries and support files into a Zip
  4534. archive. (Cygwin is needed only to test or package the
  4535. distribution, not to build it.) Cygwin is available from
  4536. http://cygwin.com.
  4537. * 3GB to 5GB of disk space.
  4538. The exact system requirements for Visual Studio can be found here:
  4539. http://msdn.microsoft.com/vstudio/Previous/2003/sysreqs/default.as
  4540. px and
  4541. http://msdn.microsoft.com/vstudio/products/sysreqs/default.aspx
  4542. You also need a MySQL source distribution for Windows, which can
  4543. be obtained two ways:
  4544. * Obtain a source distribution packaged by Oracle Corporation.
  4545. These are available from http://dev.mysql.com/downloads/.
  4546. * Package a source distribution yourself from the latest Bazaar
  4547. developer source tree. For instructions on pulling the latest
  4548. source files, see Section 2.3.3, "Installing from the
  4549. Development Source Tree."
  4550. If you find something not working as expected, or you have
  4551. suggestions about ways to improve the current build process on
  4552. Windows, please send a message to the win32 mailing list. See
  4553. Section 1.6.1, "MySQL Mailing Lists."
  4554. 2.5.10.1. Building MySQL from Source Using CMake and Visual Studio
  4555. You can build MySQL on Windows by using a combination of cmake and
  4556. Microsoft Visual Studio .NET 2003 (7.1), Microsoft Visual Studio
  4557. 2005 (8.0), Microsoft Visual Studio 2008 (9.0) or Microsoft Visual
  4558. C++ 2005 Express Edition. You must have the appropriate Microsoft
  4559. Platform SDK installed.
  4560. Note
  4561. To compile from the source code on Windows you must use the
  4562. standard source distribution (for example, mysql-5.1.46.tar.gz).
  4563. You build from the same distribution as used to build MySQL on
  4564. Unix, Linux and other platforms. Do not use the Windows Source
  4565. distributions as they do not contain the necessary configuration
  4566. script and other files.
  4567. Follow this procedure to build MySQL:
  4568. 1. If you are installing from a packaged source distribution,
  4569. create a work directory (for example, C:\workdir), and unpack
  4570. the source distribution there using WinZip or another Windows
  4571. tool that can read .zip files. This directory is the work
  4572. directory in the following instructions.
  4573. Note
  4574. You must run the commands in the win directory from the
  4575. top-level source directory. Do not change into the win
  4576. directory, as the commands will not be executed correctly.
  4577. 2. Start a command shell. If you have not configured the PATH and
  4578. other environment variables for all command shells, you may be
  4579. able to start a command shell from the Start Menu within the
  4580. Windows Visual Studio menu that contains the necessary
  4581. environment changes.
  4582. 3. Within the command shell, navigate to the work directory and
  4583. run the following command:
  4584. C:\workdir>win\configure.js options
  4585. If you have associated the .js file extension with an
  4586. application such as a text editor, then you may need to use
  4587. the following command to force configure.js to be executed as
  4588. a script:
  4589. C:\workdir>cscript win\configure.js options
  4590. These options are available for configure.js:
  4591. + WITH_INNOBASE_STORAGE_ENGINE: Enable the InnoDB storage
  4592. engine.
  4593. + WITH_PARTITION_STORAGE_ENGINE: Enable user-defined
  4594. partitioning.
  4595. + WITH_ARCHIVE_STORAGE_ENGINE: Enable the ARCHIVE storage
  4596. engine.
  4597. + WITH_BLACKHOLE_STORAGE_ENGINE: Enable the BLACKHOLE
  4598. storage engine.
  4599. + WITH_EXAMPLE_STORAGE_ENGINE: Enable the EXAMPLE storage
  4600. engine.
  4601. + WITH_FEDERATED_STORAGE_ENGINE: Enable the FEDERATED
  4602. storage engine.
  4603. + WITH_NDBCLUSTER_STORAGE_ENGINE (experimental): Enable the
  4604. NDBCLUSTER storage engine in the MySQL server; cause
  4605. binaries for the MySQL Cluster management and data node,
  4606. management client, and other programs to be built.
  4607. This option is supported only in MySQL Cluster NDB 7.0
  4608. (NDBCLUSTER storage engine versions 6.4.0 and later)
  4609. using the MySQL Cluster sources. It cannot be used to
  4610. enable clustering support in other MySQL source trees or
  4611. distributions.
  4612. + MYSQL_SERVER_SUFFIX=suffix: Server suffix, default none.
  4613. + COMPILATION_COMMENT=comment: Server comment, default
  4614. "Source distribution".
  4615. + MYSQL_TCP_PORT=port: Server port, default 3306.
  4616. + DISABLE_GRANT_OPTIONS: Disables the --bootstrap,
  4617. --skip-grant-tables, and --init-file options for mysqld.
  4618. This option is available as of MySQL 5.1.15.
  4619. For example (type the command on one line):
  4620. C:\workdir>win\configure.js WITH_INNOBASE_STORAGE_ENGINE
  4621. WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro
  4622. 4. From the work directory, execute the win\build-vs9.bat
  4623. (Windows Visual Studio 2008), win\build-vs8.bat (Windows
  4624. Visual Studio 2005), or win\build-vs71.bat (Windows Visual
  4625. Stidion 2003) script, depending on the version of Visual
  4626. Studio you have installed. The script invokes CMake, which
  4627. generates the mysql.sln solution file.
  4628. You can also use the corresponding 64-bit file (for example
  4629. win\build-vs8_x64.bat or win\build-vs9_x64.bat) to build the
  4630. 64-bit version of MySQL. However, you cannot build the 64-bit
  4631. version with Visual Studio Express Edition. You must use
  4632. Visual Studio 2005 (8.0) or higher.
  4633. 5. From the work directory, open the generated mysql.sln file
  4634. with Visual Studio and select the proper configuration using
  4635. the Configuration menu. The menu provides Debug, Release,
  4636. RelwithDebInfo, MinRelInfo options. Then select Solution >
  4637. Build to build the solution.
  4638. Remember the configuration that you use in this step. It is
  4639. important later when you run the test script because that
  4640. script needs to know which configuration you used.
  4641. 6. Test the server. The server built using the preceding
  4642. instructions expects that the MySQL base directory and data
  4643. directory are C:\mysql and C:\mysql\data by default. If you
  4644. want to test your server using the source tree root directory
  4645. and its data directory as the base directory and data
  4646. directory, you need to tell the server their path names. You
  4647. can either do this on the command line with the --basedir and
  4648. --datadir options, or by placing appropriate options in an
  4649. option file. (See Section 4.2.3.3, "Using Option Files.") If
  4650. you have an existing data directory elsewhere that you want to
  4651. use, you can specify its path name instead.
  4652. When the server is running in standalone fashion or as a
  4653. service based on your configuration, try to connect to it from
  4654. the mysql interactive command-line utility.
  4655. You can also run the standard test script, mysql-test-run.pl.
  4656. This script is written in Perl, so you'll need either Cygwin
  4657. or ActiveState Perl to run it. You may also need to install
  4658. the modules required by the script. To run the test script,
  4659. change location into the mysql-test directory under the work
  4660. directory, set the MTR_VS_CONFIG environment variable to the
  4661. configuration you selected earlier (or use the --vs-config
  4662. option), and invoke mysql-test-run.pl. For example (using
  4663. Cygwin and the bash shell):
  4664. shell> cd mysql-test
  4665. shell> export MTR_VS_CONFIG=debug
  4666. shell> ./mysql-test-run.pl --force --timer
  4667. shell> ./mysql-test-run.pl --force --timer --ps-protocol
  4668. When you are satisfied that the programs you have built are
  4669. working correctly, stop the server. Now you can install the
  4670. distribution. One way to do this is to use the make_win_bin_dist
  4671. script in the scripts directory of the MySQL source distribution
  4672. (see Section 4.4.2, "make_win_bin_dist --- Package MySQL
  4673. Distribution as ZIP Archive"). This is a shell script, so you must
  4674. have Cygwin installed if you want to use it. It creates a Zip
  4675. archive of the built executables and support files that you can
  4676. unpack in the location at which you want to install MySQL.
  4677. It is also possible to install MySQL by copying directories and
  4678. files directly:
  4679. 1. Create the directories where you want to install MySQL. For
  4680. example, to install into C:\mysql, use these commands:
  4681. C:\> mkdir C:\mysql
  4682. C:\> mkdir C:\mysql\bin
  4683. C:\> mkdir C:\mysql\data
  4684. C:\> mkdir C:\mysql\share
  4685. C:\> mkdir C:\mysql\scripts
  4686. If you want to compile other clients and link them to MySQL,
  4687. you should also create several additional directories:
  4688. C:\> mkdir C:\mysql\include
  4689. C:\> mkdir C:\mysql\lib
  4690. C:\> mkdir C:\mysql\lib\debug
  4691. C:\> mkdir C:\mysql\lib\opt
  4692. If you want to benchmark MySQL, create this directory:
  4693. C:\> mkdir C:\mysql\sql-bench
  4694. Benchmarking requires Perl support. See Section 2.15, "Perl
  4695. Installation Notes."
  4696. 2. From the work directory, copy into the C:\mysql directory the
  4697. following files and directories:
  4698. C:\> cd \workdir
  4699. C:\workdir> mkdir C:\mysql
  4700. C:\workdir> mkdir C:\mysql\bin
  4701. C:\workdir> copy client\Release\*.exe C:\mysql\bin
  4702. C:\workdir> copy sql\Release\mysqld.exe C:\mysql\bin\mysqld.exe
  4703. C:\workdir> xcopy scripts\*.* C:\mysql\scripts /E
  4704. C:\workdir> xcopy share\*.* C:\mysql\share /E
  4705. If you want to compile other clients and link them to MySQL,
  4706. you should also copy several libraries and header files:
  4707. C:\workdir> copy lib\Release\mysqlclient.lib C:\mysql\lib\debug
  4708. C:\workdir> copy lib\Release\libmysql.* C:\mysql\lib\debug
  4709. C:\workdir> copy lib\Release\zlib.* C:\mysql\lib\debug
  4710. C:\workdir> copy lib\Release\mysqlclient.lib C:\mysql\lib\opt
  4711. C:\workdir> copy lib\Release\libmysql.* C:\mysql\lib\opt
  4712. C:\workdir> copy lib\Release\zlib.* C:\mysql\lib\opt
  4713. C:\workdir> copy include\*.h C:\mysql\include
  4714. C:\workdir> copy libmysql\libmysql.def C:\mysql\include
  4715. Note
  4716. If you have compiled a Debug, rather than Release solution,
  4717. you can replace Release with Debug in the source file names
  4718. shown above.
  4719. If you want to benchmark MySQL, you should also do this:
  4720. C:\workdir> xcopy sql-bench\*.* C:\mysql\bench /E
  4721. After installation, set up and start the server in the same way as
  4722. for binary Windows distributions. This includes creating the
  4723. system tables by running mysql_install_db. For more information,
  4724. see Section 2.5, "Installing MySQL on Windows."
  4725. 2.5.11. Compiling MySQL Clients on Windows
  4726. In your source files, you should include my_global.h before
  4727. mysql.h:
  4728. #include <my_global.h>
  4729. #include <mysql.h>
  4730. my_global.h includes any other files needed for Windows
  4731. compatibility (such as windows.h) if you compile your program on
  4732. Windows.
  4733. You can either link your code with the dynamic libmysql.lib
  4734. library, which is just a wrapper to load in libmysql.dll on
  4735. demand, or link with the static mysqlclient.lib library.
  4736. The MySQL client libraries are compiled as threaded libraries, so
  4737. you should also compile your code to be multi-threaded.
  4738. 2.6. Installing MySQL on Linux
  4739. The following sections covers the installation of Linux using
  4740. RPMs. For information on using a generic binary package using tar,
  4741. see Section 2.2, "Installing MySQL from Generic Binaries on
  4742. Unix/Linux." For information on installing from source, see
  4743. Section 2.3, "MySQL Installation Using a Source Distribution."
  4744. mysql.server can be found in the support-files directory under the
  4745. MySQL installation directory or in a MySQL source tree. You can
  4746. install it as /etc/init.d/mysql for automatic MySQL startup and
  4747. shutdown. See Section 2.13.1.2, "Starting and Stopping MySQL
  4748. Automatically."
  4749. 2.6.1. Installing MySQL from RPM Packages on Linux
  4750. The recommended way to install MySQL on RPM-based Linux
  4751. distributions is by using the RPM packages. The RPMs that we
  4752. provide to the community should work on all versions of Linux that
  4753. support RPM packages and use glibc 2.3. To obtain RPM packages,
  4754. see Section 2.1.3, "How to Get MySQL."
  4755. For non-RPM Linux distributions, you can install MySQL using a
  4756. .tar.gz package. See Section 2.2, "Installing MySQL from Generic
  4757. Binaries on Unix/Linux."
  4758. We do provide some platform-specific RPMs; the difference between
  4759. a platform-specific RPM and a generic RPM is that a
  4760. platform-specific RPM is built on the targeted platform and is
  4761. linked dynamically whereas a generic RPM is linked statically with
  4762. LinuxThreads.
  4763. Note
  4764. RPM distributions of MySQL often are provided by other vendors. Be
  4765. aware that they may differ in features and capabilities from those
  4766. built by us, and that the instructions in this manual do not
  4767. necessarily apply to installing them. The vendor's instructions
  4768. should be consulted instead.
  4769. In most cases, you need to install only the MySQL-server and
  4770. MySQL-client packages to get a functional MySQL installation. The
  4771. other packages are not required for a standard installation.
  4772. RPMs for MySQL Cluster. Beginning with MySQL 5.1.24, standard
  4773. MySQL server RPMs built by MySQL no longer provide support for the
  4774. NDBCLUSTER storage engine. MySQL Cluster users wanting to upgrade
  4775. MySQL 5.1.23 or earlier installations from RPMs built by MySQL
  4776. should upgrade to MySQL Cluster NDB 6.2 or MySQL Cluster NDB 6.3;
  4777. RPMs that should work with most Linux distributions are available
  4778. for both of these release series.
  4779. Important
  4780. When upgrading a MySQL Cluster RPM installation, you must upgrade
  4781. all installed RPMs, including the Server and Client RPMs.
  4782. For more information about installing MySQL Cluster from RPMs, see
  4783. Section 17.2.1, "MySQL Cluster Multi-Computer Installation."
  4784. For upgrades, if your installation was originally produced by
  4785. installing multiple RPM packages, it is best to upgrade all the
  4786. packages, not just some. For example, if you previously installed
  4787. the server and client RPMs, do not upgrade just the server RPM.
  4788. The RPM packages shown in the following list are available. The
  4789. names shown here use a suffix of .glibc23.i386.rpm, but particular
  4790. packages can have different suffixes, described later.
  4791. * MySQL-server-VERSION.glibc23.i386.rpm
  4792. The MySQL server. You need this unless you only want to
  4793. connect to a MySQL server running on another machine.
  4794. * MySQL-client-VERSION.glibc23.i386.rpm
  4795. The standard MySQL client programs. You probably always want
  4796. to install this package.
  4797. * MySQL-devel-VERSION.glibc23.i386.rpm
  4798. The libraries and include files that are needed if you want to
  4799. compile other MySQL clients, such as the Perl modules.
  4800. * MySQL-debuginfo-VERSION.glibc23.i386.rpm
  4801. This package contains debugging information. debuginfo RPMs
  4802. are never needed to use MySQL software; this is true both for
  4803. the server and for client programs. However, they contain
  4804. additional information that might be needed by a debugger to
  4805. analyze a crash.
  4806. * MySQL-shared-VERSION.glibc23.i386.rpm
  4807. This package contains the shared libraries
  4808. (libmysqlclient.so*) that certain languages and applications
  4809. need to dynamically load and use MySQL. It contains
  4810. single-threaded and thread-safe libraries. If you install this
  4811. package, do not install the MySQL-shared-compat package.
  4812. * MySQL-shared-compat-VERSION.glibc23.i386.rpm
  4813. This package includes the shared libraries for MySQL 3.23,
  4814. 4.0, and so on, up to the current release. It contains
  4815. single-threaded and thread-safe libraries. Install this
  4816. package instead of MySQL-shared if you have applications
  4817. installed that are dynamically linked against older versions
  4818. of MySQL but you want to upgrade to the current version
  4819. without breaking the library dependencies.
  4820. * MySQL-shared-compat-advanced-gpl-VERSION.glibc23.i386.rpm,
  4821. MySQL-shared-compat-advanced-VERSION.glibc23.i386.rpm
  4822. These are like the MySQL-shared-compat package, but are for
  4823. the "MySQL Enterprise Server - Advanced Edition" products.
  4824. Install these packages rather than the normal
  4825. MySQL-shared-compat package if you want to included shared
  4826. client libraries for older MySQL versions.
  4827. * MySQL-embedded-VERSION.glibc23.i386.rpm
  4828. The embedded MySQL server library.
  4829. * MySQL-ndb-management-VERSION.glibc23.i386.rpm,
  4830. MySQL-ndb-storage-VERSION.glibc23.i386.rpm,
  4831. MySQL-ndb-tools-VERSION.glibc23.i386.rpm,
  4832. MySQL-ndb-extra-VERSION.glibc23.i386.rpm
  4833. Packages that contain additional files for MySQL Cluster
  4834. installations.
  4835. Note
  4836. The MySQL-ndb-tools RPM requires a working installation of
  4837. perl. Prior to MySQL 5.1.18, the DBI and HTML::Template
  4838. packages were also required. See Section 2.15, "Perl
  4839. Installation Notes," and Section 17.4.21, "ndb_size.pl ---
  4840. NDBCLUSTER Size Requirement Estimator," for more information.
  4841. * MySQL-test-VERSION.glibc23.i386.rpm
  4842. This package includes the MySQL test suite.
  4843. * MySQL-VERSION.src.rpm
  4844. This contains the source code for all of the previous
  4845. packages. It can also be used to rebuild the RPMs on other
  4846. architectures (for example, Alpha or SPARC).
  4847. The suffix of RPM package names (following the VERSION value) has
  4848. the following syntax:
  4849. .PLATFORM.CPU.rpm
  4850. The PLATFORM and CPU values indicate the type of system for which
  4851. the package is built. PLATFORM indicates the platform and CPU
  4852. indicates the processor type or family.
  4853. All packages are dynamically linked against glibc 2.3. The
  4854. PLATFORM value indicates whether the package is platform
  4855. independent or intended for a specific platform, as shown in the
  4856. following table.
  4857. glibc23 Platform independent, should run on any Linux distribution
  4858. that supports glibc 2.3
  4859. rhel3, rhel4 Red Hat Enterprise Linux 3 or 4
  4860. sles9, sles10 SuSE Linux Enterprise Server 9 or 10
  4861. In MySQL 5.1, only glibc23 packages are available currently.
  4862. The CPU value indicates the processor type or family for which the
  4863. package is built.
  4864. i386 x86 processor, 386 and up
  4865. i586 x86 processor, Pentium and up
  4866. x86_64 64-bit x86 processor
  4867. ia64 Itanium (IA-64) processor
  4868. To see all files in an RPM package (for example, a MySQL-server
  4869. RPM), run a command like this:
  4870. shell> rpm -qpl MySQL-server-VERSION.glibc23.i386.rpm
  4871. To perform a standard minimal installation, install the server and
  4872. client RPMs:
  4873. shell> rpm -i MySQL-server-VERSION.glibc23.i386.rpm
  4874. shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
  4875. To install only the client programs, install just the client RPM:
  4876. shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
  4877. RPM provides a feature to verify the integrity and authenticity of
  4878. packages before installing them. If you would like to learn more
  4879. about this feature, see Section 2.1.4, "Verifying Package
  4880. Integrity Using MD5 Checksums or GnuPG."
  4881. The server RPM places data under the /var/lib/mysql directory. The
  4882. RPM also creates a login account for a user named mysql (if one
  4883. does not exist) to use for running the MySQL server, and creates
  4884. the appropriate entries in /etc/init.d/ to start the server
  4885. automatically at boot time. (This means that if you have performed
  4886. a previous installation and have made changes to its startup
  4887. script, you may want to make a copy of the script so that you
  4888. don't lose it when you install a newer RPM.) See Section 2.13.1.2,
  4889. "Starting and Stopping MySQL Automatically," for more information
  4890. on how MySQL can be started automatically on system startup.
  4891. If you want to install the MySQL RPM on older Linux distributions
  4892. that do not support initialization scripts in /etc/init.d
  4893. (directly or via a symlink), you should create a symbolic link
  4894. that points to the location where your initialization scripts
  4895. actually are installed. For example, if that location is
  4896. /etc/rc.d/init.d, use these commands before installing the RPM to
  4897. create /etc/init.d as a symbolic link that points there:
  4898. shell> cd /etc
  4899. shell> ln -s rc.d/init.d .
  4900. However, all current major Linux distributions should support the
  4901. new directory layout that uses /etc/init.d, because it is required
  4902. for LSB (Linux Standard Base) compliance.
  4903. If the RPM files that you install include MySQL-server, the mysqld
  4904. server should be up and running after installation. You should be
  4905. able to start using MySQL.
  4906. If something goes wrong, you can find more information in the
  4907. binary installation section. See Section 2.2, "Installing MySQL
  4908. from Generic Binaries on Unix/Linux."
  4909. Note
  4910. The accounts that are listed in the MySQL grant tables initially
  4911. have no passwords. After starting the server, you should set up
  4912. passwords for them using the instructions in Section 2.13,
  4913. "Post-Installation Setup and Testing."
  4914. During RPM installation, a user named mysql and a group named
  4915. mysql are created on the system. This is done using the useradd,
  4916. groupadd, and usermod commands. Those commands require appropriate
  4917. administrative privileges, which is ensured for locally managed
  4918. users and groups (as listed in the /etc/passwd and /etc/group
  4919. files) by the RPM installation process being run by root.
  4920. For nonlocal user management (LDAP, NIS, and so forth), the
  4921. administrative tools may require additional authentication (such
  4922. as a password), and will fail if the installing user does not
  4923. provide this authentication. Even if they fail, the RPM
  4924. installation will not abort but succeed, and this is intentional.
  4925. If they failed, some of the intended transfer of ownership may be
  4926. missing, and it is recommended that the system administrator then
  4927. manually ensures some appropriate user andgroup exists and
  4928. manually transfers ownership following the actions in the RPM spec
  4929. file.
  4930. 2.7. Installing MySQL on Mac OS X
  4931. MySQL for Mac OS X is available in a number of different forms:
  4932. * Native Package Installer format, which uses the native Mac OS
  4933. X installer to walk you through the installation of MySQL. For
  4934. more information, see Section 2.7.1, "Installing MySQL Using
  4935. the Installation Package." You can use the package installer
  4936. with Mac OS X 10.3 and later, and available for both PowerPC
  4937. and Intel architectures, and both 32-bit and 64-bit
  4938. architectures. There is no Universal Binary available using
  4939. the package installation method. The user you use to perform
  4940. the installation must have administrator privileges.
  4941. * Tar package format, which uses a file packaged using the Unix
  4942. tar and gzip commands. To use this method, you will need to
  4943. open a Terminal window. You do not need administrator
  4944. privileges using this method, as you can install the MySQL
  4945. server anywhere using this method. For more information on
  4946. using this method, you can use the generic instructions for
  4947. using a tarball, Section 2.2, "Installing MySQL from Generic
  4948. Binaries on Unix/Linux."You can use the package installer with
  4949. Mac OS X 10.3 and later, and available for both PowerPC and
  4950. Intel architectures, and both 32-bit and 64-bit architectures.
  4951. A Universal Binary, incorporating both Power PC and Intel
  4952. architectures and 32-bit and 64-bit binaries is available.
  4953. In addition to the core installation, the Package Installer
  4954. also includes Section 2.7.2, "Installing the MySQL Startup
  4955. Item" and Section 2.7.3, "Installing and Using the MySQL
  4956. Preference Pane," both of which simplify the management of
  4957. your installation.
  4958. * Mac OS X server includes a version of MySQL as standard. If
  4959. you want to use a more recent version than that supplied with
  4960. the Mac OS X server release, you can make use of the package
  4961. or tar formats. For more information on using the MySQL
  4962. bundled with Mac OS X, see Section 2.7.4, "Using MySQL on Mac
  4963. OS X Server."
  4964. For additional information on using MySQL on Mac OS X, see Section
  4965. 2.7.5, "MySQL Installation on Mac OS X Notes."
  4966. 2.7.1. Installing MySQL Using the Installation Package
  4967. You can install MySQL on Mac OS X 10.3.x ("Panther") or newer
  4968. using a Mac OS X binary package in PKG format instead of the
  4969. binary tarball distribution. Please note that older versions of
  4970. Mac OS X (for example, 10.1.x or 10.2.x) are not supported by this
  4971. package.
  4972. The package is located inside a disk image (.dmg) file that you
  4973. first need to mount by double-clicking its icon in the Finder. It
  4974. should then mount the image and display its contents.
  4975. Note
  4976. Before proceeding with the installation, be sure to shut down all
  4977. running MySQL server instances by either using the MySQL Manager
  4978. Application (on Mac OS X Server) or via mysqladmin shutdown on the
  4979. command line.
  4980. When installing from the package version, you should also install
  4981. the MySQL Preference Pane, which will allow you to control the
  4982. startup and execution of your MySQL server from System
  4983. Preferences. For more information, see Section 2.7.3, "Installing
  4984. and Using the MySQL Preference Pane."
  4985. When installing using the package installer, the files are
  4986. installed into a directory within /usr/local matching the name of
  4987. the installation version and platform. For example, the installer
  4988. file mysql-5.1.39-osx10.5-x86_64.pkg installs MySQL into
  4989. /usr/local/mysql-5.1.39-osx10.5-x86_64 . The installation layout
  4990. of the directory is as shown in the following table:
  4991. Directory Contents of Directory
  4992. bin Client programs and the mysqld server
  4993. data Log files, databases
  4994. docs Manual in Info format
  4995. include Include (header) files
  4996. lib Libraries
  4997. man Unix manual pages
  4998. mysql-test MySQL test suite
  4999. scripts Contains the mysql_install_db script
  5000. share/mysql Error message files
  5001. sql-bench Benchmarks
  5002. support-files Scripts and sample configuration files
  5003. /tmp/mysql.sock The location of the MySQL Unix socket
  5004. During the package installer process, a symbolic link from
  5005. /usr/local/mysql to the version/platform specific directory
  5006. created during installation will be created automatically.
  5007. 1. Download and open the MySQL package installer, which is
  5008. provided on a disk image (.dmg). Double-click to open the disk
  5009. image, which includes the main MySQL installation package, the
  5010. MySQLStartupItem.pkg installation package, and the
  5011. MySQL.prefPane.
  5012. 2. Double-click on the MySQL installer package. It will be named
  5013. according to the version of MySQL you have downloaded. For
  5014. example, if you have downloaded MySQL 5.1.39, double-click
  5015. mysql-5.1.39-osx10.5-x86.pkg.
  5016. 3. You will be presented with the openin installer dialog. Click
  5017. Continue to begihn installation.
  5018. MySQL Package Installer: Step 1
  5019. 4. A copy of the installation instructions and other important
  5020. information relevant to this installation are display. Click
  5021. Continue .
  5022. 5. If you have downloaded the community version of MySQL, you
  5023. will be shown a copy of the relevent GNU General Public
  5024. License. Click Continue .
  5025. 6. Select the drive you want to use to install the MySQL Startup
  5026. Item. The drive must have a valid, bootable, Mac OS X
  5027. operating system installed. Click Continue.
  5028. MySQL Package Installer: Step 4
  5029. 7. You will be asked to confirm the details of the installation,
  5030. including the space required for the installation. To change
  5031. the drive on which the startup item is installed you can click
  5032. either Go Back or Change Install Location.... To install the
  5033. startup item, click Install.
  5034. 8. Once the installation has been completed successfully, you
  5035. will be given an Install Succeeded message.
  5036. Once you have completed the basic installation, you must complete
  5037. the post-installation steps as specifed in Section 2.13,
  5038. "Post-Installation Setup and Testing."
  5039. For convenience, you may also want to install the Section 2.7.2,
  5040. "Installing the MySQL Startup Item" and Section 2.7.3, "Installing
  5041. and Using the MySQL Preference Pane."
  5042. 2.7.2. Installing the MySQL Startup Item
  5043. The MySQL Installation Package includes a startup item that can be
  5044. used to automatically startup and shutdown MySQL during boot.
  5045. To install the MySQL Startup Item:
  5046. 1. Download and open the MySQL package installer, which is
  5047. provided on a disk image (.dmg). Double-click to open the disk
  5048. image, which includes the main MySQL installation package, the
  5049. MySQLStartupItem.pkg installation package, and the
  5050. MySQL.prefPane.
  5051. 2. Double-click on the MySQLStartItem.pkg file to start the
  5052. installation process.
  5053. 3. You will be presented with the Install MySQL Startup Item
  5054. dialog.
  5055. MySQL Startup Item Installer: Step 1
  5056. Click Continue to continue the installation process.
  5057. 4. A copy of the installation instructions and other important
  5058. information relevant to this installation are display. Click
  5059. Continue .
  5060. 5. Select the drive you want to use to install the MySQL Startup
  5061. Item. The drive must have a valid, bootable, Mac OS X
  5062. operating system installed. Click Continue.
  5063. MySQL Startup Item Installer: Step 3
  5064. 6. You will be asked to confirm the details of the installation.
  5065. To change the drive on which the startup item is installed you
  5066. can click either Go Back or Change Install Location.... To
  5067. install the startup item, click Install.
  5068. 7. Once the installation has been completed successfully, you
  5069. will be given an Install Succeeded message.
  5070. MySQL Startup Item Installer: Step 5
  5071. The Startup Item for MySQL is installed into
  5072. /Library/StartupItems/MySQLCOM. The Startup Item installation adds
  5073. a variable MYSQLCOM=-YES- to the system configuration file
  5074. /etc/hostconfig. If you want to disable the automatic startup of
  5075. MySQL, simply change this variable to MYSQLCOM=-NO-.
  5076. After the installation, you can start up MySQL by running the
  5077. following commands in a terminal window. You must have
  5078. administrator privileges to perform this task.
  5079. If you have installed the Startup Item, use this command to start
  5080. the server:
  5081. shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
  5082. You may be prompted for your password to complete the startup.
  5083. If you have installed the Startup Item, use this command to stop
  5084. the server:
  5085. shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
  5086. You may be prompted for your password to complete the shutdown.
  5087. 2.7.3. Installing and Using the MySQL Preference Pane
  5088. The MySQL Package installer disk image also includes a custom
  5089. MySQL Preference Pane that enables you to start, stop and control
  5090. automated startup during boot of your MySQL installation.
  5091. To install the MySQL Preference Pane:
  5092. 1. Download and open the MySQL package installer package, which
  5093. is provided on a disk image (.dmg). Double-click to open the
  5094. disk image, which includes the main MySQL installation
  5095. package, the MySQLStartupItem.pkg installation package, and
  5096. the MySQL.prefPane.
  5097. 2. Double click on MySQL.prefPane. The MySQL System Preferences
  5098. will open.
  5099. 3. If this is the first time you have installed the preference
  5100. pane, you will be asked to confirm installation and whether
  5101. you want to install the preference pane for all users, or only
  5102. the current user. To install the preference pane for all users
  5103. you will need administrator privileges. If necessary, you will
  5104. be prompted for the username and password for a user with
  5105. administrator privileges.
  5106. 4. If you already have the MySQL Preference Pane installed, you
  5107. will be asked to confirm whether you want to overwrite the
  5108. existing MySQL Preference Pane.
  5109. Note
  5110. The MySQL Preference Pane only starts and stops MySQL installation
  5111. installed from the MySQL package installation that have been
  5112. installed in the default location.
  5113. Once the MySQL Preference Pane has been installed, you can control
  5114. your MySQL server instance using the preference pane. To use the
  5115. preference pane, open the System Preferences... from the Apple
  5116. menu. Select the MySQL preference pane by clicking on the MySQL
  5117. logo within the Other section of the preference panes list.
  5118. MySQL Preference Pane
  5119. The MySQL Preference Pane shows the current status of the MySQL
  5120. server, showing stopped (in red) if the server is not running and
  5121. running (in green) if the server has already been started. The
  5122. preference pane will also show the current setting for whether the
  5123. MySQL server has been set to start up automatically.
  5124. * To start MySQL using the preference pane:
  5125. Click Start MySQL Server. You may be prompted for the username
  5126. and password of a user with administrator privileges to start
  5127. the MySQL server.
  5128. * To stop MySQL using the preference pane:
  5129. Click Stop MySQL Server. You may be prompted for the username
  5130. and password of a user with administrator privileges to
  5131. shutdown the MySQL server.
  5132. * To automatically start the MySQL server when the system boots:
  5133. Check the checkbox next to Automatically Start MySQL Server on
  5134. Startup.
  5135. * To disable the automatic starting of the MySQL server when the
  5136. system boots:
  5137. Uncheck the checkbox next to Automatically Start MySQL Server
  5138. on Startup.
  5139. You can close the System Preferences... once you have completed
  5140. your settings.
  5141. 2.7.4. Using MySQL on Mac OS X Server
  5142. If you are running Mac OS X Server, a version of MySQL should
  5143. already be installed. The following table shows the versions of
  5144. MySQL that ship with Mac OS X Server versions.
  5145. Mac OS X Server Version MySQL Version
  5146. 10.2-10.2.2 3.23.51
  5147. 10.2.3-10.2.6 3.23.53
  5148. 10.3 4.0.14
  5149. 10.3.2 4.0.16
  5150. 10.4.0 4.1.10a
  5151. 10.5.0 5.0.45
  5152. 10.6.0 5.0.82
  5153. The installation layout of MySQL on Mac OS X Server is as shown in
  5154. the table below:
  5155. Directory Contents of Directory
  5156. /usr/bin Client programs
  5157. /var/mysql Log files, databases
  5158. /usr/libexec The mysqld server
  5159. /usr/share/man Unix manual pages
  5160. /usr/share/mysql/mysql-test MySQL test suite
  5161. /usr/share/mysql Contains the mysql_install_db script
  5162. /var/mysql/mysql.sock The location of the MySQL Unix socket
  5163. Note
  5164. The MySQL server bundled with Mac OS X Server does not include the
  5165. MySQL client libraries and header files required if you want to
  5166. access and use MySQL from a third-party driver, such as Perl DBI
  5167. or PHP. For more information on obtaining and installing MySQL
  5168. libraries, see Mac OS X Server version 10.5: MySQL libraries
  5169. available for download (http://support.apple.com/kb/TA25017).
  5170. Alternatively, you can ignore the bundled MySQL server and install
  5171. MySQL from the package or tarball installation.
  5172. For more information on managing the bundled MySQL instance in Mac
  5173. OS X Server 10.5, see Mac OS X Server: Web Technologies
  5174. Administration For Version 10.5 Leopard
  5175. (http://images.apple.com/server/macosx/docs/Web_Technologies_Admin
  5176. _v10.5.pdf). For more information on managing the bundled MySQL
  5177. instance in Mac OS X Server 10.6, see Mac OS X Server: Web
  5178. Technologies Administration Version 10.6 Snow Leopard
  5179. (http://manuals.info.apple.com/en_US/WebTech_v10.6.pdf).
  5180. 2.7.5. MySQL Installation on Mac OS X Notes
  5181. You should keep the following issues and notes in mind:
  5182. * The default location for the MySQL Unix socket is different on
  5183. Mac OS X and Mac OS X Server depending on the installation
  5184. type you chose. The default locations by installation are as
  5185. follows:
  5186. Package Installer from MySQL /tmp/mysql.sock
  5187. Tarball from MySQL /tmp/mysql.sock
  5188. MySQL Bundled with Mac OS X Server /var/mysql/mysql.sock
  5189. To prevent issues, you should either change the configuration
  5190. of the socket used within your application (for example,
  5191. changing php.ini), or you should configure the socket location
  5192. using a MySQL configuration file and the socket option. For
  5193. more information, see Section 5.1.2, "Server Command Options."
  5194. * You may need (or want) to create a specific mysql user to own
  5195. the MySQL directory and data. On Mac OS X 10.4 and lower you
  5196. can do this by using the Netinfo Manager application, located
  5197. within the Utilities folder within the Applications folder. On
  5198. Mac OS X 10.5 and later you can do this through the Directory
  5199. Utility. From Mac OS X 10.5 and later (including Mac OS X
  5200. Server 10.5) the mysql should already exist. For use in single
  5201. user mode, an entry for _mysql (note the underscore prefix)
  5202. should already exist within the system /etc/passwd file.
  5203. * Due to a bug in the Mac OS X package installer, you may see
  5204. this error message in the destination disk selection dialog:
  5205. You cannot install this software on this disk. (null)
  5206. If this error occurs, simply click the Go Back button once to
  5207. return to the previous screen. Then click Continue to advance
  5208. to the destination disk selection again, and you should be
  5209. able to choose the destination disk correctly. We have
  5210. reported this bug to Apple and it is investigating this
  5211. problem.
  5212. * Because the MySQL package installer installs the MySQL
  5213. contents into a version and platform specific directory, you
  5214. can use this to upgrade and migrate your database between
  5215. versions. You will need to either copy the data directory from
  5216. the old version to the new version, or alternatively specify
  5217. an alternative datadir value to set location of the data
  5218. directory.
  5219. * You might want to add aliases to your shell's resource file to
  5220. make it easier to access commonly used programs such as mysql
  5221. and mysqladmin from the command line. The syntax for bash is:
  5222. alias mysql=/usr/local/mysql/bin/mysql
  5223. alias mysqladmin=/usr/local/mysql/bin/mysqladmin
  5224. For tcsh, use:
  5225. alias mysql /usr/local/mysql/bin/mysql
  5226. alias mysqladmin /usr/local/mysql/bin/mysqladmin
  5227. Even better, add /usr/local/mysql/bin to your PATH environment
  5228. variable. You can do this by modifying the appropriate startup
  5229. file for your shell. For more information, see Section 4.2.1,
  5230. "Invoking MySQL Programs."
  5231. * After you have copied over the MySQL database files from the
  5232. previous installation and have successfully started the new
  5233. server, you should consider removing the old installation
  5234. files to save disk space. Additionally, you should also remove
  5235. older versions of the Package Receipt directories located in
  5236. /Library/Receipts/mysql-VERSION.pkg.
  5237. 2.8. Installing MySQL on Solaris
  5238. To obtain a binary MySQL distribution for Solaris in tarball or
  5239. PKG format, http://dev.mysql.com/downloads/mysql/5.1.html.
  5240. If you install MySQL using a binary tarball distribution on
  5241. Solaris, you may run into trouble even before you get the MySQL
  5242. distribution unpacked, as the Solaris tar cannot handle long file
  5243. names. This means that you may see errors when you try to unpack
  5244. MySQL.
  5245. If this occurs, you must use GNU tar (gtar) to unpack the
  5246. distribution.
  5247. You can install MySQL on Solaris using a binary package in PKG
  5248. format instead of the binary tarball distribution. Before
  5249. installing using the binary PKG format, you should create the
  5250. mysql user and group, for example:
  5251. groupadd mysql
  5252. useradd -g mysql mysql
  5253. Some basic PKG-handling commands follow:
  5254. * To add a package:
  5255. pkgadd -d package_name.pkg
  5256. * To remove a package:
  5257. pkgrm package_name
  5258. * To get a full list of installed packages:
  5259. pkginfo
  5260. * To get detailed information for a package:
  5261. pkginfo -l package_name
  5262. * To list the files belonging to a package:
  5263. pkgchk -v package_name
  5264. * To get packaging information for an arbitrary file:
  5265. pkgchk -l -p file_name
  5266. 2.8.1. Solaris Notes
  5267. For information about installing MySQL on Solaris using PKG
  5268. distributions, see Section 2.8, "Installing MySQL on Solaris."
  5269. On Solaris, you may run into trouble even before you get the MySQL
  5270. distribution unpacked, as the Solaris tar cannot handle long file
  5271. names. This means that you may see errors when you try to unpack
  5272. MySQL.
  5273. If this occurs, you must use GNU tar (gtar) to unpack the
  5274. distribution.
  5275. If you have an UltraSPARC system, you can get 4% better
  5276. performance by adding -mcpu=v8 -Wa,-xarch=v8plusa to the CFLAGS
  5277. and CXXFLAGS environment variables.
  5278. If you have Sun's Forte 5.0 (or newer) compiler, you can run
  5279. configure like this:
  5280. CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt" \
  5281. CXX=CC CXXFLAGS="-noex -mt" \
  5282. ./configure --prefix=/usr/local/mysql --enable-assembler
  5283. To create a 64-bit binary with Sun's Forte compiler, use the
  5284. following configuration options:
  5285. CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt -xarch=v9" \
  5286. CXX=CC CXXFLAGS="-noex -mt -xarch=v9" ASFLAGS="-xarch=v9" \
  5287. ./configure --prefix=/usr/local/mysql --enable-assembler
  5288. To create a 64-bit Solaris binary using gcc, add -m64 to CFLAGS
  5289. and CXXFLAGS and remove --enable-assembler from the configure
  5290. line.
  5291. In the MySQL benchmarks, we obtained a 4% speed increase on
  5292. UltraSPARC when using Forte 5.0 in 32-bit mode, as compared to
  5293. using gcc 3.2 with the -mcpu flag.
  5294. If you create a 64-bit mysqld binary, it is 4% slower than the
  5295. 32-bit binary, but can handle more threads and memory.
  5296. When using Solaris 10 for x86_64, you should mount any file
  5297. systems on which you intend to store InnoDB files with the
  5298. forcedirectio option. (By default mounting is done without this
  5299. option.) Failing to do so will cause a significant drop in
  5300. performance when using the InnoDB storage engine on this platform.
  5301. If you get a problem with fdatasync or sched_yield, you can fix
  5302. this by adding LIBS=-lrt to the configure line
  5303. Solaris does not provide static versions of all system libraries
  5304. (libpthreads and libdl), so you cannot compile MySQL with
  5305. --static. If you try to do so, you get one of the following
  5306. errors:
  5307. ld: fatal: library -ldl: not found
  5308. undefined reference to `dlopen'
  5309. cannot find -lrt
  5310. If you link your own MySQL client programs, you may see the
  5311. following error at runtime:
  5312. ld.so.1: fatal: libmysqlclient.so.#:
  5313. open failed: No such file or directory
  5314. This problem can be avoided by one of the following methods:
  5315. * Link clients with the -Wl,r/full/path/to/libmysqlclient.so
  5316. flag rather than with -Lpath).
  5317. * Copy libmysqclient.so to /usr/lib.
  5318. * Add the path name of the directory where libmysqlclient.so is
  5319. located to the LD_RUN_PATH environment variable before running
  5320. your client.
  5321. If you have problems with configure trying to link with -lz when
  5322. you don't have zlib installed, you have two options:
  5323. * If you want to be able to use the compressed communication
  5324. protocol, you need to get and install zlib from ftp.gnu.org.
  5325. * Run configure with the --with-named-z-libs=no option when
  5326. building MySQL.
  5327. If you are using gcc and have problems with loading user-defined
  5328. functions (UDFs) into MySQL, try adding -lgcc to the link line for
  5329. the UDF.
  5330. If you would like MySQL to start automatically, you can copy
  5331. support-files/mysql.server to /etc/init.d and create a symbolic
  5332. link to it named /etc/rc3.d/S99mysql.server.
  5333. If too many processes try to connect very rapidly to mysqld, you
  5334. should see this error in the MySQL log:
  5335. Error in accept: Protocol error
  5336. You might try starting the server with the --back_log=50 option as
  5337. a workaround for this. (Use -O back_log=50 before MySQL 4.)
  5338. To configure the generation of core files on Solaris you should
  5339. use the coreadm command. Because of the security implications of
  5340. generating a core on a setuid() application, by default, Solaris
  5341. does not support core files on setuid() programs. However, you can
  5342. modify this behavior using coreadm. If you enable setuid() core
  5343. files for the current user, they will be generated using the mode
  5344. 600 and owned by the superuser.
  5345. 2.9. Installing MySQL on i5/OS
  5346. The i5/OS POWER MySQL package was created in cooperation with IBM.
  5347. MySQL works within the Portable Application Solution Environment
  5348. (PASE) on the System i series of hardware and will also provide
  5349. database services for the Zend Core for i5/OS.
  5350. MySQL for i5/OS is provided both as a tar file and as a save file
  5351. (.savf) package that can be downloaded and installed directly
  5352. without any additional installation steps required. To install
  5353. MySQL using the tar file, see Section 2.2, "Installing MySQL from
  5354. Generic Binaries on Unix/Linux."
  5355. MySQL is only supported on i5/OS V5R4 or later releases. The i5/OS
  5356. PASE must be installed for MySQL to operate. You must be able to
  5357. login as a user in *SECOFR class.
  5358. You should the installation notes and tips for i5/OS before
  5359. starting installation. See i5/OS Installation Notes.
  5360. Before Installation:
  5361. Note
  5362. The installation package will use an existing configuration if you
  5363. have previously installed MySQL (which is identified by looking
  5364. for the file /etc/my.cnf). The values for the data directory
  5365. (DATADIR) and owner of the MySQL files (USRPRF) specified during
  5366. the installation will be ignored, and the values determined from
  5367. the /etc/my.cnf will be used instead.
  5368. If you want to change these parameters during a new install, you
  5369. should temporarily rename /etc/my.cnf, install MySQL using the new
  5370. parameters you want to use, and then merge your previous
  5371. /etc/my.cnf configuration settings with the new /etc/my.cnf file
  5372. that is created during installation.
  5373. * You must have a user profile with PASE with suitable
  5374. privileges. The user should be within the *SECOFR class, such
  5375. as the QSECOFR user ID. You can use the WRKUSRPRF command to
  5376. check your user profile.
  5377. * For network connections to MySQL, you must have TCP/IP
  5378. enabled. You should also check the following:
  5379. + Ensure that a name has defined for the system. Run the
  5380. Configure TCP/IP (CFGTCP) command and select option 12
  5381. (Change TCP/IP domain information) to display this
  5382. setting. Make sure that a value is listed in the Host
  5383. name field.
  5384. + Make sure that the system has a loopback entry which
  5385. represents the localhost or 127.0.0.1.
  5386. + Ensure that the IP address of the IBM i machine is mapped
  5387. correctly to the host name.
  5388. To install MySQL on i5/OS, follow these steps:
  5389. 1. On the System i machine, create a save file that will be used
  5390. to receive the downloaded installation save file. The file
  5391. should be located within the General Purpose Library (QGPL):
  5392. CRTSAVF FILE(QGPL/MYSQLINST) TESXT('MySQL Save file')
  5393. 2. Download the MySQL installation save file in 32-bit
  5394. (mysql-5.1.39-i5os-power-32bit.savf) or 64-bit
  5395. (mysql-5.1.39-i5os-power-64bit.savf) from MySQL Downloads
  5396. (http://dev.mysql.com/downloads).
  5397. 3. You need to FTP the downloaded .savf file directly into the
  5398. QGPL/MYSQLINST file on the System i server. You can do this
  5399. through FTP using the following steps after logging in to the
  5400. System i machine:
  5401. ftp> bin
  5402. ftp> cd qgpl
  5403. ftp> put mysql-5.1.39-i5os-power.savf mysqlinst
  5404. 4. Log into the System i server using a user in the *SECOFR
  5405. class, such as the QSECOFR user ID.
  5406. 5. You need to restore the installation library stored in the
  5407. .savf save file:
  5408. RSTLIB MYSQLINST DEV(*SAVF) SAVF(QGPL/MYSQLINST) MBROPT(*ALL) ALWOBJD
  5409. IF(*ALL)
  5410. Note
  5411. You can ignore the security changes-type message at the bottom
  5412. of the installation panel.
  5413. 6. Once you have finished restoring the MYSQLINST library, check
  5414. that all the necessary objects for installation are on the
  5415. system by using the Display Library (DSPLIB) command:
  5416. DSPLIB LIB(MYSQLINST)
  5417. 7. You need to execute the installation command,
  5418. MYSQLINST/INSMYSQL. You can specify three parameter settings
  5419. during installation:
  5420. + DIR('/QOpenSys/usr/local/mysql') sets the installation
  5421. location for the MySQL files. The directory will be
  5422. created if it does not already exist.
  5423. + DATADIR('/QOpenSys/usr/local/mysql/data') sets the
  5424. location of the directory that will be used to store the
  5425. database files and binary logs. The default setting is
  5426. /QOpenSys/usr/local/mysql/data. Note that if the
  5427. installer detects an existing installation (due to the
  5428. existence of /etc/my.cnf), then the existing setting will
  5429. be used instead of the default.
  5430. + USRPRF(MYSQL) sets the user profile that will own the
  5431. files that are installed. The profile will be created if
  5432. it does not already exist.
  5433. Note
  5434. You should choose an appropriate user for using the MySQL
  5435. server installation. The user will be used whenever you
  5436. need to do any administration on the MySQL server.
  5437. Once you have set the appropriate parameters, you can begin
  5438. the installation.
  5439. The installation copies all the necessary files into a
  5440. directory matching the DIR configuration value; sets the
  5441. ownership on those files, sets up the MySQL environment and
  5442. creates the MySQL configuration file (in /etc/my.cnf)
  5443. completing all the steps in a typical binary installation
  5444. process automatically. If this is a new installation of MySQL,
  5445. or if the installer detects that this is a new version
  5446. (because the /etc/my.cnf file does not exist), then the
  5447. initial core MySQL databases will also be created during
  5448. installation.
  5449. Once the installation has been completed, you will get a
  5450. notice advising you to set the password for the root user. For
  5451. more information, Section 2.13, "Post-Installation Setup and
  5452. Testing."
  5453. 8. Once the installation has completed, you can delete the
  5454. installation file:
  5455. DLTLIB LIB(MYSQLINST)
  5456. Upgrading an existing MySQL instance
  5457. You need to execute the upgrade command, MYSQLINST/UPGMYSQL.
  5458. Note
  5459. You cannot use MYSQLINST/UPGMYSQL to upgrade between major
  5460. versions of MySQL (for example from 5.0 to 5.1). For information
  5461. and advice on migrating between major versions you can use the
  5462. advice provided in Section 2.4.1.1, "Upgrading from MySQL 5.0 to
  5463. 5.1."
  5464. You must specify 6 parameters to perform an upgrade:
  5465. * DIR('/QOpenSys/usr/local/') --- sets the installation location
  5466. for the MySQL files. The directory will be created if it does
  5467. not already exist. This is the directory that the MySQL server
  5468. will be installed into, inside a directory with a name
  5469. matching the version and release. For example, if installing
  5470. MySQL 5.1.39 with the DIR set to /QOpenSys/usr/local/ would
  5471. result in /QOpenSys/usr/local/mysql-5.1.39-i5os-power64 and a
  5472. symbolic link to this directory will be created in
  5473. /QOpenSys/usr/local/mysql.
  5474. * DATADIR('/QOpenSys/mysql/data') --- sets the location of the
  5475. directory that will be upgraded.
  5476. * USRPRF('MYSQL') --- sets the user profile that will own the
  5477. files that are installed. The profile will be created if it
  5478. does not already exist; if it is created as part of the
  5479. upgrade process, it will be disabled initially. You may wish
  5480. to enable this user profile so that it can be used to start
  5481. the MySQL server later. It is best practice to use the one
  5482. previously created during the first installation.
  5483. * MYSQLUSR('root user') --- any user account in the current
  5484. MySQL server with SUPER privileges.
  5485. * PASSWORD('root user password') --- the password for the above
  5486. account. This is necessary as the upgrade starts the MySQL
  5487. server to upgrade the tables and the password is need to be
  5488. able to shutdown the MySQL server.
  5489. * CURINST('path to previous install') --- the full path to the
  5490. installation that is being upgraded. For example an
  5491. installation in /QOpenSys/usr/local/ will be
  5492. /QOpenSys/usr/local/msyql-5.1.30-i5os-power64. Failure to
  5493. specify this option may result in corruption of your existing
  5494. data files.
  5495. For example:
  5496. MYSQLINST/UPGMYSQL DIR('/QOpenSys/usr/local/') DATADIR('/QOpenSys/mys
  5497. ql/data') »
  5498. USERPRF(MYSQL) MYSQLUSR('root') PASSWORD('root') CURINST('/QOpen
  5499. Sys/usr/local/mysql-5.1.30-i5os-power64')
  5500. You should receive a Program Message indicating UPGRADE
  5501. SUCCESSFUL! upon completion or an error message if there is a
  5502. problem.You can view the upgrade programs progression and the
  5503. error in the text file upgrade.log in the installation directory.
  5504. To start MySQL:
  5505. 1. Log into the System i server using the user profile create or
  5506. specified during installation. By default, this is MYSQL.
  5507. Note
  5508. You should start mysqld_safe using a user that in the PASE
  5509. environment has the id=0 (the equivalent of the standard Unix
  5510. root user). If you do not use a user with this ID then the
  5511. system will be unable to change the user when executing mysqld
  5512. as set using --user option. If this happens, mysqld may be
  5513. unable to read the files located within the MySQL data
  5514. directory and the execution will fail.
  5515. 2. Enter the PASE environment using call qp2term.
  5516. 3. Start the MySQL server by changing to the installation
  5517. directory and running mysqld_safe, specifying the user name
  5518. used to install the server. The installer conveniently
  5519. installs a symbolic link to the installation directory
  5520. (mysql-5.0.42-i5os-power-32bit) as /opt/mysql/mysql:
  5521. > cd /opt/mysql/mysql
  5522. > bin/mysqld_safe --user=mysql &
  5523. You should see a message similar to the following:
  5524. Starting mysqld daemon with databases »
  5525. from /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data
  5526. If you are having problems starting MySQL server, see Section
  5527. 2.13.1.3, "Starting and Troubleshooting the MySQL Server."
  5528. To stop MySQL:
  5529. 1. Log into the System i server using the user profile create or
  5530. specified during installation. By default, this is MYSQL.
  5531. 2. Enter the PASE environment using call qp2term.
  5532. 3. Stop the MySQL server by changing into the installation
  5533. directory and running mysqladmin, specifying the user name
  5534. used to install the server:
  5535. > cd /opt/mysql/mysql
  5536. > bin/mysqladmin -u root shutdown
  5537. If the session that you started and stopped MySQL are the
  5538. same, you may get the log output from mysqld:
  5539. STOPPING server from pid file »
  5540. /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data/I5DBX.R
  5541. CHLAND.IBM.COM.pid
  5542. 070718 10:34:20 mysqld ended
  5543. If the sessions used to start and stop MySQL are different,
  5544. you will not receive any confirmation of the shutdown.
  5545. Note and tips
  5546. * A problem has been identified with the installation process on
  5547. DBCS systems. If you are having problems install MySQL on a
  5548. DBCS system, you need to change your job's coded character set
  5549. identifier (CSSID) to 37 (EBCDIC) before executing the install
  5550. command, INSMYSQL. To do this, determine your existing CSSID
  5551. (using DSPJOB and selecting option 2), execute CHGJOB
  5552. CSSID(37), run INSMYSQL to install MySQL and then execute
  5553. CHGJOB again with your original CSSID.
  5554. * If you want to use the Perl scripts that are included with
  5555. MySQL, you need to download the iSeries Tools for Developers
  5556. (5799-PTL). See
  5557. http://www-03.ibm.com/servers/enable/site/porting/tools/.
  5558. 2.10. Installing MySQL on FreeBSD
  5559. This section provides information about using MySQL on variants of
  5560. FreeBSD Unix.
  5561. The easiest (and preferred) way to install MySQL is to use the
  5562. mysql-server and mysql-client ports available at
  5563. http://www.freebsd.org/. Using these ports gives you the following
  5564. benefits:
  5565. * A working MySQL with all optimizations enabled that are known
  5566. to work on your version of FreeBSD.
  5567. * Automatic configuration and build.
  5568. * Startup scripts installed in /usr/local/etc/rc.d.
  5569. * The ability to use pkg_info -L to see which files are
  5570. installed.
  5571. * The ability to use pkg_delete to remove MySQL if you no longer
  5572. want it on your machine.
  5573. The MySQL build process requires GNU make (gmake) to work. If GNU
  5574. make is not available, you must install it first before compiling
  5575. MySQL.
  5576. The recommended way to compile and install MySQL on FreeBSD with
  5577. gcc (2.95.2 and up) is:
  5578. CC=gcc CFLAGS="-O2 -fno-strength-reduce" \
  5579. CXX=gcc CXXFLAGS="-O2 -fno-rtti -fno-exceptions \
  5580. -felide-constructors -fno-strength-reduce" \
  5581. ./configure --prefix=/usr/local/mysql --enable-assembler
  5582. gmake
  5583. gmake install
  5584. cd /usr/local/mysql
  5585. bin/mysql_install_db --user=mysql
  5586. bin/mysqld_safe &
  5587. FreeBSD is known to have a very low default file handle limit. See
  5588. Section B.5.2.18, "'File' Not Found and Similar Errors." Start the
  5589. server by using the --open-files-limit option for mysqld_safe, or
  5590. raise the limits for the mysqld user in /etc/login.conf and
  5591. rebuild it with cap_mkdb /etc/login.conf. Also be sure that you
  5592. set the appropriate class for this user in the password file if
  5593. you are not using the default (use chpass mysqld-user-name). See
  5594. Section 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
  5595. In current versions of FreeBSD (at least 4.x and greater), you may
  5596. increase the limit on the amount of memory available for a process
  5597. by adding the following entries to the /boot/loader.conf file and
  5598. rebooting the machine (these are not settings that can be changed
  5599. at run time with the sysctl command):
  5600. kern.maxdsiz="1073741824" # 1GB
  5601. kern.dfldsiz="1073741824" # 1GB
  5602. kern.maxssiz="134217728" # 128MB
  5603. For older versions of FreeBSD, you must recompile your kernel to
  5604. change the maximum data segment size for a process. In this case,
  5605. you should look at the MAXDSIZ option in the LINT config file for
  5606. more information.
  5607. If you get problems with the current date in MySQL, setting the TZ
  5608. variable should help. See Section 2.14, "Environment Variables."
  5609. 2.11. Installing MySQL on HP-UX
  5610. If you install MySQL using a binary tarball distribution on HP-UX,
  5611. you may run into trouble even before you get the MySQL
  5612. distribution unpacked, as the HP-UX tar cannot handle long file
  5613. names. This means that you may see errors when you try to unpack
  5614. MySQL.
  5615. If this occurs, you must use GNU tar (gtar) to unpack the
  5616. distribution.
  5617. Because of some critical bugs in the standard HP-UX libraries, you
  5618. should install the following patches before trying to run MySQL on
  5619. HP-UX 11.0:
  5620. PHKL_22840 Streams cumulative
  5621. PHNE_22397 ARPA cumulative
  5622. This solves the problem of getting EWOULDBLOCK from recv() and
  5623. EBADF from accept() in threaded applications.
  5624. If you are using gcc 2.95.1 on an unpatched HP-UX 11.x system, you
  5625. may get the following error:
  5626. In file included from /usr/include/unistd.h:11,
  5627. from ../include/global.h:125,
  5628. from mysql_priv.h:15,
  5629. from item.cc:19:
  5630. /usr/include/sys/unistd.h:184: declaration of C function ...
  5631. /usr/include/sys/pthread.h:440: previous declaration ...
  5632. In file included from item.h:306,
  5633. from mysql_priv.h:158,
  5634. from item.cc:19:
  5635. The problem is that HP-UX does not define pthreads_atfork()
  5636. consistently. It has conflicting prototypes in
  5637. /usr/include/sys/unistd.h:184 and /usr/include/sys/pthread.h:440.
  5638. One solution is to copy /usr/include/sys/unistd.h into
  5639. mysql/include and edit unistd.h and change it to match the
  5640. definition in pthread.h. Look for this line:
  5641. extern int pthread_atfork(void (*prepare)(), void (*parent)(),
  5642. void (*child)());
  5643. Change it to look like this:
  5644. extern int pthread_atfork(void (*prepare)(void), void (*parent)(void)
  5645. ,
  5646. void (*child)(void));
  5647. After making the change, the following configure line should work:
  5648. CFLAGS="-fomit-frame-pointer -O3 -fpic" CXX=gcc \
  5649. CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -O3" \
  5650. ./configure --prefix=/usr/local/mysql --disable-shared
  5651. If you are using HP-UX compiler, you can use the following command
  5652. (which has been tested with cc B.11.11.04):
  5653. CC=cc CXX=aCC CFLAGS=+DD64 CXXFLAGS=+DD64 ./configure \
  5654. --with-extra-character-set=complex
  5655. You can ignore any errors of the following type:
  5656. aCC: warning 901: unknown option: `-3': use +help for online
  5657. documentation
  5658. If you get the following error from configure, verify that you
  5659. don't have the path to the K&R compiler before the path to the
  5660. HP-UX C and C++ compiler:
  5661. checking for cc option to accept ANSI C... no
  5662. configure: error: MySQL requires an ANSI C compiler (and a C++ compil
  5663. er).
  5664. Try gcc. See the Installation chapter in the Reference Manual.
  5665. Another reason for not being able to compile is that you didn't
  5666. define the +DD64 flags as just described.
  5667. Another possibility for HP-UX 11 is to use the MySQL binaries
  5668. provided at http://dev.mysql.com/downloads/, which we have built
  5669. and tested ourselves. We have also received reports that the HP-UX
  5670. 10.20 binaries supplied by MySQL can be run successfully on HP-UX
  5671. 11. If you encounter problems, you should be sure to check your
  5672. HP-UX patch level.
  5673. 2.12. Installing MySQL on AIX
  5674. Automatic detection of xlC is missing from Autoconf, so a number
  5675. of variables need to be set before running configure. The
  5676. following example uses the IBM compiler:
  5677. export CC="xlc_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192 "
  5678. export CXX="xlC_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192"
  5679. export CFLAGS="-I /usr/local/include"
  5680. export LDFLAGS="-L /usr/local/lib"
  5681. export CPPFLAGS=$CFLAGS
  5682. export CXXFLAGS=$CFLAGS
  5683. ./configure --prefix=/usr/local \
  5684. --localstatedir=/var/mysql \
  5685. --sbindir='/usr/local/bin' \
  5686. --libexecdir='/usr/local/bin' \
  5687. --enable-thread-safe-client \
  5688. --enable-large-files
  5689. The preceding options are used to compile the MySQL distribution
  5690. that can be found at http://www-frec.bull.com/.
  5691. If you change the -O3 to -O2 in the preceding configure line, you
  5692. must also remove the -qstrict option. This is a limitation in the
  5693. IBM C compiler.
  5694. If you are using gcc to compile MySQL, you must use the
  5695. -fno-exceptions flag, because the exception handling in gcc is not
  5696. thread-safe! There are also some known problems with IBM's
  5697. assembler that may cause it to generate bad code when used with
  5698. gcc.
  5699. Use the following configure line with gcc 2.95 on AIX:
  5700. CC="gcc -pipe -mcpu=power -Wa,-many" \
  5701. CXX="gcc -pipe -mcpu=power -Wa,-many" \
  5702. CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" \
  5703. ./configure --prefix=/usr/local/mysql --with-low-memory
  5704. The -Wa,-many option is necessary for the compile to be
  5705. successful. IBM is aware of this problem but is in no hurry to fix
  5706. it because of the workaround that is available. We don't know if
  5707. the -fno-exceptions is required with gcc 2.95, but because MySQL
  5708. doesn't use exceptions and the option generates faster code, you
  5709. should always use it with gcc.
  5710. If you get a problem with assembler code, try changing the
  5711. -mcpu=xxx option to match your CPU. Typically power2, power, or
  5712. powerpc may need to be used. Alternatively, you might need to use
  5713. 604 or 604e. We are not positive but suspect that power would
  5714. likely be safe most of the time, even on a power2 machine.
  5715. If you don't know what your CPU is, execute a uname -m command. It
  5716. produces a string that looks like 000514676700, with a format of
  5717. xxyyyyyymmss where xx and ss are always 00, yyyyyy is a unique
  5718. system ID and mm is the ID of the CPU Planar. A chart of these
  5719. values can be found at
  5720. http://www16.boulder.ibm.com/pseries/en_US/cmds/aixcmds5/uname.htm
  5721. .
  5722. This gives you a machine type and a machine model you can use to
  5723. determine what type of CPU you have.
  5724. If you have problems with threads on AIX 5.3, you should upgrade
  5725. AIX 5.3 to technology level 7 (5300-07).
  5726. If you have problems with signals (MySQL dies unexpectedly under
  5727. high load), you may have found an OS bug with threads and signals.
  5728. In this case, you can tell MySQL not to use signals by configuring
  5729. as follows:
  5730. CFLAGS=-DDONT_USE_THR_ALARM CXX=gcc \
  5731. CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti \
  5732. -DDONT_USE_THR_ALARM" \
  5733. ./configure --prefix=/usr/local/mysql --with-debug \
  5734. --with-low-memory
  5735. This doesn't affect the performance of MySQL, but has the side
  5736. effect that you can't kill clients that are "sleeping" on a
  5737. connection with mysqladmin kill or mysqladmin shutdown. Instead,
  5738. the client dies when it issues its next command.
  5739. On some versions of AIX, linking with libbind.a makes
  5740. getservbyname() dump core. This is an AIX bug and should be
  5741. reported to IBM.
  5742. For AIX 4.2.1 and gcc, you have to make the following changes.
  5743. After configuring, edit config.h and include/my_config.h and
  5744. change the line that says this:
  5745. #define HAVE_SNPRINTF 1
  5746. to this:
  5747. #undef HAVE_SNPRINTF
  5748. And finally, in mysqld.cc, you need to add a prototype for
  5749. initgroups().
  5750. #ifdef _AIX41
  5751. extern "C" int initgroups(const char *,int);
  5752. #endif
  5753. For 32-bit binaries, if you need to allocate a lot of memory to
  5754. the mysqld process, it is not enough to just use ulimit -d
  5755. unlimited. You may also have to modify mysqld_safe to add a line
  5756. something like this:
  5757. export LDR_CNTRL='MAXDATA=0x80000000'
  5758. You can find more information about using a lot of memory at
  5759. http://publib16.boulder.ibm.com/pseries/en_US/aixprggd/genprogc/lr
  5760. g_prg_support.htm.
  5761. Users of AIX 4.3 should use gmake instead of the make utility
  5762. included with AIX.
  5763. As of AIX 4.1, the C compiler has been unbundled from AIX as a
  5764. separate product. gcc 3.3.2 can be obtained here:
  5765. ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/gc
  5766. c/
  5767. The steps for compiling MySQL on AIX with gcc 3.3.2 are similar to
  5768. those for using gcc 2.95 (in particular, the need to edit config.h
  5769. and my_config.h after running configure). However, before running
  5770. configure, you should also patch the curses.h file as follows:
  5771. /opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/include/curses
  5772. .h.ORIG
  5773. Mon Dec 26 02:17:28 2005
  5774. --- /opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/include/cu
  5775. rses.h
  5776. Mon Dec 26 02:40:13 2005
  5777. ***************
  5778. *** 2023,2029 ****
  5779. #endif /* _AIX32_CURSES */
  5780. ! #if defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus) || de
  5781. fined
  5782. (__STRICT_ANSI__)
  5783. extern int delwin (WINDOW *);
  5784. extern int endwin (void);
  5785. extern int getcurx (WINDOW *);
  5786. --- 2023,2029 ----
  5787. #endif /* _AIX32_CURSES */
  5788. ! #if 0 && (defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus)
  5789. || defined
  5790. (__STRICT_ANSI__))
  5791. extern int delwin (WINDOW *);
  5792. extern int endwin (void);
  5793. extern int getcurx (WINDOW *);
  5794. 2.13. Post-Installation Setup and Testing
  5795. After installing MySQL, there are some issues that you should
  5796. address. For example, on Unix, you should initialize the data
  5797. directory and create the MySQL grant tables. On all platforms, an
  5798. important security concern is that the initial accounts in the
  5799. grant tables have no passwords. You should assign passwords to
  5800. prevent unauthorized access to the MySQL server. Optionally, you
  5801. can create time zone tables to enable recognition of named time
  5802. zones.
  5803. The following sections include post-installation procedures that
  5804. are specific to Windows systems and to Unix systems. Another
  5805. section, Section 2.13.1.3, "Starting and Troubleshooting the MySQL
  5806. Server," applies to all platforms; it describes what to do if you
  5807. have trouble getting the server to start. Section 2.13.2,
  5808. "Securing the Initial MySQL Accounts," also applies to all
  5809. platforms. You should follow its instructions to make sure that
  5810. you have properly protected your MySQL accounts by assigning
  5811. passwords to them.
  5812. When you are ready to create additional user accounts, you can
  5813. find information on the MySQL access control system and account
  5814. management in Section 5.4, "The MySQL Access Privilege System,"
  5815. and Section 5.5, "MySQL User Account Management."
  5816. 2.13.1. Unix Post-Installation Procedures
  5817. After installing MySQL on Unix, you need to initialize the grant
  5818. tables, start the server, and make sure that the server works
  5819. satisfactorily. You may also wish to arrange for the server to be
  5820. started and stopped automatically when your system starts and
  5821. stops. You should also assign passwords to the accounts in the
  5822. grant tables.
  5823. On Unix, the grant tables are set up by the mysql_install_db
  5824. program. For some installation methods, this program is run for
  5825. you automatically:
  5826. * If you install MySQL on Linux using RPM distributions, the
  5827. server RPM runs mysql_install_db.
  5828. * If you install MySQL on Mac OS X using a PKG distribution, the
  5829. installer runs mysql_install_db.
  5830. Otherwise, you'll need to run mysql_install_db yourself.
  5831. The following procedure describes how to initialize the grant
  5832. tables (if that has not previously been done) and then start the
  5833. server. It also suggests some commands that you can use to test
  5834. whether the server is accessible and working properly. For
  5835. information about starting and stopping the server automatically,
  5836. see Section 2.13.1.2, "Starting and Stopping MySQL Automatically."
  5837. After you complete the procedure and have the server running, you
  5838. should assign passwords to the accounts created by
  5839. mysql_install_db. Instructions for doing so are given in Section
  5840. 2.13.2, "Securing the Initial MySQL Accounts."
  5841. In the examples shown here, the server runs under the user ID of
  5842. the mysql login account. This assumes that such an account exists.
  5843. Either create the account if it does not exist, or substitute the
  5844. name of a different existing login account that you plan to use
  5845. for running the server.
  5846. 1. Change location into the top-level directory of your MySQL
  5847. installation, represented here by BASEDIR:
  5848. shell> cd BASEDIR
  5849. BASEDIR is likely to be something like /usr/local/mysql or
  5850. /usr/local. The following steps assume that you are located in
  5851. this directory.
  5852. 2. If necessary, run the mysql_install_db program to set up the
  5853. initial MySQL grant tables containing the privileges that
  5854. determine how users are allowed to connect to the server.
  5855. You'll need to do this if you used a distribution type for
  5856. which the installation procedure doesn't run the program for
  5857. you.
  5858. Typically, mysql_install_db needs to be run only the first
  5859. time you install MySQL, so you can skip this step if you are
  5860. upgrading an existing installation, However, mysql_install_db
  5861. does not overwrite any existing privilege tables, so it should
  5862. be safe to run in any circumstances.
  5863. To initialize the grant tables, use one of the following
  5864. commands, depending on whether mysql_install_db is located in
  5865. the bin or scripts directory:
  5866. shell> bin/mysql_install_db --user=mysql
  5867. shell> scripts/mysql_install_db --user=mysql
  5868. It might be necessary to specify other options such as
  5869. --basedir or --datadir if mysql_install_db does not use the
  5870. correct locations for the installation directory or data
  5871. directory. For example:
  5872. shell> bin/mysql_install_db --user=mysql \
  5873. --basedir=/opt/mysql/mysql \
  5874. --datadir=/opt/mysql/mysql/data
  5875. The mysql_install_db script creates the server's data
  5876. directory. Under the data directory, it creates directories
  5877. for the mysql database that holds all database privileges and
  5878. the test database that you can use to test MySQL. The script
  5879. also creates privilege table entries for root and
  5880. anonymous-user accounts. The accounts have no passwords
  5881. initially. A description of their initial privileges is given
  5882. in Section 2.13.2, "Securing the Initial MySQL Accounts."
  5883. Briefly, these privileges allow the MySQL root user to do
  5884. anything, and allow anybody to create or use databases with a
  5885. name of test or starting with test_.
  5886. It is important to make sure that the database directories and
  5887. files are owned by the mysql login account so that the server
  5888. has read and write access to them when you run it later. To
  5889. ensure this, the --user option should be used as shown if you
  5890. run mysql_install_db as root. Otherwise, you should execute
  5891. the script while logged in as mysql, in which case you can
  5892. omit the --user option from the command.
  5893. mysql_install_db creates several tables in the mysql database,
  5894. including user, db, host, tables_priv, columns_priv, func, and
  5895. others. See Section 5.4, "The MySQL Access Privilege System,"
  5896. for a complete listing and description of these tables.
  5897. If you don't want to have the test database, you can remove it
  5898. with mysqladmin -u root drop test after starting the server.
  5899. If you have trouble with mysql_install_db at this point, see
  5900. Section 2.13.1.1, "Problems Running mysql_install_db."
  5901. 3. Start the MySQL server:
  5902. shell> bin/mysqld_safe --user=mysql &
  5903. It is important that the MySQL server be run using an
  5904. unprivileged (non-root) login account. To ensure this, the
  5905. --user option should be used as shown if you run mysqld_safe
  5906. as system root. Otherwise, you should execute the script while
  5907. logged in to the system as mysql, in which case you can omit
  5908. the --user option from the command.
  5909. Further instructions for running MySQL as an unprivileged user
  5910. are given in Section 5.3.6, "How to Run MySQL as a Normal
  5911. User."
  5912. If you neglected to create the grant tables before proceeding
  5913. to this step, the following message appears in the error log
  5914. file when you start the server:
  5915. mysqld: Can't find file: 'host.frm'
  5916. If you have other problems starting the server, see Section
  5917. 2.13.1.3, "Starting and Troubleshooting the MySQL Server."
  5918. 4. Use mysqladmin to verify that the server is running. The
  5919. following commands provide simple tests to check whether the
  5920. server is up and responding to connections:
  5921. shell> bin/mysqladmin version
  5922. shell> bin/mysqladmin variables
  5923. The output from mysqladmin version varies slightly depending
  5924. on your platform and version of MySQL, but should be similar
  5925. to that shown here:
  5926. shell> bin/mysqladmin version
  5927. mysqladmin Ver 14.12 Distrib 5.1.46, for pc-linux-gnu on i686
  5928. ...
  5929. Server version 5.1.46
  5930. Protocol version 10
  5931. Connection Localhost via UNIX socket
  5932. UNIX socket /var/lib/mysql/mysql.sock
  5933. Uptime: 14 days 5 hours 5 min 21 sec
  5934. Threads: 1 Questions: 366 Slow queries: 0
  5935. Opens: 0 Flush tables: 1 Open tables: 19
  5936. Queries per second avg: 0.000
  5937. To see what else you can do with mysqladmin, invoke it with
  5938. the --help option.
  5939. 5. Verify that you can shut down the server:
  5940. shell> bin/mysqladmin -u root shutdown
  5941. 6. Verify that you can start the server again. Do this by using
  5942. mysqld_safe or by invoking mysqld directly. For example:
  5943. shell> bin/mysqld_safe --user=mysql --log &
  5944. If mysqld_safe fails, see Section 2.13.1.3, "Starting and
  5945. Troubleshooting the MySQL Server."
  5946. 7. Run some simple tests to verify that you can retrieve
  5947. information from the server. The output should be similar to
  5948. what is shown here:
  5949. shell> bin/mysqlshow
  5950. +-----------+
  5951. | Databases |
  5952. +-----------+
  5953. | mysql |
  5954. | test |
  5955. +-----------+
  5956. shell> bin/mysqlshow mysql
  5957. Database: mysql
  5958. +---------------------------+
  5959. | Tables |
  5960. +---------------------------+
  5961. | columns_priv |
  5962. | db |
  5963. | func |
  5964. | help_category |
  5965. | help_keyword |
  5966. | help_relation |
  5967. | help_topic |
  5968. | host |
  5969. | proc |
  5970. | procs_priv |
  5971. | tables_priv |
  5972. | time_zone |
  5973. | time_zone_leap_second |
  5974. | time_zone_name |
  5975. | time_zone_transition |
  5976. | time_zone_transition_type |
  5977. | user |
  5978. +---------------------------+
  5979. shell> bin/mysql -e "SELECT Host,Db,User FROM db" mysql
  5980. +------+--------+------+
  5981. | host | db | user |
  5982. +------+--------+------+
  5983. | % | test | |
  5984. | % | test_% | |
  5985. +------+--------+------+
  5986. 8. There is a benchmark suite in the sql-bench directory (under
  5987. the MySQL installation directory) that you can use to compare
  5988. how MySQL performs on different platforms. The benchmark suite
  5989. is written in Perl. It requires the Perl DBI module that
  5990. provides a database-independent interface to the various
  5991. databases, and some other additional Perl modules:
  5992. DBI
  5993. DBD::mysql
  5994. Data::Dumper
  5995. Data::ShowTable
  5996. These modules can be obtained from CPAN
  5997. (http://www.cpan.org/). See also Section 2.15.1, "Installing
  5998. Perl on Unix."
  5999. The sql-bench/Results directory contains the results from many
  6000. runs against different databases and platforms. To run all
  6001. tests, execute these commands:
  6002. shell> cd sql-bench
  6003. shell> perl run-all-tests
  6004. If you don't have the sql-bench directory, you probably
  6005. installed MySQL using RPM files other than the source RPM.
  6006. (The source RPM includes the sql-bench benchmark directory.)
  6007. In this case, you must first install the benchmark suite
  6008. before you can use it. There are separate benchmark RPM files
  6009. named mysql-bench-VERSION.i386.rpm that contain benchmark code
  6010. and data.
  6011. If you have a source distribution, there are also tests in its
  6012. tests subdirectory that you can run. For example, to run
  6013. auto_increment.tst, execute this command from the top-level
  6014. directory of your source distribution:
  6015. shell> mysql -vvf test < ./tests/auto_increment.tst
  6016. The expected result of the test can be found in the
  6017. ./tests/auto_increment.res file.
  6018. 9. At this point, you should have the server running. However,
  6019. none of the initial MySQL accounts have a password, so you
  6020. should assign passwords using the instructions found in
  6021. Section 2.13.2, "Securing the Initial MySQL Accounts."
  6022. The MySQL 5.1 installation procedure creates time zone tables in
  6023. the mysql database. However, you must populate the tables manually
  6024. using the instructions in Section 9.6, "MySQL Server Time Zone
  6025. Support."
  6026. 2.13.1.1. Problems Running mysql_install_db
  6027. The purpose of the mysql_install_db script is to generate new
  6028. MySQL privilege tables. It does not overwrite existing MySQL
  6029. privilege tables, and it does not affect any other data.
  6030. If you want to re-create your privilege tables, first stop the
  6031. mysqld server if it is running. Then rename the mysql directory
  6032. under the data directory to save it, and then run
  6033. mysql_install_db. Suppose that your current directory is the MySQL
  6034. installation directory and that mysql_install_db is located in the
  6035. bin directory and the data directory is named data. To rename the
  6036. mysql database and re-run mysql_install_db, use these commands.
  6037. shell> mv data/mysql data/mysql.old
  6038. shell> bin/mysql_install_db --user=mysql
  6039. When you run mysql_install_db, you might encounter the following
  6040. problems:
  6041. * mysql_install_db fails to install the grant tables
  6042. You may find that mysql_install_db fails to install the grant
  6043. tables and terminates after displaying the following messages:
  6044. Starting mysqld daemon with databases from XXXXXX
  6045. mysqld ended
  6046. In this case, you should examine the error log file very
  6047. carefully. The log should be located in the directory XXXXXX
  6048. named by the error message and should indicate why mysqld
  6049. didn't start. If you do not understand what happened, include
  6050. the log when you post a bug report. See Section 1.7, "How to
  6051. Report Bugs or Problems."
  6052. * There is a mysqld process running
  6053. This indicates that the server is running, in which case the
  6054. grant tables have probably been created already. If so, there
  6055. is no need to run mysql_install_db at all because it needs to
  6056. be run only once (when you install MySQL the first time).
  6057. * Installing a second mysqld server does not work when one
  6058. server is running
  6059. This can happen when you have an existing MySQL installation,
  6060. but want to put a new installation in a different location.
  6061. For example, you might have a production installation, but you
  6062. want to create a second installation for testing purposes.
  6063. Generally the problem that occurs when you try to run a second
  6064. server is that it tries to use a network interface that is in
  6065. use by the first server. In this case, you should see one of
  6066. the following error messages:
  6067. Can't start server: Bind on TCP/IP port:
  6068. Address already in use
  6069. Can't start server: Bind on unix socket...
  6070. For instructions on setting up multiple servers, see Section
  6071. 5.6, "Running Multiple MySQL Servers on the Same Machine."
  6072. * You do not have write access to the /tmp directory
  6073. If you do not have write access to create temporary files or a
  6074. Unix socket file in the default location (the /tmp directory),
  6075. an error occurs when you run mysql_install_db or the mysqld
  6076. server.
  6077. You can specify different locations for the temporary
  6078. directory and Unix socket file by executing these commands
  6079. prior to starting mysql_install_db or mysqld, where
  6080. some_tmp_dir is the full path name to some directory for which
  6081. you have write permission:
  6082. shell> TMPDIR=/some_tmp_dir/
  6083. shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysql.sock
  6084. shell> export TMPDIR MYSQL_UNIX_PORT
  6085. Then you should be able to run mysql_install_db and start the
  6086. server with these commands:
  6087. shell> bin/mysql_install_db --user=mysql
  6088. shell> bin/mysqld_safe --user=mysql &
  6089. If mysql_install_db is located in the scripts directory,
  6090. modify the first command to scripts/mysql_install_db.
  6091. See Section B.5.4.5, "How to Protect or Change the MySQL Unix
  6092. Socket File," and Section 2.14, "Environment Variables."
  6093. There are some alternatives to running the mysql_install_db script
  6094. provided in the MySQL distribution:
  6095. * If you want the initial privileges to be different from the
  6096. standard defaults, you can modify mysql_install_db before you
  6097. run it. However, it is preferable to use GRANT and REVOKE to
  6098. change the privileges after the grant tables have been set up.
  6099. In other words, you can run mysql_install_db, and then use
  6100. mysql -u root mysql to connect to the server as the MySQL root
  6101. user so that you can issue the necessary GRANT and REVOKE
  6102. statements.
  6103. If you want to install MySQL on several machines with the same
  6104. privileges, you can put the GRANT and REVOKE statements in a
  6105. file and execute the file as a script using mysql after
  6106. running mysql_install_db. For example:
  6107. shell> bin/mysql_install_db --user=mysql
  6108. shell> bin/mysql -u root < your_script_file
  6109. By doing this, you can avoid having to issue the statements
  6110. manually on each machine.
  6111. * It is possible to re-create the grant tables completely after
  6112. they have previously been created. You might want to do this
  6113. if you're just learning how to use GRANT and REVOKE and have
  6114. made so many modifications after running mysql_install_db that
  6115. you want to wipe out the tables and start over.
  6116. To re-create the grant tables, remove all the .frm, .MYI, and
  6117. .MYD files in the mysql database directory. Then run the
  6118. mysql_install_db script again.
  6119. * You can start mysqld manually using the --skip-grant-tables
  6120. option and add the privilege information yourself using mysql:
  6121. shell> bin/mysqld_safe --user=mysql --skip-grant-tables &
  6122. shell> bin/mysql mysql
  6123. From mysql, manually execute the SQL commands contained in
  6124. mysql_install_db. Make sure that you run mysqladmin
  6125. flush-privileges or mysqladmin reload afterward to tell the
  6126. server to reload the grant tables.
  6127. Note that by not using mysql_install_db, you not only have to
  6128. populate the grant tables manually, you also have to create
  6129. them first.
  6130. 2.13.1.2. Starting and Stopping MySQL Automatically
  6131. Generally, you start the mysqld server in one of these ways:
  6132. * Invoke mysqld directly. This works on any platform.
  6133. * Run the MySQL server as a Windows service. The service can be
  6134. set to start the server automatically when Windows starts, or
  6135. as a manual service that you start on request. For
  6136. instructions, see Section 2.5.5.6, "Starting MySQL as a
  6137. Windows Service."
  6138. * Invoke mysqld_safe, which tries to determine the proper
  6139. options for mysqld and then runs it with those options. This
  6140. script is used on Unix and Unix-like systems. See Section
  6141. 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
  6142. * Invoke mysql.server. This script is used primarily at system
  6143. startup and shutdown on systems that use System V-style run
  6144. directories, where it usually is installed under the name
  6145. mysql. The mysql.server script starts the server by invoking
  6146. mysqld_safe. See Section 4.3.3, "mysql.server --- MySQL Server
  6147. Startup Script."
  6148. * On Mac OS X, install a separate MySQL Startup Item package to
  6149. enable the automatic startup of MySQL on system startup. The
  6150. Startup Item starts the server by invoking mysql.server. See
  6151. Section 2.7, "Installing MySQL on Mac OS X," for details.
  6152. The mysqld_safe and mysql.server scripts and the Mac OS X Startup
  6153. Item can be used to start the server manually, or automatically at
  6154. system startup time. mysql.server and the Startup Item also can be
  6155. used to stop the server.
  6156. To start or stop the server manually using the mysql.server
  6157. script, invoke it with start or stop arguments:
  6158. shell> mysql.server start
  6159. shell> mysql.server stop
  6160. Before mysql.server starts the server, it changes location to the
  6161. MySQL installation directory, and then invokes mysqld_safe. If you
  6162. want the server to run as some specific user, add an appropriate
  6163. user option to the [mysqld] group of the /etc/my.cnf option file,
  6164. as shown later in this section. (It is possible that you will need
  6165. to edit mysql.server if you've installed a binary distribution of
  6166. MySQL in a nonstandard location. Modify it to change location into
  6167. the proper directory before it runs mysqld_safe. If you do this,
  6168. your modified version of mysql.server may be overwritten if you
  6169. upgrade MySQL in the future, so you should make a copy of your
  6170. edited version that you can reinstall.)
  6171. mysql.server stop stops the server by sending a signal to it. You
  6172. can also stop the server manually by executing mysqladmin
  6173. shutdown.
  6174. To start and stop MySQL automatically on your server, you need to
  6175. add start and stop commands to the appropriate places in your
  6176. /etc/rc* files.
  6177. If you use the Linux server RPM package
  6178. (MySQL-server-VERSION.rpm), the mysql.server script is installed
  6179. in the /etc/init.d directory with the name mysql. You need not
  6180. install it manually. See Section 2.6.1, "Installing MySQL from RPM
  6181. Packages on Linux," for more information on the Linux RPM
  6182. packages.
  6183. Some vendors provide RPM packages that install a startup script
  6184. under a different name such as mysqld.
  6185. If you install MySQL from a source distribution or using a binary
  6186. distribution format that does not install mysql.server
  6187. automatically, you can install it manually. The script can be
  6188. found in the support-files directory under the MySQL installation
  6189. directory or in a MySQL source tree.
  6190. To install mysql.server manually, copy it to the /etc/init.d
  6191. directory with the name mysql, and then make it executable. Do
  6192. this by changing location into the appropriate directory where
  6193. mysql.server is located and executing these commands:
  6194. shell> cp mysql.server /etc/init.d/mysql
  6195. shell> chmod +x /etc/init.d/mysql
  6196. Older Red Hat systems use the /etc/rc.d/init.d directory rather
  6197. than /etc/init.d. Adjust the preceding commands accordingly.
  6198. Alternatively, first create /etc/init.d as a symbolic link that
  6199. points to /etc/rc.d/init.d:
  6200. shell> cd /etc
  6201. shell> ln -s rc.d/init.d .
  6202. After installing the script, the commands needed to activate it to
  6203. run at system startup depend on your operating system. On Linux,
  6204. you can use chkconfig:
  6205. shell> chkconfig --add mysql
  6206. On some Linux systems, the following command also seems to be
  6207. necessary to fully enable the mysql script:
  6208. shell> chkconfig --level 345 mysql on
  6209. On FreeBSD, startup scripts generally should go in
  6210. /usr/local/etc/rc.d/. The rc(8) manual page states that scripts in
  6211. this directory are executed only if their basename matches the
  6212. *.sh shell file name pattern. Any other files or directories
  6213. present within the directory are silently ignored. In other words,
  6214. on FreeBSD, you should install the mysql.server script as
  6215. /usr/local/etc/rc.d/mysql.server.sh to enable automatic startup.
  6216. As an alternative to the preceding setup, some operating systems
  6217. also use /etc/rc.local or /etc/init.d/boot.local to start
  6218. additional services on startup. To start up MySQL using this
  6219. method, you could append a command like the one following to the
  6220. appropriate startup file:
  6221. /bin/sh -c 'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &'
  6222. For other systems, consult your operating system documentation to
  6223. see how to install startup scripts.
  6224. You can add options for mysql.server in a global /etc/my.cnf file.
  6225. A typical /etc/my.cnf file might look like this:
  6226. [mysqld]
  6227. datadir=/usr/local/mysql/var
  6228. socket=/var/tmp/mysql.sock
  6229. port=3306
  6230. user=mysql
  6231. [mysql.server]
  6232. basedir=/usr/local/mysql
  6233. The mysql.server script supports the following options: basedir,
  6234. datadir, and pid-file. If specified, they must be placed in an
  6235. option file, not on the command line. mysql.server supports only
  6236. start and stop as command-line arguments.
  6237. The following table shows which option groups the server and each
  6238. startup script read from option files.
  6239. Script Option Groups
  6240. mysqld [mysqld], [server], [mysqld-major_version]
  6241. mysqld_safe [mysqld], [server], [mysqld_safe]
  6242. mysql.server [mysqld], [mysql.server], [server]
  6243. [mysqld-major_version] means that groups with names like
  6244. [mysqld-5.0] and [mysqld-5.1] are read by servers having versions
  6245. 5.0.x, 5.1.x, and so forth. This feature can be used to specify
  6246. options that can be read only by servers within a given release
  6247. series.
  6248. For backward compatibility, mysql.server also reads the
  6249. [mysql_server] group and mysqld_safe also reads the [safe_mysqld]
  6250. group. However, you should update your option files to use the
  6251. [mysql.server] and [mysqld_safe] groups instead when using MySQL
  6252. 5.1.
  6253. See Section 4.2.3.3, "Using Option Files."
  6254. 2.13.1.3. Starting and Troubleshooting the MySQL Server
  6255. This section provides troubleshooting suggestions for problems
  6256. starting the server on Unix. If you are using Windows, see Section
  6257. 2.5.6, "Troubleshooting a MySQL Installation Under Windows."
  6258. If you have problems starting the server, here are some things to
  6259. try:
  6260. * Check the error log to see why the server does not start.
  6261. * Specify any special options needed by the storage engines you
  6262. are using.
  6263. * Make sure that the server knows where to find the data
  6264. directory.
  6265. * Make sure that the server can access the data directory. The
  6266. ownership and permissions of the data directory and its
  6267. contents must be set such that the server can read and modify
  6268. them.
  6269. * Verify that the network interfaces the server wants to use are
  6270. available.
  6271. Some storage engines have options that control their behavior. You
  6272. can create a my.cnf file and specify startup options for the
  6273. engines that you plan to use. If you are going to use storage
  6274. engines that support transactional tables (InnoDB, NDB), be sure
  6275. that you have them configured the way you want before starting the
  6276. server:
  6277. * If you are using InnoDB tables, see Section 13.6.2, "InnoDB
  6278. Configuration."
  6279. * If you are using MySQL Cluster, see Section 17.3, "MySQL
  6280. Cluster Configuration."
  6281. MySQL Enterprise For expert advice on start-up options appropriate
  6282. to your circumstances, subscribe to The MySQL Enterprise Monitor.
  6283. For more information, see
  6284. http://www.mysql.com/products/enterprise/advisors.html.
  6285. Storage engines will use default option values if you specify
  6286. none, but it is recommended that you review the available options
  6287. and specify explicit values for those for which the defaults are
  6288. not appropriate for your installation.
  6289. When the mysqld server starts, it changes location to the data
  6290. directory. This is where it expects to find databases and where it
  6291. expects to write log files. The server also writes the pid
  6292. (process ID) file in the data directory.
  6293. The data directory location is hardwired in when the server is
  6294. compiled. This is where the server looks for the data directory by
  6295. default. If the data directory is located somewhere else on your
  6296. system, the server will not work properly. You can determine what
  6297. the default path settings are by invoking mysqld with the
  6298. --verbose and --help options.
  6299. If the default locations don't match the MySQL installation layout
  6300. on your system, you can override them by specifying options to
  6301. mysqld or mysqld_safe on the command line or in an option file.
  6302. To specify the location of the data directory explicitly, use the
  6303. --datadir option. However, normally you can tell mysqld the
  6304. location of the base directory under which MySQL is installed and
  6305. it looks for the data directory there. You can do this with the
  6306. --basedir option.
  6307. To check the effect of specifying path options, invoke mysqld with
  6308. those options followed by the --verbose and --help options. For
  6309. example, if you change location into the directory where mysqld is
  6310. installed and then run the following command, it shows the effect
  6311. of starting the server with a base directory of /usr/local:
  6312. shell> ./mysqld --basedir=/usr/local --verbose --help
  6313. You can specify other options such as --datadir as well, but
  6314. --verbose and --help must be the last options.
  6315. Once you determine the path settings you want, start the server
  6316. without --verbose and --help.
  6317. If mysqld is currently running, you can find out what path
  6318. settings it is using by executing this command:
  6319. shell> mysqladmin variables
  6320. Or:
  6321. shell> mysqladmin -h host_name variables
  6322. host_name is the name of the MySQL server host.
  6323. If you get Errcode 13 (which means Permission denied) when
  6324. starting mysqld, this means that the privileges of the data
  6325. directory or its contents do not allow the server access. In this
  6326. case, you change the permissions for the involved files and
  6327. directories so that the server has the right to use them. You can
  6328. also start the server as root, but this raises security issues and
  6329. should be avoided.
  6330. On Unix, change location into the data directory and check the
  6331. ownership of the data directory and its contents to make sure the
  6332. server has access. For example, if the data directory is
  6333. /usr/local/mysql/var, use this command:
  6334. shell> ls -la /usr/local/mysql/var
  6335. If the data directory or its files or subdirectories are not owned
  6336. by the login account that you use for running the server, change
  6337. their ownership to that account. If the account is named mysql,
  6338. use these commands:
  6339. shell> chown -R mysql /usr/local/mysql/var
  6340. shell> chgrp -R mysql /usr/local/mysql/var
  6341. If it possible that even with correct ownership, MySQL may fail to
  6342. start up if there is other security software running on your
  6343. system that manages application access to various parts of the
  6344. file system. In this case, you may need to reconfigure that
  6345. software to enable mysqld to access the directories it uses during
  6346. normal operation.
  6347. If the server fails to start up correctly, check the error log.
  6348. Log files are located in the data directory (typically C:\Program
  6349. Files\MySQL\MySQL Server 5.1\data on Windows,
  6350. /usr/local/mysql/data for a Unix binary distribution, and
  6351. /usr/local/var for a Unix source distribution). Look in the data
  6352. directory for files with names of the form host_name.err and
  6353. host_name.log, where host_name is the name of your server host.
  6354. Then examine the last few lines of these files. On Unix, you can
  6355. use tail to display them:
  6356. shell> tail host_name.err
  6357. shell> tail host_name.log
  6358. The error log should contain information that indicates why the
  6359. server couldn't start.
  6360. If either of the following errors occur, it means that some other
  6361. program (perhaps another mysqld server) is using the TCP/IP port
  6362. or Unix socket file that mysqld is trying to use:
  6363. Can't start server: Bind on TCP/IP port: Address already in use
  6364. Can't start server: Bind on unix socket...
  6365. Use ps to determine whether you have another mysqld server
  6366. running. If so, shut down the server before starting mysqld again.
  6367. (If another server is running, and you really want to run multiple
  6368. servers, you can find information about how to do so in Section
  6369. 5.6, "Running Multiple MySQL Servers on the Same Machine.")
  6370. If no other server is running, try to execute the command telnet
  6371. your_host_name tcp_ip_port_number. (The default MySQL port number
  6372. is 3306.) Then press Enter a couple of times. If you don't get an
  6373. error message like telnet: Unable to connect to remote host:
  6374. Connection refused, some other program is using the TCP/IP port
  6375. that mysqld is trying to use. You'll need to track down what
  6376. program this is and disable it, or else tell mysqld to listen to a
  6377. different port with the --port option. In this case, you'll also
  6378. need to specify the port number for client programs when
  6379. connecting to the server via TCP/IP.
  6380. Another reason the port might be inaccessible is that you have a
  6381. firewall running that blocks connections to it. If so, modify the
  6382. firewall settings to allow access to the port.
  6383. If the server starts but you can't connect to it, you should make
  6384. sure that you have an entry in /etc/hosts that looks like this:
  6385. 127.0.0.1 localhost
  6386. This problem occurs only on systems that do not have a working
  6387. thread library and for which MySQL must be configured to use
  6388. MIT-pthreads.
  6389. If you cannot get mysqld to start, you can try to make a trace
  6390. file to find the problem by using the --debug option. See MySQL
  6391. Internals: Porting
  6392. (http://forge.mysql.com/wiki/MySQL_Internals_Porting).
  6393. 2.13.2. Securing the Initial MySQL Accounts
  6394. Part of the MySQL installation process is to set up the mysql
  6395. database that contains the grant tables:
  6396. * Windows distributions contain preinitialized grant tables that
  6397. are installed automatically.
  6398. * On Unix, the grant tables are populated by the
  6399. mysql_install_db program. Some installation methods run this
  6400. program for you. Others require that you execute it manually.
  6401. For details, see Section 2.13.1, "Unix Post-Installation
  6402. Procedures."
  6403. The grant tables define the initial MySQL user accounts and their
  6404. access privileges. These accounts are set up as follows:
  6405. * Accounts with the user name root are created. These are
  6406. superuser accounts that can do anything. The initial root
  6407. account passwords are empty, so anyone can connect to the
  6408. MySQL server as root --- without a password --- and be granted
  6409. all privileges.
  6410. + On Windows, one root account is created; this account
  6411. allows connecting from the local host only. The Windows
  6412. installer will optionally create an account allowing for
  6413. connections from any host only if the user selects the
  6414. Enable root access from remote machines option during
  6415. installation.
  6416. + On Unix, both root accounts are for connections from the
  6417. local host. Connections must be made from the local host
  6418. by specifying a host name of localhost for one of the
  6419. accounts, or the actual host name or IP number for the
  6420. other.
  6421. * Two anonymous-user accounts are created, each with an empty
  6422. user name. The anonymous accounts have no password, so anyone
  6423. can use them to connect to the MySQL server.
  6424. + On Windows, one anonymous account is for connections from
  6425. the local host. It has no global privileges. (Before
  6426. MySQL 5.1.16, it has all global privileges, just like the
  6427. root accounts.) The other is for connections from any
  6428. host and has all privileges for the test database and for
  6429. other databases with names that start with test.
  6430. + On Unix, both anonymous accounts are for connections from
  6431. the local host. Connections must be made from the local
  6432. host by specifying a host name of localhost for one of
  6433. the accounts, or the actual host name or IP number for
  6434. the other. These accounts have all privileges for the
  6435. test database and for other databases with names that
  6436. start with test_.
  6437. As noted, none of the initial accounts have passwords. This means
  6438. that your MySQL installation is unprotected until you do something
  6439. about it:
  6440. * If you want to prevent clients from connecting as anonymous
  6441. users without a password, you should either assign a password
  6442. to each anonymous account or else remove the accounts.
  6443. * You should assign a password to each MySQL root account.
  6444. The following instructions describe how to set up passwords for
  6445. the initial MySQL accounts, first for the anonymous accounts and
  6446. then for the root accounts. Replace "newpwd" in the examples with
  6447. the actual password that you want to use. The instructions also
  6448. cover how to remove the anonymous accounts, should you prefer not
  6449. to allow anonymous access at all.
  6450. You might want to defer setting the passwords until later, so that
  6451. you don't need to specify them while you perform additional setup
  6452. or testing. However, be sure to set them before using your
  6453. installation for production purposes.
  6454. Anonymous Account Password Assignment
  6455. To assign passwords to the anonymous accounts, connect to the
  6456. server as root and then use either SET PASSWORD or UPDATE. In
  6457. either case, be sure to encrypt the password using the PASSWORD()
  6458. function.
  6459. To use SET PASSWORD on Windows, do this:
  6460. shell> mysql -u root
  6461. mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
  6462. mysql> SET PASSWORD FOR ''@'%' = PASSWORD('newpwd');
  6463. To use SET PASSWORD on Unix, do this:
  6464. shell> mysql -u root
  6465. mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
  6466. mysql> SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd');
  6467. In the second SET PASSWORD statement, replace host_name with the
  6468. name of the server host. This is the name that is specified in the
  6469. Host column of the non-localhost record for root in the user
  6470. table. If you don't know what host name this is, issue the
  6471. following statement before using SET PASSWORD:
  6472. mysql> SELECT Host, User FROM mysql.user;
  6473. Look for the record that has root in the User column and something
  6474. other than localhost in the Host column. Then use that Host value
  6475. in the second SET PASSWORD statement.
  6476. Anonymous Account Removal
  6477. If you prefer to remove the anonymous accounts instead, do so as
  6478. follows:
  6479. shell> mysql -u root
  6480. mysql> DROP USER '';
  6481. The DROP statement applies both to Windows and to Unix. On
  6482. Windows, if you want to remove only the anonymous account that has
  6483. the same privileges as root, do this instead:
  6484. shell> mysql -u root
  6485. mysql> DROP USER ''@'localhost';
  6486. That account allows anonymous access but has full privileges, so
  6487. removing it improves security.
  6488. root Account Password Assignment
  6489. You can assign passwords to the root accounts in several ways. The
  6490. following discussion demonstrates three methods:
  6491. * Use the SET PASSWORD statement
  6492. * Use the mysqladmin command-line client program
  6493. * Use the UPDATE statement
  6494. To assign passwords using SET PASSWORD, connect to the server as
  6495. root and issue SET PASSWORD statements. Be sure to encrypt the
  6496. password using the PASSWORD() function.
  6497. For Windows, do this:
  6498. shell> mysql -u root
  6499. mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
  6500. mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd');
  6501. For Unix, do this:
  6502. shell> mysql -u root
  6503. mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
  6504. mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');
  6505. In the second SET PASSWORD statement, replace host_name with the
  6506. name of the server host. This is the same host name that you used
  6507. when you assigned the anonymous account passwords.
  6508. If the user table contains an account with User and Host values of
  6509. 'root' and '127.0.0.1', use an additional SET PASSWORD statement
  6510. to set that account's password:
  6511. mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd');
  6512. To assign passwords to the root accounts using mysqladmin, execute
  6513. the following commands:
  6514. shell> mysqladmin -u root password "newpwd"
  6515. shell> mysqladmin -u root -h host_name password "newpwd"
  6516. These commands apply both to Windows and to Unix. In the second
  6517. command, replace host_name with the name of the server host. The
  6518. double quotes around the password are not always necessary, but
  6519. you should use them if the password contains spaces or other
  6520. characters that are special to your command interpreter.
  6521. The mysqladmin method of setting the root account passwords does
  6522. not set the password for the 'root'@'127.0.0.1' account. To do so,
  6523. use SET PASSWORD as shown earlier.
  6524. You can also use UPDATE to modify the user table directly. The
  6525. following UPDATE statement assigns a password to all root
  6526. accounts:
  6527. shell> mysql -u root
  6528. mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
  6529. -> WHERE User = 'root';
  6530. mysql> FLUSH PRIVILEGES;
  6531. The UPDATE statement applies both to Windows and to Unix.
  6532. After the passwords have been set, you must supply the appropriate
  6533. password whenever you connect to the server. For example, if you
  6534. want to use mysqladmin to shut down the server, you can do so
  6535. using this command:
  6536. shell> mysqladmin -u root -p shutdown
  6537. Enter password: (enter root password here)
  6538. Note
  6539. If you forget your root password after setting it up, Section
  6540. B.5.4.1, "How to Reset the Root Password," covers the procedure
  6541. for resetting it.
  6542. To set up additional accounts, you can use the GRANT statement.
  6543. For instructions, see Section 5.5.2, "Adding User Accounts."
  6544. 2.14. Environment Variables
  6545. This section lists all the environment variables that are used
  6546. directly or indirectly by MySQL. Most of these can also be found
  6547. in other places in this manual.
  6548. Note that any options on the command line take precedence over
  6549. values specified in option files and environment variables, and
  6550. values in option files take precedence over values in environment
  6551. variables.
  6552. In many cases, it is preferable to use an option file instead of
  6553. environment variables to modify the behavior of MySQL. See Section
  6554. 4.2.3.3, "Using Option Files."
  6555. Variable Description
  6556. CXX The name of your C++ compiler (for running configure).
  6557. CC The name of your C compiler (for running configure).
  6558. CFLAGS Flags for your C compiler (for running configure).
  6559. CXXFLAGS Flags for your C++ compiler (for running configure).
  6560. DBI_USER The default user name for Perl DBI.
  6561. DBI_TRACE Trace options for Perl DBI.
  6562. HOME The default path for the mysql history file is
  6563. $HOME/.mysql_history.
  6564. LD_RUN_PATH Used to specify the location of libmysqlclient.so.
  6565. MYSQL_DEBUG Debug trace options when debugging.
  6566. MYSQL_GROUP_SUFFIX Option group suffix value (like specifying
  6567. --defaults-group-suffix).
  6568. MYSQL_HISTFILE The path to the mysql history file. If this
  6569. variable is set, its value overrides the default for
  6570. $HOME/.mysql_history.
  6571. MYSQL_HOME The path to the directory in which the server-specific
  6572. my.cnf file resides (as of MySQL 5.0.3).
  6573. MYSQL_HOST The default host name used by the mysql command-line
  6574. client.
  6575. MYSQL_PS1 The command prompt to use in the mysql command-line
  6576. client.
  6577. MYSQL_PWD The default password when connecting to mysqld. Note
  6578. that using this is insecure. See Section 5.3.2.2, "End-User
  6579. Guidelines for Password Security."
  6580. MYSQL_TCP_PORT The default TCP/IP port number.
  6581. MYSQL_UNIX_PORT The default Unix socket file name; used for
  6582. connections to localhost.
  6583. PATH Used by the shell to find MySQL programs.
  6584. TMPDIR The directory where temporary files are created.
  6585. TZ This should be set to your local time zone. See Section
  6586. B.5.4.6, "Time Zone Problems."
  6587. UMASK The user-file creation mode when creating files. See note
  6588. following table.
  6589. UMASK_DIR The user-directory creation mode when creating
  6590. directories. See note following table.
  6591. USER The default user name on Windows and NetWare used when
  6592. connecting to mysqld.
  6593. The UMASK and UMASK_DIR variables, despite their names, are used
  6594. as modes, not masks:
  6595. * If UMASK is set, mysqld uses ($UMASK | 0600) as the mode for
  6596. file creation, so that newly created files have a mode in the
  6597. range from 0600 to 0666 (all values octal).
  6598. * If UMASK_DIR is set, mysqld uses ($UMASK_DIR | 0700) as the
  6599. base mode for directory creation, which then is AND-ed with
  6600. ~(~$UMASK & 0666), so that newly created directories have a
  6601. mode in the range from 0700 to 0777 (all values octal). The
  6602. AND operation may remove read and write permissions from the
  6603. directory mode, but not execute permissions.
  6604. MySQL assumes that the value for UMASK or UMASK_DIR is in octal if
  6605. it starts with a zero.
  6606. 2.15. Perl Installation Notes
  6607. Perl support for MySQL is provided by means of the DBI/DBD client
  6608. interface. The interface requires Perl 5.6.0, and 5.6.1 or later
  6609. is preferred. DBI does not work if you have an older version of
  6610. Perl.
  6611. If you want to use transactions with Perl DBI, you need to have
  6612. DBD::mysql 2.0900. If you are using the MySQL 4.1 or newer client
  6613. library, you must use DBD::mysql 2.9003 or newer. Support for
  6614. server-side prepared statements requires DBD::mysql 3.0009 or
  6615. newer.
  6616. Perl support is not included with MySQL distributions. You can
  6617. obtain the necessary modules from http://search.cpan.org for Unix,
  6618. or by using the ActiveState ppm program on Windows. The following
  6619. sections describe how to do this.
  6620. Perl support for MySQL must be installed if you want to run the
  6621. MySQL benchmark scripts; see Section 7.1.3, "The MySQL Benchmark
  6622. Suite." It is also required for the MySQL Cluster ndb_size.pl
  6623. utility; see Section 17.4.21, "ndb_size.pl --- NDBCLUSTER Size
  6624. Requirement Estimator."
  6625. 2.15.1. Installing Perl on Unix
  6626. MySQL Perl support requires that you have installed MySQL client
  6627. programming support (libraries and header files). Most
  6628. installation methods install the necessary files. However, if you
  6629. installed MySQL from RPM files on Linux, be sure that you've
  6630. installed the developer RPM. The client programs are in the client
  6631. RPM, but client programming support is in the developer RPM.
  6632. If you want to install Perl support, the files you need can be
  6633. obtained from the CPAN (Comprehensive Perl Archive Network) at
  6634. http://search.cpan.org.
  6635. The easiest way to install Perl modules on Unix is to use the CPAN
  6636. module. For example:
  6637. shell> perl -MCPAN -e shell
  6638. cpan> install DBI
  6639. cpan> install DBD::mysql
  6640. The DBD::mysql installation runs a number of tests. These tests
  6641. attempt to connect to the local MySQL server using the default
  6642. user name and password. (The default user name is your login name
  6643. on Unix, and ODBC on Windows. The default password is "no
  6644. password.") If you cannot connect to the server with those values
  6645. (for example, if your account has a password), the tests fail. You
  6646. can use force install DBD::mysql to ignore the failed tests.
  6647. DBI requires the Data::Dumper module. It may be installed; if not,
  6648. you should install it before installing DBI.
  6649. It is also possible to download the module distributions in the
  6650. form of compressed tar archives and build the modules manually.
  6651. For example, to unpack and build a DBI distribution, use a
  6652. procedure such as this:
  6653. 1. Unpack the distribution into the current directory:
  6654. shell> gunzip < DBI-VERSION.tar.gz | tar xvf -
  6655. This command creates a directory named DBI-VERSION.
  6656. 2. Change location into the top-level directory of the unpacked
  6657. distribution:
  6658. shell> cd DBI-VERSION
  6659. 3. Build the distribution and compile everything:
  6660. shell> perl Makefile.PL
  6661. shell> make
  6662. shell> make test
  6663. shell> make install
  6664. The make test command is important because it verifies that the
  6665. module is working. Note that when you run that command during the
  6666. DBD::mysql installation to exercise the interface code, the MySQL
  6667. server must be running or the test fails.
  6668. It is a good idea to rebuild and reinstall the DBD::mysql
  6669. distribution whenever you install a new release of MySQL,
  6670. particularly if you notice symptoms such as that all your DBI
  6671. scripts fail after you upgrade MySQL.
  6672. If you do not have access rights to install Perl modules in the
  6673. system directory or if you want to install local Perl modules, the
  6674. following reference may be useful:
  6675. http://servers.digitaldaze.com/extensions/perl/modules.html#module
  6676. s
  6677. Look under the heading "Installing New Modules that Require
  6678. Locally Installed Modules."
  6679. 2.15.2. Installing ActiveState Perl on Windows
  6680. On Windows, you should do the following to install the MySQL DBD
  6681. module with ActiveState Perl:
  6682. 1. Get ActiveState Perl from
  6683. http://www.activestate.com/Products/ActivePerl/ and install
  6684. it.
  6685. 2. Open a console window (a "DOS window").
  6686. 3. If necessary, set the HTTP_proxy variable. For example, you
  6687. might try a setting like this:
  6688. set HTTP_proxy=my.proxy.com:3128
  6689. 4. Start the PPM program:
  6690. C:\> C:\perl\bin\ppm.pl
  6691. 5. If you have not previously done so, install DBI:
  6692. ppm> install DBI
  6693. 6. If this succeeds, run the following command:
  6694. ppm> install DBD-mysql
  6695. This procedure should work with ActiveState Perl 5.6 or newer.
  6696. If you cannot get the procedure to work, you should install the
  6697. MyODBC driver instead and connect to the MySQL server through
  6698. ODBC:
  6699. use DBI;
  6700. $dbh= DBI->connect("DBI:ODBC:$dsn",$user,$password) ||
  6701. die "Got error $DBI::errstr when connecting to $dsn\n";
  6702. 2.15.3. Problems Using the Perl DBI/DBD Interface
  6703. If Perl reports that it cannot find the ../mysql/mysql.so module,
  6704. the problem is probably that Perl cannot locate the
  6705. libmysqlclient.so shared library. You should be able to fix this
  6706. problem by one of the following methods:
  6707. * Compile the DBD::mysql distribution with perl Makefile.PL
  6708. -static -config rather than perl Makefile.PL.
  6709. * Copy libmysqlclient.so to the directory where your other
  6710. shared libraries are located (probably /usr/lib or /lib).
  6711. * Modify the -L options used to compile DBD::mysql to reflect
  6712. the actual location of libmysqlclient.so.
  6713. * On Linux, you can add the path name of the directory where
  6714. libmysqlclient.so is located to the /etc/ld.so.conf file.
  6715. * Add the path name of the directory where libmysqlclient.so is
  6716. located to the LD_RUN_PATH environment variable. Some systems
  6717. use LD_LIBRARY_PATH instead.
  6718. Note that you may also need to modify the -L options if there are
  6719. other libraries that the linker fails to find. For example, if the
  6720. linker cannot find libc because it is in /lib and the link command
  6721. specifies -L/usr/lib, change the -L option to -L/lib or add -L/lib
  6722. to the existing link command.
  6723. If you get the following errors from DBD::mysql, you are probably
  6724. using gcc (or using an old binary compiled with gcc):
  6725. /usr/bin/perl: can't resolve symbol '__moddi3'
  6726. /usr/bin/perl: can't resolve symbol '__divdi3'
  6727. Add -L/usr/lib/gcc-lib/... -lgcc to the link command when the
  6728. mysql.so library gets built (check the output from make for
  6729. mysql.so when you compile the Perl client). The -L option should
  6730. specify the path name of the directory where libgcc.a is located
  6731. on your system.
  6732. Another cause of this problem may be that Perl and MySQL are not
  6733. both compiled with gcc. In this case, you can solve the mismatch
  6734. by compiling both with gcc.
  6735. You may see the following error from DBD::mysql when you run the
  6736. tests:
  6737. t/00base............install_driver(mysql) failed:
  6738. Can't load '../blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mys
  6739. ql:
  6740. ../blib/arch/auto/DBD/mysql/mysql.so: undefined symbol:
  6741. uncompress at /usr/lib/perl5/5.00503/i586-linux/DynaLoader.pm line 16
  6742. 9.
  6743. This means that you need to include the -lz compression library on
  6744. the link line. That can be done by changing the following line in
  6745. the file lib/DBD/mysql/Install.pm:
  6746. $sysliblist .= " -lm";
  6747. Change that line to:
  6748. $sysliblist .= " -lm -lz";
  6749. After this, you must run make realclean and then proceed with the
  6750. installation from the beginning.
  6751. If you want to install DBI on SCO, you have to edit the Makefile
  6752. in DBI-xxx and each subdirectory. Note that the following assumes
  6753. gcc 2.95.2 or newer:
  6754. OLD: NEW:
  6755. CC = cc CC = gcc
  6756. CCCDLFLAGS = -KPIC -W1,-Bexport CCCDLFLAGS = -fpic
  6757. CCDLFLAGS = -wl,-Bexport CCDLFLAGS =
  6758. LD = ld LD = gcc -G -fpic
  6759. LDDLFLAGS = -G -L/usr/local/lib LDDLFLAGS = -L/usr/local/lib
  6760. LDFLAGS = -belf -L/usr/local/lib LDFLAGS = -L/usr/local/lib
  6761. LD = ld LD = gcc -G -fpic
  6762. OPTIMISE = -Od OPTIMISE = -O1
  6763. OLD:
  6764. CCCFLAGS = -belf -dy -w0 -U M_XENIX -DPERL_SCO5 -I/usr/local/include
  6765. NEW:
  6766. CCFLAGS = -U M_XENIX -DPERL_SCO5 -I/usr/local/include
  6767. These changes are necessary because the Perl dynaloader does not
  6768. load the DBI modules if they were compiled with icc or cc.
  6769. If you want to use the Perl module on a system that does not
  6770. support dynamic linking (such as SCO), you can generate a static
  6771. version of Perl that includes DBI and DBD::mysql. The way this
  6772. works is that you generate a version of Perl with the DBI code
  6773. linked in and install it on top of your current Perl. Then you use
  6774. that to build a version of Perl that additionally has the DBD code
  6775. linked in, and install that.
  6776. On SCO, you must have the following environment variables set:
  6777. LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/usr/progressive/lib
  6778. Or:
  6779. LD_LIBRARY_PATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:\
  6780. /usr/progressive/lib:/usr/skunk/lib
  6781. LIBPATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:\
  6782. /usr/progressive/lib:/usr/skunk/lib
  6783. MANPATH=scohelp:/usr/man:/usr/local1/man:/usr/local/man:\
  6784. /usr/skunk/man:
  6785. First, create a Perl that includes a statically linked DBI module
  6786. by running these commands in the directory where your DBI
  6787. distribution is located:
  6788. shell> perl Makefile.PL -static -config
  6789. shell> make
  6790. shell> make install
  6791. shell> make perl
  6792. Then you must install the new Perl. The output of make perl
  6793. indicates the exact make command you need to execute to perform
  6794. the installation. On SCO, this is make -f Makefile.aperl inst_perl
  6795. MAP_TARGET=perl.
  6796. Next, use the just-created Perl to create another Perl that also
  6797. includes a statically linked DBD::mysql by running these commands
  6798. in the directory where your DBD::mysql distribution is located:
  6799. shell> perl Makefile.PL -static -config
  6800. shell> make
  6801. shell> make install
  6802. shell> make perl
  6803. Finally, you should install this new Perl. Again, the output of
  6804. make perl indicates the command to use.