O'Reilly logo

MySQL Reference Manual by Kaj Arno, David Axmark, Michael Widenius

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

General Installation Issues

How to Get MySQL

Check the MySQL homepage (http://www.mysql.com/) for information about the current version and for downloading instructions.

Our main download mirror is located at:

http://mirrors.sunsite.dk/mysql/

If you are interested in becoming a MySQL mirror site, you may anonymously rsync with: rsync://sunsite.dk/ftp/mirrors/mysql/. Please send email to notifying us of your mirror to be added to the following list.

If you have problems downloading from our main site, try using one of the following mirrors.

Please report bad or out-of-date mirrors to .

Europe:

  • Armenia [AbideWeb Technologies] @ WWW (http://mysql.abideweb.com/) FTP (ftp://mysql.abideweb.com/mirrors/MySQL/)

  • Austria [Univ. of Technology/Vienna] @ WWW (http://gd.tuwien.ac.at/db/mysql/) FTP (ftp://gd.tuwien.ac.at/db/mysql/)

  • Belgium [BELNET] @ WWW (http://mysql.belnet.be/) FTP (ftp://ftp.belnet.be/mirror/ftp.mysql.com/pub/mysql/)

  • Bulgaria [online.bg/Sofia] @ WWW (http://mysql.online.bg/) FTP (ftp://mysql.online.bg/)

  • Czech Republic [Masaryk University in Brno] @ WWW (http://mysql.linux.cz/) FTP (ftp://ftp.fi.muni.cz/pub/mysql/)

  • Czech Republic [www.gin.cz] @ WWW (http://mysql.gin.cz/) FTP (ftp://ftp.gin.cz/pub/MIRRORS/www.mysql.com/)

  • Czech Republic [www.sopik.cz] @ WWW (http://www.mysql.cz/)

  • Denmark [Borsen] @ WWW (http://mysql.borsen.dk/)

  • Denmark [SunSITE] @ WWW (http://mirrors.sunsite.dk/mysql/) FTP (ftp://sunsite.dk/mirrors/mysql/)

  • Estonia [OK Interactive] @ WWW (http://mysql.mirror.ok.ee/)

  • Finland [KPNQwest] @ WWW (http://mysql.kpnqwest.fi/)

  • Finland [tonnikala.net] @ WWW (http://mysql.tonnikala.org/)

  • France [free.fr] @ WWW (http://mysql-mirror.free.fr/) FTP (ftp://ftp.free.fr/pub/MySQL/)

  • France [Netsample] @ WWW (http://www.mysql.netsample.com/)

  • France [Omegatomic] @ WWW (http://mysql.omegatomic.com/)

  • Germany [GWDG] @ WWW (http://ftp.gwdg.de/pub/misc/mysql/) FTP (ftp://ftp.gwdg.de/pub/misc/mysql/)

  • Germany [SunSITE Central Europe] @ WWW (http://sunsite.informatik.rwth-aachen.de/mysql/) FTP (ftp://sunsite.informatik.rwth-aachen.de/pub/mirror/www.mysql.com/)

  • Germany [Tiscali] @ WWW (http://filepile.tiscali.de/mirror/mysql/) FTP (ftp://filepile.tiscali.de/mirror/mysql/)

  • Germany [Wolfenbuettel] @ WWW (http://www.fh-wolfenbuettel.de/ftp/pub/database/mysql/) FTP (ftp://ftp.fh-wolfenbuettel.de/pub/database/mysql/)

  • Greece [NTUA, Athens] @ WWW (http://www.ntua.gr/mysql/) FTP (ftp://ftp.ntua.gr/pub/databases/mysql/)

  • Hungary [stop.hu] @ WWW (http://mysql.mirror.stop.hu/)

  • Hungary [TiszaneT] @ WWW (http://mysql.tiszanet.hu/) FTP (ftp://mysql.tiszanet.hu/pub/mirrors/mysql/)

  • Hungary [Xenia] @ WWW (http://mysql.sote.hu/) FTP (ftp://xenia.sote.hu/pub/mirrors/www.mysql.com/)

  • Iceland [GM] @ WWW (http://mysql.gm.is/) FTP (ftp://ftp.gm.is/pub/mysql/)

  • Ireland [Esat Net] @ WWW (http://ftp.esat.net/mirrors/download.sourceforge.net/pub/mirrors/mysql/) FTP (ftp://ftp.esat.net/mirrors/download.sourceforge.net/pub/mirrors/mysql/)

  • Ireland [MD NMTB Media] @ WWW (http://mirrors.nmtbmedia.com/mysql/)

  • Italy [feelinglinux.com] @ WWW (http://mysql.feelinglinux.com/)

  • Italy [Teta Srl] @ WWW (http://www.teta.it/mysql/)

  • Italy [tzone.it] @ WWW (http://mysql.tzone.it/)

  • Latvia [linux.lv] @ FTP (ftp://ftp.linux.lv/pub/software/mysql/)

  • Netherlands [OMS-Net] @ WWW (http://mysql.oms-net.nl/)

  • Netherlands [ProServe] @ WWW (http://mysql.proserve.nl/)

  • Netherlands [WideXS BV] @ WWW (http://mysql.mirror.widexs.nl/) FTP (ftp://mirror.widexs.nl/pub/mysql/)

  • Norway [Brainpeddlers AS] @ WWW (http://mysql.brainpeddlers.com/)

  • Poland [ncservice.com/Gdansk] @ WWW (http://mysql.service.net.pl/)

  • Poland [SunSITE] @ WWW (http://sunsite.icm.edu.pl/mysql/) FTP (ftp://sunsite.icm.edu.pl/pub/unix/mysql/)

  • Portugal [Instituto Supertior Técnico] @ WWW (http://darkstar.ist.utl.pt/mysql/) FTP (ftp://darkstar.ist.utl.pt/pub/mysql/)

  • Portugal [Netc] @ WWW (http://ftp.netc.pt/pub/mysql/) FTP (ftp://ftp.netc.pt/pub/mysql/)

  • Portugal [Netvisão] @ WWW (http://mysql.netvisao.pt/) FTP (ftp://mirrors2.netvisao.pt/pub/mysql/)

  • Romania [roedu.net/Bucharest] @ FTP (ftp://ftp.roedu.net/pub/mirrors/ftp.mysql.com/)

  • Russia [DirectNet] @ WWW (http://mysql.directnet.ru/) FTP (ftp://ftp.dn.ru/pub/MySQL/)

  • Russia [Scientific Center/Chernogolovka] @ FTP (ftp://ftp.chg.ru/pub/databases/mysql/)

  • Slovenia [ARNES] @ WWW (http://ftp.arnes.si/mysql/) FTP (ftp://ftp.arnes.si/packages/mysql/)

  • Spain [GMC Control Systems] @ WWW (http://mysql.neptuno2000.com/) FTP (ftp://ftp.neptuno2000.com/pub/mysql/)

  • Sweden [Sunet] @ WWW (http://ftp.sunet.se/pub/unix/databases/relational/mysql/) FTP (ftp://ftp.sunet.se/pub/unix/databases/relational/mysql/)

  • Switzerland [SunSITE] @ WWW (http://sunsite.cnlab-switch.ch/ftp/mirror/mysql/) FTP (ftp://sunsite.cnlab-switch.ch/mirror/mysql/)

  • Turkey [proGEN] @ WWW (http://mysql.progen.com.tr/)

  • UK [PLiG/UK] @ WWW (http://ftp.plig.org/pub/mysql/) FTP (ftp://ftp.plig.org/pub/mysql/)

  • Ukraine [ISP Alkar Teleport/Dnepropetrovsk] @ WWW (http://mysql.dp.ua/) FTP (ftp://ftp.tlk-l.net/pub/mirrors/mysql.com/)

  • Ukraine [PACO] @ WWW (http://mysql.paco.net.ua/) FTP (ftp://mysql.paco.net.ua/)

  • Yugoslavia [open source Network of Yugoslavia] @ WWW (http://mysql.boa.org.yu/) FTP (ftp://ftp.linux.org.yu/pub/MySQL/)

North America:

  • Canada [Tryc] @ WWW (http://web.tryc.on.ca/mysql/)

  • Mexico [UAM] @ WWW (http://mysql.azc.uam.mx/) FTP (ftp://mysql.azc.uam.mx/mirrors/mysql/)

  • Mexico [UNAM] @ WWW (http://mysql.unam.mx/) FTP (ftp://mysql.unam.mx/pub/mysql/)

  • USA [adgrafix.com / Boston, MA] @ WWW (http://mysql.adgrafix.com/)

  • USA [Fast Mirror / Englewood, CO] @ WWW (http://mysql.fastmirror.com/)

  • USA [Hurricane Electric / San Jose, CA] @ WWW (http://mysql.he.net/)

  • USA [netNumina / Cambridge, MA] @ WWW (http://mysql.mirrors.netnumina.com/)

  • USA [NIXC / Vienna, VA] @ WWW (http://mysql.nixc.net/) FTP (ftp://mysql.nixc.net/pub/mysql/)

  • USA [Oregon State University / Corvallis, OR] @ WWW (http://mysql.orst.edu/) FTP (ftp://ftp.orst.edu/pub/mysql/)

  • USA [University of Wisconsin / Wisconsin] @ WWW (http://mirror.sit.wisc.edu/mysql/) FTP (ftp://mirror.sit.wisc.edu/mirrors/mysql/)

  • USA [UUNet] @ WWW (http://mysql.secsup.org/) FTP (ftp://mysql.secsup.org/pub/software/mysql/)

  • USA [ValueClick / Los Angeles, CA] @ WWW (http://mysql.valueclick.com/) FTP (ftp://mysql.valueclick.com/pub/mysql/)

South America:

  • Argentina [bannerlandia.com] @ WWW (http://mysql.bannerlandia.com.ar/) FTP (ftp://mysql.bannerlandia.com.ar/mirrors/mysql/)

  • Chile [PSINet] @ WWW (http://mysql.psinet.cl/) FTP (ftp://ftp.psinet.cl/pub/database/mysql/)

  • Chile [Tecnoera] @ WWW (http://mysql.tecnoera.com/)

  • Chile [Vision] @ WWW (http://mysql.vision.cl/)

  • Costa Rica [Ogmios Communications] @ WWW (http://mysql.ogmios.co.cr/) FTP (ftp://mysql.ogmios.co.cr/pub/mysql/)

Asia:

  • China [Gremlins/Hong Kong] @ WWW (http://mysql.gremlins.com.hk/) FTP (ftp://ftp.mirrors.gremlins.com.hk/mysql/)

  • China [HKLPG/Hong Kong] @ WWW (http://mysql.hklpg.org/)

  • China [linuxforum.net] @ FTP (http://www2.linuxforum.net/mirror/mysql/)

  • China [shellhung.org/Hong Kong] @ WWW (http://mysql.shellhung.org/) FTP (ftp://ftp.shellhung.org/pub/Mirror/mysql/)

  • Indonesia [CBN] @ WWW (http://mysql.cbn.net.id/)

  • Indonesia [incaf.net] @ WWW (http://mysql.incaf.net/) FTP (ftp://mysql.incaf.net/)

  • Indonesia [M-Web] @ WWW (http://mysql.mweb.net.id/)

  • Indonesia [web.id] @ WWW (http://mysql.itb.web.id/) FTP (ftp://mysql.itb.web.id/pub/MySQL/)

  • Japan [Soft Agency] @ WWW (http://www.softagency.co.jp/MySQL/)

  • Japan [u-aizu.ac.jp/Aizu] @ FTP (ftp://ftp.u-aizu.ac.jp/ftp/pub/dbms/mysql/mysql.com/)

  • Philippines [Ateneo de Zamboanga University] @ WWW (http://mysql.adzu.edu.ph/)

  • Singapore [HJC] @ WWW (http://mysql.hjc.edu.sg/) FTP (ftp://ftp.hjc.edu.sg/mysql/)

  • South Korea [HolyNet] @ WWW (http://mysql.holywar.net/)

  • South Korea [Webiiz] @ WWW (http://mysql.webiiz.com/)

  • Taiwan [nctu.edu/HsinChu] @ WWW (http://mysql.nctu.edu.tw/)

  • Taiwan [TTN] @ WWW (http://mysql.ttn.net/)

Australia:

  • Australia [planetmirror.com] @ WWW (http://mysql.planetmirror.com/) FTP (ftp://planetmirror.com/pub/mysql/)

Africa:

  • South African Republic [Mweb] @ WWW (http://www.mysql.mweb.co.za/)

  • South African Republic [The Internet Solution/Johannesburg] @ FTP (ftp://ftp.is.co.za/linux/mysql/)

Operating Systems Supported by MySQL

We use GNU Autoconf, so it is possible to port MySQL to all modern systems with working Posix threads and a C++ compiler. (To compile only the client code, a C++ compiler is required but not threads.) We use and develop the software ourselves primarily on Sun Solaris (Versions 2.5 - 2.7) and SuSE Linux Version 7.x.

Note that for many operating systems, the native thread support works only in the latest versions. MySQL has been reported to compile successfully on the following operating system/thread package combinations:

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

  • General stability of the thread library. A platform may have excellent reputation otherwise, but if the thread library is unstable in the code that is called by MySQL, even if everything else is perfect, MySQL will be only as stable as the thread library.

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

  • The ability of the kernel and/or the thread library to run many threads which acquire/release a mutex over a short critical region frequently without excessive context switches. In other words, if the implementation of pthread_mutex_lock( ) is too anxious to yield CPU time, this will hurt MySQL tremendously. If this issue is not taken care of, adding extra CPUs will actually make MySQL slower.

  • General filesystem stability/performance.

  • Ability of the filesystem to deal with large files at all and deal with them efficiently, if your tables are big.

  • Our level of expertise here at MySQL AB with the platform. If we know a platform well, we introduce platform-specific optimisations/fixes enabled at compile time. We can also provide advice on configuring your system optimally for MySQL.

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

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

Based on the preceding criteria, the best platforms for running MySQL at this point are x86 with SuSE Linux 7.1, 2.4 kernel, and ReiserFS (or any similar Linux distribution) and SPARC with Solaris 2.7 or 2.8. FreeBSD comes third, but we really hope it will join the top club once the thread library is improved. We also hope that at some point we will be able to include all other platforms on which MySQL compiles, runs okay, but not quite with the same level of stability and performance, into the top category. This will require some effort on our part in cooperation with the developers of the OS/library components MySQL depends upon. If you are interested in making one of those components better, are in a position to influence their development, and need more detailed instructions on what MySQL needs to run better, send an email to .

Please note that the preceding comparison is not to say that one OS is better or worse than the other in general. We are talking about choosing a particular OS for a dedicated purpose—running MySQL, and compare platforms in that regard only. With this in mind, the result of this comparison would be different if we included more issues into it. And in some cases, the reason one OS is better than the other could simply be that we have put forth more effort into testing on and optimising for that particular platform. We are just stating our observations to help you decide on which platform to use MySQL on in your setup.

Which MySQL Version to Use

The first decision to make is whether you want to use the latest development release or the last stable release:

  • Normally, if you are beginning to use MySQL for the first time or trying to port it to some system for which there is no binary distribution, we recommend going with the stable release (currently version 3.23). Note that all MySQL releases are checked with the MySQL benchmarks and an extensive test suite before each release (even the development releases).

  • Otherwise, if you are running an old system and want to upgrade, but don’t want to take chances with a non-seamless upgrade, you should upgrade to the latest in the same branch you are using (where only the last version number is newer than yours). We have tried to fix only fatal bugs and make small, relatively safe changes to that version.

The second decision to make is whether you want to use a source distribution or a binary distribution. In most cases you should probably use a binary distribution, if one exists for your platform, as this generally will be easier to install than a source distribution.

In the following cases you probably will be better off with a source installation:

  • If you want to install MySQL at some explicit location. (The standard binary distributions are “ready to run” at any place, but you may want to get even more flexibility).

  • To be able to satisfy different user requirements, we are providing two different binary versions: one compiled with the non-transactional table handlers (a small, fast binary), and one configured with the most important extended options like transaction-safe tables. Both versions are compiled from the same source distribution. All native MySQL clients can connect to both MySQL versions.

    The extended MySQL binary distribution is marked with the -max suffix and is configured with the same options as mysqld-max. See Section 4.7.5.

    If you want to use the MySQL-Max RPM, you must first install the standard MySQL RPM.

  • If you want to configure mysqld with some extra features that are not in the standard binary distributions. Here is a list of the most common extra options that you may want to use:

    • --with-innodb

    • --with-berkeley-db

    • --with-raid

    • --with-libwrap

    • --with-named-z-lib (This is done for some of the binaries)

    • --with-debug[=full]

  • The default binary distribution is normally compiled with support for all character sets and should work on a variety of processors from the same processor family.

    If you want a faster MySQL server you may want to recompile it with support for only the character sets you need, use a better compiler (like pgcc), or use compiler options that are better optimised for your processor.

  • If you have found a bug and reported it to the MySQL development team you will probably receive a patch that you need to apply to the source distribution to get the bug fixed.

  • If you want to read (and/or modify) the C and C++ code that makes up MySQL, you should get a source distribution. The source code is always the ultimate manual. Source distributions also contain more tests and examples than binary distributions.

The MySQL naming scheme uses release numbers that consist of three numbers and a suffix. For example, a release name like mysql-3.21.17-beta is interpreted like this:

  • The first number (3) describes the file format. All Version 3 releases have the same file format.

  • The second number (21) is the release level. Normally there are two to choose from. One is the release/stable branch (currently 23) and the other is the development branch (currently 4.0). Normally both are stable, but the development version may have quirks, may be missing documentation on new features, or may fail to compile on some systems.

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

  • The suffix (beta) indicates the stability level of the release. The possible suffixes are:

    • alpha indicates that the release contains some large section of new code that hasn’t been 100% tested. Known bugs (usually there are none) should be documented in the News section. See http://www.mysql.com/doc/N/e/News.html. There are also new commands and extensions in most alpha releases. Active development that may involve major code changes can occur on an alpha release, but everything will be tested before doing a release. There should be no known bugs in any MySQL release.

    • beta means that all new code has been tested. No major new features that could cause corruption on old code are added. There should be no known bugs. A version changes from alpha to beta when there haven’t been any reported fatal bugs within an alpha version for at least a month and we don’t plan to add any features that could make any old command more unreliable.

    • gamma is a beta that has been around a while and seems to work fine. Only minor fixes are added. This is what many other companies call a release.

    • If there is no suffix, it means that the version has been run for a while at many different sites with no reports of bugs other than platform-specific bugs. Only critical bug fixes are applied to the release. This is what we call a stable release.

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

Note that all releases have been tested at least with:

An internal test suite

This is part of a production system for a customer. It has many tables with hundreds of megabytes of data.

The MySQL benchmark suite

This runs a range of common queries. It is also a test to see whether the latest batch of optimisations actually made the code faster. See Section 5.1.4.

The crash-me test

This tries to determine what features the database supports and what its capabilities and limitations are. See Section 5.1.4.

Another test is that we use the newest MySQL version in our internal production environment, on at least one machine. We have more than 100 gigabytes of data to work with.

Installation Layouts

This section describes the default layout of the directories created by installing binary and source distributions.

A binary distribution is installed by unpacking it at the installation location you choose (typically /usr/local/mysql) and creates the following directories in that location:

Directory

Contents of directory

bin

Client programs and the mysqld server

data

Log files, databases

include

Include (header) files

lib

Libraries

scripts

mysql_install_db

share/mysql

Error message files

sql-bench

Benchmarks

A source distribution is installed after you configure and compile it. By default, the installation step installs files under /usr/local, in the following subdirectories:

Directory

Contents of directory

bin

Client programs and scripts

include/mysql

Include (header) files

info

Documentation in Info format

lib/mysql

Libraries

libexec

The mysqld server

share/mysql

Error message files

sql-bench

Benchmarks and crash-me test

var

Databases and log files

Within an installation directory, the layout of a source installation differs from that of a binary installation in the following ways:

  • The mysqld server is installed in the libexec directory rather than in the bin directory.

  • The data directory is var rather than data.

  • mysql_install_db is installed in the /usr/local/bin directory rather than in /usr/local/mysql/scripts.

  • The header file and library directories are include/mysql and lib/mysql rather than include and lib.

You can create your own binary installation from a compiled source distribution by executing the script scripts/make_binary_distribution.

How and When Updates Are Released

MySQL is evolving quite rapidly here at MySQL AB and we want to share this with other MySQL users. We try to make a release when we have very useful features that others seem to have a need for.

We also try to help out users who request features that are easy to implement. We take note of what our licensed users want to have, and we especially take note of what our extended email supported customers want and try to help them out.

No one has to download a new release. The News section will tell you if the new release has something you really want. See http://www.mysql.com/doc/N/e/News.html.

We use the following policy when updating MySQL:

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

  • Stable-tested releases are meant to appear about 1-2 times a year, but if small bugs are found, a release with only bug fixes will be released.

  • Working releases/bug fixes to old releases are meant to appear about every 1-8 weeks.

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

  • We usually make patches available as soon as we have located and fixed small bugs. They are posted to and will be added to the next release.

  • For non-critical but annoying bugs, we will add them the MySQL source repository and they will be fixed in the next release.

  • If there is, by any chance, a fatal bug in a release we will make a new release as soon as possible. We would like other companies to do this, too.

The current stable release is Version 3.23; we have already moved active development to Version 4.0. Bugs will still be fixed in the stable version. We don’t believe in a complete freeze, as this also leaves out bug fixes and things that “must be done.” “Somewhat frozen” means that we may add small things that “almost surely will not affect anything that’s already working.”

MySQL uses a slightly different naming scheme from most other products. In general it’s relatively safe to use any version that has been out for a couple of weeks without being replaced with a new version. See Section 2.2.3.

MySQL Binaries Compiled by MySQL AB

As a service, we at MySQL AB provide a set of binary distributions of MySQL that are compiled at our site or at sites where customers kindly have given us access to their machines.

These distributions are generated with scripts/make_binary_distribution and are configured with the following compilers and options:

SunOS 4.1.4 2 sun4c with gcc 2.7.2.1

CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors" ./configure --prefix=/usr/local/mysql --disable-shared --with-extra-charsets=complex --enable-assembler

SunOS 5.5.1 (and above) sun4u with egcs 1.0.3a or 2.90.27 or gcc 2.95.2 and newer

CC=gcc CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-low-memory --with-extra-charsets=complex --enable-assembler

SunOS 5.6 i86pc with gcc 2.8.1

CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-low-memory --with-extra-charsets=complex

Solaris 2.8 sparc with gcc 2.95.3

CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql "--with-comment=Official MySQL binary" --with-extra-charsets=complex "--with-server-suffix=" --enable-thread-safe-client --enable-local-infile --enable-assembler --disable-shared

Linux 2.0.33 i386 with pgcc 2.90.29 (egcs 1.0.3a)

CFLAGS="-O3 -mpentium -mstack-align-double" CXX=gcc CXXFLAGS="-O3 -mpentium -mstack-align-double -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --with-extra-charsets=complex

Linux 2.2.x with x686 with gcc 2.95.2

CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charset=complex

SCO 3.2v5.0.4 i386 with gcc 2.7-95q4

CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex

AIX 2 4 with gcc 2.7.2.2

CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex

OSF/1 V4.0 564 alpha with gcc 2.8.1

CC=gcc CFLAGS=-O CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-low-memory --with-extra-charsets=complex

Irix 6.3 IP32 with gcc 2.8.0

CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex

BSDI BSD/OS 3.1 i386 with gcc 2.7.2.1

CC=gcc CXX=gcc CXXFLAGS=-O ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex

BSDI BSD/OS 2.1 i386 with gcc 2.7.2

CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex

Anyone who has more optimal options for any of the preceding configurations listed can always mail them to the developer’s mailing list at .

RPM distributions prior to MySQL Version 3.22 are user-contributed. Beginning with Version 3.22, the RPMs are generated by us at MySQL AB.

If you want to compile a debug version of MySQL, you should add --with-debug or --with-debug=full to the preceding configure lines and remove any -fomit-frame-pointer options.

For the Windows distribution, please see Section 2.1.2.

Installing a MySQL Binary Distribution

See also Section 2.1.2.1, see Section 2.1.1, and Section 8.4.7.

You need the following tools to install a MySQL binary distribution:

  • GNU gunzip to uncompress the distribution.

  • A reasonable tar to unpack the distribution. GNU tar is known to work. Sun tar is known to have problems.

An alternative installation method under Linux is to use RPM (RedHat Package Manager) distributions. See Section 2.1.1.

If you run into problems, please always use mysqlbug when posting questions to . Even if the problem isn’t a bug, mysqlbug gathers system information that will help others solve your problem. By not using mysqlbug, you lessen the likelihood of getting a solution to your problem! You will find mysqlbug in the bin directory after you unpack the distribution. See Section 1.6.2.3.

The basic commands you must execute to install and use a MySQL binary distribution are:

shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> scripts/mysql_install_db
shell> chown -R root  .
shell> chown -R mysql data
shell> chgrp -R mysql .
shell> bin/safe_mysqld --user=mysql &
or
shell> bin/mysqld_safe --user=mysql &
if you are running MySQL 4.x

You can add new users using the bin/mysql_setpermission script if you install the DBI and Msql-Mysql-modules Perl modules.

A more detailed description follows.

To install a binary distribution, follow these steps, then proceed to Section 2.4, for post-installation setup and testing:

  1. Pick the directory under which you want to unpack the distribution, and move into it. In the following example, we unpack the distribution under /usr/local and create a directory /usr/local/mysql into which MySQL is installed. (The following instructions, therefore, assume you have permission to create files in /usr/local. If that directory is protected, you will need to perform the installation as root.)

  2. Obtain a distribution file from one of the sites listed in Section 2.2.1.

    MySQL binary distributions are provided as compressed tar archives and have names like mysql-VERSION-OS.tar.gz, where VERSION is a number (for example, 3.21.15), and OS indicates the type of operating system for which the distribution is intended (for example, pc-linux-gnu-i586).

  3. If you see a binary distribution marked with the -max prefix, this means that the binary has support for transaction-safe tables and other features. See Section 4.7.5. Note that all binaries are built from the same MySQL source distribution.

  4. Add a user and group for mysqld to run as:

    shell> groupadd mysql
    shell> useradd -g mysql mysql

    These commands add the mysql group and the mysql user. The syntax for useradd and groupadd may differ slightly on different versions of Unix. They may also be called adduser and addgroup. You may wish to call the user and group something else instead of mysql.

  5. Change into the intended installation directory:

    shell> cd /usr/local
  6. Unpack the distribution and create the installation directory:

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

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

  7. Change into the installation directory:

    shell> cd mysql

    You will find several files and subdirectories in the mysql directory. The most important for installation purposes are the bin and scripts subdirectories.

    bin

    This directory contains client programs and the server You should add the full pathname of this directory to your PATH environment variable so that your shell finds the MySQL programs properly. See Appendix E.

    scripts

    This directory contains the mysql_install_db script used to initialise the mysql database containing the grant tables that store the server access permissions.

  8. If you would like to use mysqlaccess and have the MySQL distribution in some non-standard place, you must change the location where mysqlaccess expects to find the mysql client. Edit the bin/mysqlaccess script at approximately line 18. Search for a line that looks like this:

    $MYSQL     = '/usr/local/bin/mysql';    # path to mysql executable

    Change the path to reflect the location where mysql actually is stored on your system. If you do not do this, you will get a Broken pipe error when you run mysqlaccess.

  9. Create the MySQL grant tables (necessary only if you haven’t installed MySQL before):

    shell> scripts/mysql_install_db

    Note that MySQL versions older than Version 3.22.10 started the MySQL server when you run mysql_install_db. This is no longer true!

  10. Change ownership of binaries to root and ownership of the data directory to the user that you will run mysqld as:

    shell> chown -R root  /usr/local/mysql/.
    shell> chown -R mysql /usr/local/mysql/data
    shell> chgrp -R mysql /usr/local/mysql/.

    The first command changes the owner attribute of the files to the root user, the second one changes the owner attribute of the data directory to the mysql user, and the third one changes the group attribute to the mysql group.

  11. If you want to install support for the Perl DBI/DBD interface, see Section 2.7.

  12. If you would like MySQL to start automatically when you boot your machine, you can copy support-files/mysql.server to the location where your system has its startup files. More information can be found in the support-files/mysql.server script itself and in Section 2.4.3.

After everything has been unpacked and installed, you should initialise and test your distribution.

You can start the MySQL server with the following command:

shell> bin/safe_mysqld --user=mysql &

Now proceed to Section 4.7.2, and Section 2.4.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required