You need the following tools to build and install MySQL from source:
- 
GNU gunzipto uncompress the distribution.
- 
A reasonable tarto unpack the distribution. GNUtaris
known to work.
- 
A working ANSI C++ compiler. gcc>= 2.8.1,egcs>=
1.0.2, SGI C++ and SunPro C++ are some of the compilers that are known to
work.libg++is not needed when usinggcc.gcc2.7.x has a bug that makes it impossible to compile some perfectly legal
C++ files, such as `sql/sql_base.cc'. If you only havegcc2.7.x,
you must upgrade yourgccto be able to compile MySQL.
- 
A good makeprogram.  GNUmakeis always recommended and is
sometimes required.  If you have problems, we recommend trying GNUmake3.75 or newer.
If you run into problems, PLEASE ALWAYS USE mysqlbug when
posting questions to mysql@lists.mysql.com.  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
`scripts' directory after you unpack the distribution.    2.3  Comment rapporter des bugs et des problèmes.
The basic commands you must execute to install a MySQL source
distribution are (from an unpacked tar file):
shell> configure
shell> make
shell> make install
shell> scripts/mysql_install_db
shell> /usr/local/mysql/bin/safe_mysqld &
If you start from a source RPM, then do the following.
shell> rpm --rebuild MySQL-VERSION.src.rpm
This will make a binary RPM that you can install.
You can add new users using the bin/mysql_setpermission script if
you install the DBI and Msql-Mysql-modules Perl modules.
Here follows a more detailed description:
To install a source distribution, follow the steps below, then proceed
to  4.15  Paramètrage post-installation et tests, for post-installation initialization and testing.
- 
Pick the directory under which you want to unpack the distribution, and move
into it.
- 
Obtain a distribution file from one of the sites listed in
 Getting MySQL.
MySQL source distributions are provided as compressed tararchives and have names like `mysql-VERSION.tar.gz', whereVERSIONis a number like 3.23.5-alpha.
- 
Unpack the distribution into the current directory:
shell> gunzip < mysql-VERSION.tar.gz | tar xvf -
 This command creates a directory named `mysql-VERSION'.
- 
Change into the top-level directory of the unpacked distribution:
shell> cd mysql-VERSION
 
- 
Configure the release and compile everything:
shell> ./configure --prefix=/usr/local/mysql
shell> make
 When you runconfigure, you might want to specify some options.
Run./configure --helpfor a list of options.configureoptions, discusses some of the
more useful options.
Ifconfigurefails, and you are going to send mail to
lines from `config.log' that you think can help solve the problem.  Also
include the last couple of lines of output fromconfigureifconfigureaborts. Post the bug report using themysqlbugscript.    2.3  Comment rapporter des bugs et des problèmes.
If the compile fails, see  4.8  Problèmes de compilation?, for help with
a number of common problems.
- 
Install everything:
shell> make install
 You might need to run this command asroot.
- 
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 3.22.10 started the
MySQL server when you runmysql_install_db.  This is no
longer true!
- 
If you want to install support for the Perl DBI/DBDinterface,
see  4.10  Remarques sur l'installation Perl.
- 
If you would like MySQL to start automatically when you boot your
machine, you can copy support-files/mysql.serverto the location where
your system has its startup files. More information can be found in thesupport-files/mysql.serverscript itself, and in  4.15.3  Démarrer et arrête MySQL automatiquement.
After everything has been installed, you should initialize and test your
distribution.
You can start the MySQL server with the following command,
where BINDIR is the directory in which safe_mysqld is
installed (`/usr/local/bin' by default):
shell> BINDIR/safe_mysqld &
If that command fails immediately with mysqld daemon ended then you can
find some information in the file
`mysql-data-directory/'hostname'.err'.  The likely reason is that
you already have another mysqld server running.    19.3  Faire tourner plusieurs serveurs MySQL sur la même machine.
  4.15  Paramètrage post-installation et tests.
Sometimes patches appear on the mailing list or are placed in the
patches area of the
MySQL FTP site.
To apply a patch from the mailing list, save the message in which the patch
appears in a file, change into the top-level directory of your MySQL
source tree and run these commands:
shell> patch -p1 < patch-file-name
shell> rm config.cache
shell> make clean
Patches from the FTP site are distributed as plain text files or as files
compressed with gzip files.  Apply a plain patch as shown above for
mailing list patches.  To apply a compressed patch, change into the
top-level directory of your MySQL source tree and run these
commands:
shell> gunzip < patch-file-name.gz | patch -p1
shell> rm config.cache
shell> make clean
After applying a patch, follow the instructions for a normal source install,
beginning with the ./configure step.  After running the make
install step, restart your MySQL server.
You may need to bring down any currently running server before you run
make install.  (Use mysqladmin shutdown to do this.)  Some
systems do not allow you to install a new version of a program if it replaces
the version that is currently executing.
The configure script gives you a great deal of control over how you
configure your MySQL distribution.  Typically you do this using
options on the configure command line.  You can also affect
configure using certain environment variables.  For a list of options
supported by configure, run this command:
shell> ./configure --help
Some of the more commonly-used configure options are described below:
- 
To compile just the MySQL client libraries and client programs and
not the server, use the --without-serveroption:
shell> ./configure --without-server
 If you don't have a C++ compiler,mysqlwill not compile (it is the
one client program that requires C++).  In this case,
you can remove the code inconfigurethat tests for the C++ compiler
and then run./configurewith the--without-serveroption. The
compile step will still try to buildmysql, but you can ignore any
warnings about `mysql.cc'.  (Ifmakestops, trymake -kto tell it to continue with the rest of the build even if errors occur.)
- 
If you don't want your log files and database directories located under
`/usr/local/var', use a configurecommand something like one
of these:
shell> ./configure --prefix=/usr/local/mysql
shell> ./configure --prefix=/usr/local \
           --localstatedir=/usr/local/mysql/data
The first command changes the installation prefix so that everything is
installed under `/usr/local/mysql' rather than the default of
`/usr/local'.  The second command preserves the default installation
prefix, but overrides the default location for database directories
(normally `/usr/local/var') and changes it to/usr/local/mysql/data.
- 
If you are using Unix and you want the MySQL socket located somewhere
other than the default location (normally in the directory `/tmp' or
`/var/run', use a configurecommand like this:
shell> ./configure --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
 Note that the given file must be an absolute pathname!
- 
If you want to compile statically-linked programs (e.g., to make a binary
distribution, to get more speed or to work around problems with some RedHat
distributions), run configurelike this:
shell> ./configure --with-client-ldflags=-all-static \
           --with-mysqld-ldflags=-all-static
- 
If you are using gccand don't havelibg++orlibstdc++installed, you can tellconfigureto usegccas your C++
compiler:
shell> CC=gcc CXX=gcc ./configure
 When you usegccas your C++ compiler, it will not attempt to link inlibg++orlibstdc++.
If the build fails and produces errors about your compiler or linker not
being able to create the shared library `libmysqlclient.so.#' (`#'
is a version number), you can work around this problem by giving the--disable-sharedoption toconfigure.  In this case,configurewill not build a sharedlibmysqlclient.so.#library.
- 
You can configure MySQL not to use DEFAULTcolumn values for
non-NULLcolumns (i.e., columns that are not allowed to beNULL).  This causesINSERTstatements to generate an error
unless you explicitly specify values for all columns that require a
non-NULLvalue.  To suppress use of default values, runconfigurelike this:
shell> CXXFLAGS=-DDONT_USE_DEFAULT_FIELDS ./configure
 
- 
By default, MySQL uses the ISO-8859-1 (Latin1) character set. To
change the default set, use the --with-charsetoption:
shell> ./configure --with-charset=CHARSET
 CHARSETmay be one ofbig5,cp1251,cp1257,czech,danish,dec8,dos,euc_kr,german1,hebrew,hp8,hungarian,koi8_ru,koi8_ukr,latin1,latin2,sjis,swe7,tis620,ujis,usa7,win1251orwin1251ukr.
    9.1.1  Le jeu de caractère utilisé pour le tri des données.
Note that if you want to change the character set, you must do amake
distcleanbetween configurations!
If you want to convert characters between the server and the client,
you should take a look at theSET OPTION CHARACTER SETcommand.SET OPTION.
Warning: If you change character sets after having created any
tables, you will have to runisamchk -r -qon every
table. Your indexes may be sorted incorrectly otherwise.
(This can happen if you install MySQL, create some tables,
then reconfigure MySQL to use a different character set and
reinstall it.)
- 
To configure
MySQL with debugging code, use the --with-debugoption:
shell> ./configure --with-debug
 This causes a safe memory allocator to be included that can find some errors
and that provides output about what is happening.
  G.1  Debugguer un serveur MySQL.
- 
Options that pertain to particular systems can be found in the
system-specific sections later in this chapter.
  4.11  Quelques spécificités liées aux OS.