Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-testing > by-pkgid > 91128064e1b251eab84e1c0e3ea0dd7a > files > 79

lib64mysql-devel-5.0.51a-8mdv2008.1.x86_64.rpm

2.4.15 MySQL Installation Using a Source Distribution
-----------------------------------------------------

* Menu:

* quick-install::                Source Installation Overview
* configure-options::            Typical `configure' Options
* installing-source-tree::       Installing from the Development Source Tree
* compilation-problems::         Dealing with Problems Compiling MySQL
* mit-pthreads::                 MIT-pthreads Notes
* windows-source-build::         Installing MySQL from Source on Windows
* windows-client-compiling::     Compiling MySQL Clients on Windows

This section does not apply to MySQL Enterprise Server users.

Before you proceed with an installation from source, first check
whether our binary is available for your platform and whether it works
for you. We put a great deal of effort into ensuring that our binaries
are built with the best possible options.

To obtain a source distribution for MySQL, *Note getting-mysql::. If
you want to build MySQL from source on Windows, see *Note
windows-source-build::.

MySQL source distributions are provided as compressed `tar' archives
and have names of the form `mysql-VERSION.tar.gz', where VERSION is a
number like `5.0.56'.

You need the following tools to build and install MySQL from source:

   * GNU `gunzip' to uncompress the distribution.

   * A reasonable `tar' to unpack the distribution. GNU `tar' is known
     to work.  Some operating systems come with a preinstalled version
     of `tar' that is known to have problems. For example, the `tar'
     provided with early versions of Mac OS X `tar', SunOS 4.x and
     Solaris 8 and earlier are known to have problems with long
     filenames. On Mac OS X, you can use the preinstalled `gnutar'
     program. On other systems with a deficient `tar', you should
     install GNU `tar' first.

   * A working ANSI C++ compiler. `gcc' 2.95.2 or later, SGI C++, and
     SunPro C++ are some of the compilers that are known to work.
     `libg++' is not needed when using `gcc'. `gcc' 2.7.x has a bug
     that makes it impossible to compile some perfectly legal C++
     files, such as `sql/sql_base.cc'. If you have only `gcc' 2.7.x,
     you must upgrade your `gcc' to be able to compile MySQL.  `gcc'
     2.8.1 is also known to have problems on some platforms, so it
     should be avoided if a newer compiler exists for the platform.
     `gcc' 2.95.2 or later is recommended.

   * A good `make' program. GNU `make' is always recommended and is
     sometimes required. (BSD `make' fails, and vendor-provided `make'
     implementations may fail as well.) If you have problems, we
     recommend GNU `make' 3.75 or newer.

   * `libtool' 1.5.24 or later is also recommended.

If you are using a version of `gcc' recent enough to understand the
`-fno-exceptions' option, it is _very important_ that you use this
option.  Otherwise, you may compile a binary that crashes randomly. We
also recommend that you use `-felide-constructors' and `-fno-rtti'
along with `-fno-exceptions'. When in doubt, do the following:

     CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
            -fno-exceptions -fno-rtti" ./configure \
            --prefix=/usr/local/mysql --enable-assembler \
            --with-mysqld-ldflags=-all-static

On most systems, this gives you a fast and stable binary.

If you run into problems and need to file a bug report, please use the
instructions in *Note bug-reports::.

File: manual.info,  Node: quick-install,  Next: configure-options,  Prev: installing-source,  Up: installing-source

2.4.15.1 Source Installation Overview
.....................................

This section does not apply to MySQL Enterprise Server users.

The basic commands that you must execute to install a MySQL source
distribution are:

     shell> groupadd mysql
     shell> useradd -g mysql mysql
     shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
     shell> cd mysql-VERSION
     shell> ./configure --prefix=/usr/local/mysql
     shell> make
     shell> make install
     shell> cp support-files/my-medium.cnf /etc/my.cnf
     shell> cd /usr/local/mysql
     shell> chown -R mysql .
     shell> chgrp -R mysql .
     shell> bin/mysql_install_db --user=mysql
     shell> chown -R root .
     shell> chown -R mysql var
     shell> bin/mysqld_safe --user=mysql &

If you start from a source RPM, do the following:

     shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm

This makes a binary RPM that you can install. For older versions of
RPM, you may have to replace the command `rpmbuild' with `rpm' instead.

*Note*:

This procedure does not set up any passwords for MySQL accounts. After
following the procedure, proceed to *Note post-installation::, for
post-installation setup and testing.

A more detailed version of the preceding description for installing
MySQL from a source distribution follows:

  1. Add a login 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, or they may have different names such
     as `adduser' and `addgroup'.

     You might want to call the user and group something else instead
     of `mysql'. If so, substitute the appropriate name in the
     following steps.

  2. Perform the following steps as the `mysql' user, except as noted.

  3. Pick the directory under which you want to unpack the distribution
     and change location into it.

  4. Obtain a distribution file using the instructions in *Note
     getting-mysql::.

  5. Unpack the distribution into the current directory:

          shell> gunzip < /PATH/TO/MYSQL-VERSION.tar.gz | tar xvf -

     This command creates a directory named `mysql-VERSION'.

     With GNU `tar', no separate invocation of `gunzip' is necessary.
     You can use the following alternative command to uncompress and
     extract the distribution:

          shell> tar zxvf /PATH/TO/MYSQL-VERSION-OS.tar.gz

  6. Change location into the top-level directory of the unpacked
     distribution:

          shell> cd mysql-VERSION

     Note that currently you must configure and build MySQL from this
     top-level directory. You cannot build it in a different directory.

  7. Configure the release and compile everything:

          shell> ./configure --prefix=/usr/local/mysql
          shell> make

     When you run `configure', you might want to specify other options.
     Run `./configure --help' for a list of options.  *Note
     configure-options::, discusses some of the more useful options.

     If `configure' fails and you are going to send mail to a MySQL
     mailing list to ask for assistance, please include any lines from
     `config.log' that you think can help solve the problem. Also
     include the last couple of lines of output from `configure'. To
     file a bug report, please use the instructions in *Note
     bug-reports::.

     If the compile fails, see *Note compilation-problems::, for help.

  8. Install the distribution:

          shell> make install

     You might need to run this command as `root'.

     If you want to set up an option file, use one of those present in
     the `support-files' directory as a template. For example:

          shell> cp support-files/my-medium.cnf /etc/my.cnf

     You might need to run this command as `root'.

     If you want to configure support for `InnoDB' tables, you should
     edit the `/etc/my.cnf' file, remove the `#' character before the
     option lines that start with `innodb_...', and modify the option
     values to be what you want. See *Note option-files::, and *Note
     innodb-configuration::.

  9. Change location into the installation directory:

          shell> cd /usr/local/mysql

 10. If you ran the `make install' command as `root', the installed
     files will be owned by `root'. Ensure that the installation is
     accessible to `mysql' by executing the following commands as
     `root' in the installation directory:

          shell> chown -R mysql .
          shell> chgrp -R mysql .

     The first command changes the owner attribute of the files to the
     `mysql' user. The second changes the group attribute to the
     `mysql' group.

 11. If you have not installed MySQL before, you must create the MySQL
     data directory and initialize the grant tables:

          shell> bin/mysql_install_db --user=mysql

     If you run the command as `root', include the `--user' option as
     shown. If you run the command while logged in as `mysql', you can
     omit the `--user' option.

     The command should create the data directory and its contents with
     `mysql' as the owner.

     After using `mysql_install_db' to create the grant tables for
     MySQL, you must restart the server manually. The `mysqld_safe'
     command to do this is shown in a later step.

 12. Most of the MySQL installation can be owned by `root' if you like.
     The exception is that the data directory must be owned by `mysql'.
     To accomplish this, run the following commands as `root' in the
     installation directory:

          shell> chown -R root .
          shell> chown -R mysql var

 13. If you want 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; see also
     *Note automatic-start::.

 14. You can set up new accounts using the `bin/mysql_setpermission'
     script if you install the `DBI' and `DBD::mysql' Perl modules. See
     *Note mysql-setpermission::. For Perl module installation
     instructions, see *Note perl-support::.

After everything has been installed, you should test your distribution.
To start the MySQL server, use the following command:

     shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &

If you run the command as `root', you should use the `--user' option as
shown. The value of the option is the name of the login account that
you created in the first step to use for running the server. If you run
the command while logged in as that user, you can omit the `--user'
option.

If the command fails immediately and prints `mysqld ended', you can
find some information in the `HOST_NAME.err' file in the data directory.

More information about `mysqld_safe' is given in *Note mysqld-safe::.

*Note*:

The accounts that are listed in the MySQL grant tables initially have
no passwords. After starting the server, you should set up passwords
for them using the instructions in *Note post-installation::.

File: manual.info,  Node: configure-options,  Next: installing-source-tree,  Prev: quick-install,  Up: installing-source

2.4.15.2 Typical `configure' Options
....................................

This section does not apply to MySQL Enterprise Server users.

The `configure' script gives you a great deal of control over how you
configure a MySQL source distribution.  Typically you do this using
options on the `configure' command line. You can also affect
`configure' using certain environment variables. See *Note
environment-variables::. For a full list of options supported by
`configure', run this command:

     shell> ./configure --help

A list of the available `configure' options is provided in the table
below.

*Build (`configure') Reference*

*Formats*              *Description*          *Default*      *Introduced**Removed*
-bindir=DIR            User executables       EPREFIX/bin            
-build=BUILD           Configure for          guessed                
                       building on BUILD                             
-cache-file=FILE       Cache test results in  disabled               
                       FILE                                          
-C                     Alias for                                     
                       `-cache-file=config.cache'                       
-config-cache                                                        
-datadir=DIR           Read-only              PREFIX/share           
                       architecture-independent                       
                       data                                          
-disable-FEATURE       Do not include FEATURE                        
-disable-dependency-trackingDisable dependency                            
                       tracking                                      
-disable-grant-options Disable GRANT options                 5.0.34  
-disable-largefile     Omit support for                              
                       large files                                   
-disable-libtool-lock  Disable libtool lock                          
-disable-profiling     Build a version                       5.0.37  5.0.45
                       without query                                 
                       profiling code                                
-enable-FEATURE        Enable FEATURE                                
-enable-assembler      Use assembler                                 
                       versions of some                              
                       string functions if                           
                       available                                     
-enable-dependency-trackingDo not reject slow                            
                       dependency extractors                         
-enable-fast-install   Optimize for fast      yes                    
                       installation                                  
-enable-local-infile   Enable LOAD DATA       disabled               
                       LOCAL INFILE                                  
-enable-shared         Build shared libraries yes                    
-enable-static         Build static libraries yes                    
-enable-thread-safe-clientCompile the client                            
                       with threads                                  
-exec-prefix=EPREFIX   Install                                       
                       architecture-dependent                        
                       files in EPREFIX                              
-h                     Display this help and                         
                       exit                                          
-help                                                                
-help=short            Display options                               
                       specific to this                              
                       package                                       
-help=recursive        Display the short                             
                       help of all the                               
                       included packages                             
-host=HOST             Cross-compile to                              
                       build programs to run                         
                       on HOST                                       
-includedir=DIR        C header files         PREFIX/include         
-infodir=DIR           Info documentation     PREFIX/info            
-libdir=DIR            Object code libraries  EPREFIX/lib            
-libexecdir=DIR        Program executables    EPREFIX/libexec        
-localstatedir=DIR     Modifiable             PREFIX/var             
                       single-machine data                           
-mandir=DIR            man documentation      PREFIX/man             
-n                     Do not create output                          
                       files                                         
-no-create                                                           
-oldincludedir=DIR     C header files for     /usr/include           
                       non-gcc                                       
-prefix=PREFIX         Install                                       
                       architecture-independent                       
                       files in PREFIX                               
-program-prefix=PREFIX Prepend PREFIX to                             
                       installed program                             
                       names                                         
-program-suffix=SUFFIX Append SUFFIX to                              
                       installed program                             
                       names                                         
-program-transform-name=PROGRAMrun sed PROGRAM on                            
                       installed program                             
                       names                                         
-q                     Do not print                                  
                       `checking...' messages                        
-quiet                                                               
-sbindir=DIR           System admin           EPREFIX/sbin           
                       executables                                   
-sharedstatedir=DIR    Modifiable             PREFIX/com             
                       architecture-independent                       
                       data                                          
-srcdir=DIR            Find the sources in    configure              
                       DIR                    directory or           
                                              ..                     
-sysconfdir=DIR        Read-only              PREFIX/etc             
                       single-machine data                           
-target=TARGET         Configure for                                 
                       building compilers                            
                       for TARGET                                    
-V                     Display version                               
                       information and exit                          
-version                                                             
-with-PACKAGE          Use PACKAGE                                   
-with-archive-storage-engineEnable the Archive     no                     
                       Storage Engine                                
-with-berkeley-db      Use BerkeleyDB         no                     
                       located in DIR                                
-with-berkeley-db-includesFind Berkeley DB                              
                       headers in DIR                                
-with-berkeley-db-libs Find Berkeley DB                              
                       libraries in DIR                              
-with-big-tables       Support tables with                   5.0.4   
                       more than 4 G rows                            
                       even on 32 bit                                
                       platforms                                     
-with-blackhole-storage-engineEnable the Blackhole   no             5.0.4   
                       Storage Engine                                
-with-charset          Default character set                         
-with-client-ldflags   Extra linking                                 
                       arguments for clients                         
-with-collation        Default collation                             
-with-comment          Comment about                                 
                       compilation                                   
                       environment                                   
-with-csv-storage-engineEnable the CSV         yes                    
                       Storage Engine                                
-with-darwin-mwcc      Use Metrowerks                        5.0.6   
                       CodeWarrior wrappers                          
                       on OS X/Darwin                                
-with-embedded-privilege-controlBuild parts to check                          
                       user's privileges                             
                       (only affects                                 
                       embedded library)                             
-with-embedded-server  Build the embedded                            
                       server                                        
-with-example-storage-engineEnable the Example     no                     
                       Storage Engine                                
-with-extra-charsets   Use charsets in                               
                       addition to default                           
-with-gnu-ld           Assume the C compiler  no                     
                       uses GNU ld                                   
-with-isam             Enable the ISAM table                         
                       type                                          
-with-lib-ccflags      Extra CC options for                          
                       libraries                                     
-with-libwrap=DIR      Compile in libwrap                            
                       (tcp_wrappers) support                        
-with-low-memory       Try to use less                               
                       memory to compile to                          
                       avoid memory                                  
                       limitations                                   
-with-machine-type     Set the machine type,                 5.0.44  
                       like "powerpc"                                
-with-max-indexes=N    Sets the maximum       64                     
                       number of indexes per                         
                       table                                         
-with-mit-threads      Always use included                           
                       thread lib                                    
-with-mysqld-ldflags   Extra linking                                 
                       arguments for mysqld                          
-with-mysqld-libs      Extra libraries to                    5.0.44  
                       link with for mysqld                          
-with-mysqld-user      What user the mysqld                          
                       daemon shall be run as                        
-with-mysqlfs          Include the                                   
                       corba-based MySQL                             
                       file system                                   
-with-mysqlmanager     Build the              Build if               
                       mysqlmanager binary    server is              
                                              built                  
-with-named-curses-libsUse specified curses                          
                       libraries                                     
-with-named-thread-libsUse specified thread                          
                       libraries                                     
-with-ndb-ccflags      Extra CC options for                  5.0.3   
                       ndb compile                                   
-with-ndb-docs         Include the NDB                               
                       Cluster ndbapi and                            
                       mgmapi documentation                          
-with-ndb-port         Port for NDB Cluster                          
                       management server                             
-with-ndb-port-base    Port for NDB Cluster                  5.0.3   
                       management server                             
-with-ndb-sci=DIR      Provide MySQL with a                          
                       custom location of                            
                       sci library                                   
-with-ndb-shm          Include the NDB                               
                       Cluster shared memory                         
                       transporter                                   
-with-ndb-test         Include the NDB                               
                       Cluster ndbapi test                           
                       programs                                      
-with-ndbcluster       Include the NDB        no                     
                       Cluster table handler                         
-with-openssl=DIR      Include the OpenSSL                           
                       support                                       
-with-openssl-includes Find OpenSSL headers                          
                       in DIR                                        
-with-openssl-libs     Find OpenSSL                                  
                       libraries in DIR                              
-with-other-libc=DIR   Link against libc and                         
                       other standard                                
                       libraries installed                           
                       in the specified                              
                       non-standard location                         
-with-pic              Try to use only        Use both               
                       PIC/non-PIC objects                           
-with-pstack           Use the pstack                                
                       backtrace library                             
-with-pthread          Force use of pthread                          
                       library                                       
-with-raid             Enable RAID Support                           
-with-server-suffix    Append value to the                           
                       version string                                
-with-system-type      Set the system type,                  5.0.44  
                       like "sun-solaris10"                          
-with-tags             Include additional     automatic              
                       configurations                                
-with-tcp-port         Which port to use for  3306                   
                       MySQL services                                
-with-unix-socket-path Where to put the                              
                       unix-domain socket                            
-with-vio              Include the Virtual                           
                       IO support                                    
-with-yassl            Include the yaSSL                     5.0.6   
                       support                                       
-with-zlib-dir         Provide MySQL with a                          
                       custom location of                            
                       compression library                           
-with-zlib-dir=DIR                                                   
-without-PACKAGE       Do not use PACKAGE                            
-without-bench         Skip building of the                          
                       benchmark suite                               
-without-debug         Build a production                            
                       version without                               
                       debugging code                                
-without-docs          Skip building of the                          
                       documentation                                 
-without-extra-tools   Skip building                                 
                       utilites in the tools                         
                       directory                                     
-without-geometry      Do not build                                  
                       geometry-related parts                        
-without-innodb        Do not include the                            
                       InnoDB table handler                          
-without-libedit       Use system libedit                            
                       instead of bundled                            
                       copy                                          
-without-man           Skip building of the                          
                       man pages                                     
-without-ndb-debug     Disable special ndb                   5.0.3   
                       debug features                                
-without-query-cache   Do not build query                            
                       cache                                         
-without-readline      Use system readline                           
                       instead of bundled                            
                       copy                                          
-without-server        Only build the client                         
-without-uca           Skip building of the                  5.0.3   
                       national Unicode                              
                       collations                                    

Some of the `configure' options available are described here:

   * To compile just the MySQL client libraries and client programs and
     not the server, use the `--without-server' option:

          shell> ./configure --without-server

     If you have no C++ compiler, some client programs such as `mysql'
     cannot be compiled because they require C++.. In this case, you
     can remove the code in `configure' that tests for the C++ compiler
     and then run `./configure' with the `--without-server' option. The
     compile step should still try to build all clients, but you can
     ignore any warnings about files such as `mysql.cc'. (If `make'
     stops, try `make -k' to tell it to continue with the rest of the
     build even if errors occur.)

   * If you want to build the embedded MySQL library (`libmysqld.a'),
     use the `--with-embedded-server' option.

   * If you don't want your log files and database directories located
     under `/usr/local/var', use a `configure' command 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'.

     You can also specify the installation directory and data directory
     locations at server startup time by using the `--basedir' and
     `--datadir' options. These can be given on the command line or in
     an MySQL option file, although it is more common to use an option
     file. See *Note option-files::.

   * If you are using Unix and you want the MySQL socket file location
     to be somewhere other than the default location (normally in the
     directory `/tmp' or `/var/run'), use a `configure' command like
     this:

          shell> ./configure \
                     --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock

     The socket filename must be an absolute pathname. You can also
     change the location of `mysql.sock' at server startup by using a
     MySQL option file. See *Note problems-with-mysql-sock::.

   * If you want to compile statically linked programs (for example, to
     make a binary distribution, to get better performance, or to work
     around problems with some Red Hat Linux distributions), run
     `configure' like this:

          shell> ./configure --with-client-ldflags=-all-static \
                     --with-mysqld-ldflags=-all-static

   * If you are using `gcc' and don't have `libg++' or `libstdc++'
     installed, you can tell `configure' to use `gcc' as your C++
     compiler:

          shell> CC=gcc CXX=gcc ./configure

     When you use `gcc' as your C++ compiler, it does not attempt to
     link in `libg++' or `libstdc++'. This may be a good thing to do
     even if you have those libraries installed. Some versions of them
     have caused strange problems for MySQL users in the past.

     The following list indicates some compilers and environment
     variable settings that are commonly used with each one.

        * `gcc' 2.7.2:

               CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors"

        * `gcc' 2.95.2:

               CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
               -felide-constructors -fno-exceptions -fno-rtti"

        * `pgcc' 2.90.29 or newer:

               CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \
               CXXFLAGS="-O3 -mpentiumpro -mstack-align-double \
               -felide-constructors -fno-exceptions -fno-rtti"

     In most cases, you can get a reasonably optimized MySQL binary by
     using the options from the preceding list and adding the following
     options to the `configure' line:

          --prefix=/usr/local/mysql --enable-assembler \
          --with-mysqld-ldflags=-all-static

     The full `configure' line would, in other words, be something like
     the following for all recent `gcc' versions:

          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

     The binaries we provide on the MySQL Web site at
     `http://dev.mysql.com/downloads/' are all compiled with full
     optimization and should be perfect for most users. See *Note
     mysql-binaries::. There are some configuration settings you can
     tweak to build an even faster binary, but these are only for
     advanced users. See *Note compile-and-link-options::.

     If the build fails and produces errors about your compiler or
     linker not being able to create the shared library
     `libmysqlclient.so.N' (where N is a version number), you can work
     around this problem by giving the `--disable-shared' option to
     `configure'. In this case, `configure' does not build a shared
     `libmysqlclient.so.N' library.

   * By default, MySQL uses the `latin1' (cp1252 West European)
     character set. To change the default set, use the `--with-charset'
     option:

          shell> ./configure --with-charset=CHARSET

     CHARSET may be one of `binary', `armscii8', `ascii', `big5',
     `cp1250', `cp1251', `cp1256', `cp1257', `cp850', `cp852', `cp866',
     `cp932', `dec8', `eucjpms', `euckr', `gb2312', `gbk', `geostd8',
     `greek', `hebrew', `hp8', `keybcs2', `koi8r', `koi8u', `latin1',
     `latin2', `latin5', `latin7', `macce', `macroman', `sjis', `swe7',
     `tis620', `ucs2', `ujis', `utf8'. See *Note
     charset-configuration::. (Additional character sets might be
     available. Check the output from `./configure --help' for the
     current list.)

     The default collation may also be specified. MySQL uses the
     `latin1_swedish_ci' collation by default.  To change this, use the
     `--with-collation' option:

          shell> ./configure --with-collation=COLLATION

     To change both the character set and the collation, use both the
     `--with-charset' and `--with-collation' options. The collation
     must be a legal collation for the character set. (Use the `SHOW
     COLLATION' statement to determine which collations are available
     for each character set.)

     *Warning*:

     If you change character sets after having created any tables, you
     must run `myisamchk -r -q --set-collation=COLLATION_NAME' _on
     every `MyISAM' table_. Your indexes may be sorted incorrectly
     otherwise. This can happen if you install MySQL, create some
     tables, and then reconfigure MySQL to use a different character
     set and reinstall it.

     With the `configure' option `--with-extra-charsets=LIST', you can
     define which additional character sets should be compiled into the
     server. LIST is one of the following:

        * A list of character set names separated by spaces

        * `complex' to include all character sets that can't be
          dynamically loaded

        * `all' to include all character sets into the binaries

     Clients that want to convert characters between the server and the
     client should use the `SET NAMES' statement. See *Note
     set-option::, and *Note charset-connection::.

   * To configure MySQL with debugging code, use the `--with-debug'
     option:

          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. See
     MySQL Internals: Porting
     (http://forge.mysql.com/wiki/MySQL_Internals_Porting).

     As of MySQL 5.0.25, using `--with-debug' to configure MySQL with
     debugging support enables you to use the
     `--debug="d,parser_debug"' option when you start the server. This
     causes the Bison parser that is used to process SQL statements to
     dump a parser trace to the server's standard error output.
     Typically, this output is written to the error log.

   * If your client programs are using threads, you must compile a
     thread-safe version of the MySQL client library with the
     `--enable-thread-safe-client' configure option. This creates a
     `libmysqlclient_r' library with which you should link your threaded
     applications. See *Note threaded-clients::.

   * It is possible to build MySQL 5.0 with large table support using
     the `--with-big-tables' option, beginning with MySQL 5.0.4.

     This option causes the variables that store table row counts to be
     declared as `unsigned long long' rather than `unsigned long'. This
     enables tables to hold up to approximately 1.844E+19 ((2^32)^2)
     rows rather than 2^32 (~4.295E+09) rows. Previously it was
     necessary to pass `-DBIG_TABLES' to the compiler manually in order
     to enable this feature.

   * Run `configure' with the `--disable-grant-options' option to cause
     the the `--bootstrap', `--skip-grant-tables', and `--init-file'
     options for `mysqld' to be disabled. For Windows, the
     `configure.js' script recognizes the `DISABLE_GRANT_OPTIONS' flag,
     which has the same effect. The capability is available as of MySQL
     5.0.34.

   * See *Note operating-system-specific-notes::, for options that
     pertain to particular operating systems.

   * See *Note secure-using-ssl::, for options that pertain to
     configuring MySQL to support secure (encrypted) connections.

File: manual.info,  Node: installing-source-tree,  Next: compilation-problems,  Prev: configure-options,  Up: installing-source

2.4.15.3 Installing from the Development Source Tree
....................................................

This section does not apply to MySQL Enterprise Server users.

*Caution*:

You should read this section only if you are interested in helping us
test our new code. If you just want to get MySQL up and running on your
system, you should use a standard release distribution (either a binary
or source distribution).

To obtain our most recent development source tree, first download and
install the BitKeeper free client if you do not have it. The client can
be obtained from `http://www.bitmover.com/bk-client2.0.shar'. Note that
you will need `gcc' and `make' to build the BitKeeper free client, and
`patch' and `tar' to use the BitKeeper free client. _Note that old 1.1
versions of the BitKeeper free client will not work!_

To install the BitKeeper client on Unix, use these commands:

     shell> /bin/sh bk-client2.0.shar
     shell> cd bk-client2.0
     shell> make

If you get a `cc: command not found' error, invoke this command before
running `make':

     shell> make CC=gcc

The step above will create the utility `bkf', which is the free
BitKeeper client.

To install the BitKeeper client on Windows, use these instructions:

  1. Download and install Cygwin from http://cygwin.com
     (http://cygwin.com/).

  2. Make sure `patch', `tar', `gcc' and `make' have been installed
     under Cygwin. You can test this by issuing `which GCC' for each
     command. If a required tool is not installed, run Cygwin's package
     manager, select the required tools and install them.

  3. For the installation of the BitKeeper free client, use the same
     installations as given for Unix-like systems above.

For more information on `bkf', use:

     shell> bkf --help

After you have installed the BitKeeper client, you can access the MySQL
development source tree:

  1. Change location to the directory you want to work from, and then
     use the following command to make a local copy of the MySQL 5.0
     branch:

          shell> bkf clone bk://mysql.bkbits.net/mysql-5.0 mysql-5.0

     In the preceding example, the source tree is set up in the
     `mysql-5.0/' subdirectory of your current directory.

     The initial download of the source tree may take a while,
     depending on the speed of your connection. Please be patient.

  2. You need GNU `make', `autoconf' 2.58 (or newer), `automake' 1.8.1,
     `libtool' 1.5, and `m4' to run the next set of commands. Even
     though many operating systems come with their own implementation of
     `make', chances are high that the compilation fails with strange
     error messages. Therefore, it is highly recommended that you use
     GNU `make' (sometimes named `gmake') instead.

     Fortunately, a large number of operating systems ship with the GNU
     toolchain preinstalled or supply installable packages of these. In
     any case, they can also be downloaded from the following locations:

        * `http://www.gnu.org/software/autoconf/'

        * `http://www.gnu.org/software/automake/'

        * `http://www.gnu.org/software/libtool/'

        * `http://www.gnu.org/software/m4/'

        * `http://www.gnu.org/software/make/'

     To configure MySQL 5.0, you also need GNU `bison'. You should use
     the latest version of bison where possible. Version 1.75 and
     version 2.1 are known to work. There have been reported problems
     with `bison' 1.875. If you experience problems, upgrade to a
     later, rather than earlier, version. Versions of `bison' older
     than 1.75 may report this error:

          sql_yacc.yy:#####: fatal error: maximum table size (32767) exceeded

     Note: The maximum table size is not actually exceeded; the error
     is caused by bugs in older versions of `bison'.

     The following example shows the typical commands required to
     configure a source tree. The first `cd' command changes location
     into the top-level directory of the tree; replace `mysql-5.0' with
     the appropriate directory name.

          shell> cd mysql-5.0
          shell> (cd bdb/dist; sh s_all)
          shell> (cd innobase; autoreconf --force --install)
          shell> autoreconf --force --install
          shell> ./configure  # Add your favorite options here
          shell> make

     Or you can use `BUILD/autorun.sh' as a shortcut for the following
     sequence of commands:

          shell> aclocal; autoheader
          shell> libtoolize --automake --force
          shell> automake --force --add-missing; autoconf
          shell> (cd innobase; aclocal; autoheader; autoconf; automake)
          shell> (cd bdb/dist; sh s_all)

     The command lines that change directory into the `innobase' and
     `bdb/dist' directories are used to configure the `InnoDB' and
     Berkeley DB (`BDB') storage engines. You can omit these command
     lines if you to not require `InnoDB' or `BDB' support.

     If you get some strange errors during this stage, verify that you
     really have `libtool' installed.

     A collection of our standard configuration scripts is located in
     the `BUILD/' subdirectory. You may find it more convenient to use
     the `BUILD/compile-pentium-debug' script than the preceding set of
     shell commands. To compile on a different architecture, modify the
     script by removing flags that are Pentium-specific.

  3. When the build is done, run `make install'.  Be careful with this
     on a production machine; the command may overwrite your live
     release installation. If you have another installation of MySQL,
     we recommend that you run `./configure' with different values for
     the `--prefix', `--with-tcp-port', and `--unix-socket-path'
     options than those used for your production server.

  4. Play hard with your new installation and try to make the new
     features crash. Start by running `make test'. See *Note
     mysql-test-suite::.

  5. If you have gotten to the `make' stage, but the distribution does
     not compile, please enter the problem into our bugs database using
     the instructions given in *Note bug-reports::. If you have
     installed the latest versions of the required GNU tools, and they
     crash trying to process our configuration files, please report
     that also. However, if you execute `aclocal' and get a `command not
     found' error or a similar problem, do not report it. Instead, make
     sure that all the necessary tools are installed and that your
     `PATH' variable is set correctly so that your shell can find them.

  6. After initially copying the repository with `bkf' to obtain the
     source tree, you should use `pull' option to periodically update
     your local copy. To do this any time after you have set up the
     repository, use this command:

          shell> bkf pull

  7. You can examine the changeset comments for the tree by using the
     `changes' option to `bkf':

          shell> bkf changes

     To get a list of the changes that would be applied with the next
     `bkf pull':

          shell> bkf changes -R

     To obtain a patch file for a specific changeset (`CSETID'), use:

          shell> bkf changes -vvrCSETID

     If you see diffs or code that you have a question about, do not
     hesitate to send email to the MySQL Internals mailing list. (See
     *Note mailing-lists::.) Also, if you think you have a better idea
     on how to do something, send an email message to the list with
     your proposed patch.

You can also browse changesets, comments, and source code online. To
browse this information for MySQL 5.0, go to
`http://mysql.bkbits.net:8080/mysql-5.0'.

File: manual.info,  Node: compilation-problems,  Next: mit-pthreads,  Prev: installing-source-tree,  Up: installing-source

2.4.15.4 Dealing with Problems Compiling MySQL
..............................................

This section does not apply to MySQL Enterprise Server users.

All MySQL programs compile cleanly for us with no warnings on Solaris
or Linux using `gcc'. On other systems, warnings may occur due to
differences in system include files.  See *Note mit-pthreads::, for
warnings that may occur when using MIT-pthreads. For other problems,
check the following list.

The solution to many problems involves reconfiguring. If you do need to
reconfigure, take note of the following:

   * If `configure' is run after it has previously been run, it may use
     information that was gathered during its previous invocation. This
     information is stored in `config.cache'. When `configure' starts
     up, it looks for that file and reads its contents if it exists, on
     the assumption that the information is still correct. That
     assumption is invalid when you reconfigure.

   * Each time you run `configure', you must run `make' again to
     recompile. However, you may want to remove old object files from
     previous builds first because they were compiled using different
     configuration options.

To prevent old configuration information or object files from being
used, run these commands before re-running `configure':

     shell> rm config.cache
     shell> make clean

Alternatively, you can run `make distclean'.

The following list describes some of the problems when compiling MySQL
that have been found to occur most often:

   * If you get errors such as the ones shown here when compiling
     `sql_yacc.cc', you probably have run out of memory or swap space:

          Internal compiler error: program cc1plus got fatal signal 11
          Out of virtual memory
          Virtual memory exhausted

     The problem is that `gcc' requires a huge amount of memory to
     compile `sql_yacc.cc' with inline functions. Try running
     `configure' with the `--with-low-memory' option:

          shell> ./configure --with-low-memory

     This option causes `-fno-inline' to be added to the compile line
     if you are using `gcc' and `-O0' if you are using something else.
     You should try the `--with-low-memory' option even if you have so
     much memory and swap space that you think you can't possibly have
     run out. This problem has been observed to occur even on systems
     with generous hardware configurations, and the `--with-low-memory'
     option usually fixes it.

   * By default, `configure' picks `c++' as the compiler name and GNU
     `c++' links with `-lg++'. If you are using `gcc', that behavior can
     cause problems during configuration such as this:

          configure: error: installation or configuration problem:
          C++ compiler cannot create executables.

     You might also observe problems during compilation related to
     `g++', `libg++', or `libstdc++'.

     One cause of these problems is that you may not have `g++', or you
     may have `g++' but not `libg++', or `libstdc++'. Take a look at the
     `config.log' file. It should contain the exact reason why your C++
     compiler didn't work. To work around these problems, you can use
     `gcc' as your C++ compiler. Try setting the environment variable
     `CXX' to `"gcc -O3"'. For example:

          shell> CXX="gcc -O3" ./configure

     This works because `gcc' compiles C++ source files as well as
     `g++' does, but does not link in `libg++' or `libstdc++' by
     default.

     Another way to fix these problems is to install `g++', `libg++',
     and `libstdc++'. However, we recommend that you not use `libg++' or
     `libstdc++' with MySQL because this only increases the binary size
     of `mysqld' without providing any benefits. Some versions of these
     libraries have also caused strange problems for MySQL users in the
     past.

   * If your compile fails with errors such as any of the following,
     you must upgrade your version of `make' to GNU `make':

          making all in mit-pthreads
          make: Fatal error in reader: Makefile, line 18:
          Badly formed macro assignment

     Or:

          make: file `Makefile' line 18: Must be a separator (:

     Or:

          pthread.h: No such file or directory

     Solaris and FreeBSD are known to have troublesome `make' programs.

     GNU `make' 3.75 is known to work.

   * If you want to define flags to be used by your C or C++ compilers,
     do so by adding the flags to the `CFLAGS' and `CXXFLAGS'
     environment variables. You can also specify the compiler names
     this way using `CC' and `CXX'. For example:

          shell> CC=gcc
          shell> CFLAGS=-O3
          shell> CXX=gcc
          shell> CXXFLAGS=-O3
          shell> export CC CFLAGS CXX CXXFLAGS

     See *Note mysql-binaries::, for a list of flag definitions that
     have been found to be useful on various systems.

   * If you get errors such as those shown here when compiling
     `mysqld', `configure' did not correctly detect the type of the
     last argument to `accept()', `getsockname()', or `getpeername()':

          cxx: Error: mysqld.cc, line 645: In this statement, the referenced
               type of the pointer value ''length'' is ''unsigned long'',
               which is not compatible with ''int''.
          new_sock = accept(sock, (struct sockaddr *)&cAddr, &length);

     To fix this, edit the `config.h' file (which is generated by
     `configure'). Look for these lines:

          /* Define as the base type of the last arg to accept */
          #define SOCKET_SIZE_TYPE XXX

     Change `XXX' to `size_t' or `int', depending on your operating
     system. (You must do this each time you run `configure' because
     `configure' regenerates `config.h'.)

   * The `sql_yacc.cc' file is generated from `sql_yacc.yy'. Normally,
     the build process does not need to create `sql_yacc.cc' because
     MySQL comes with a pre-generated copy. However, if you do need to
     re-create it, you might encounter this error:

          "sql_yacc.yy", line XXX fatal: default action causes potential...

     This is a sign that your version of `yacc' is deficient. You
     probably need to install `bison' (the GNU version of `yacc') and
     use that instead.

   * On Debian Linux 3.0, you need to install `gawk' instead of the
     default `mawk' if you want to compile MySQL with Berkeley DB
     support.

   * If you need to debug `mysqld' or a MySQL client, run `configure'
     with the `--with-debug' option, and then recompile and link your
     clients with the new client library. See MySQL Internals: Porting
     (http://forge.mysql.com/wiki/MySQL_Internals_Porting).

   * If you get a compilation error on Linux (for example, SuSE Linux
     8.1 or Red Hat Linux 7.3) similar to the following one, you
     probably do not have `g++' installed:

          libmysql.c:1329: warning: passing arg 5 of `gethostbyname_r' from
          incompatible pointer type
          libmysql.c:1329: too few arguments to function `gethostbyname_r'
          libmysql.c:1329: warning: assignment makes pointer from integer
          without a cast
          make[2]: *** [libmysql.lo] Error 1

     By default, the `configure' script attempts to determine the
     correct number of arguments by using `g++' (the GNU C++ compiler).
     This test yields incorrect results if `g++' is not installed.
     There are two ways to work around this problem:

        * Make sure that the GNU C++ `g++' is installed. On some Linux
          distributions, the required package is called `gpp'; on
          others, it is named `gcc-c++'.

        * Use `gcc' as your C++ compiler by setting the `CXX'
          environment variable to `gcc':

               export CXX="gcc"

     You must run `configure' again after making either of those
     changes.

File: manual.info,  Node: mit-pthreads,  Next: windows-source-build,  Prev: compilation-problems,  Up: installing-source

2.4.15.5 MIT-pthreads Notes
...........................

This section does not apply to MySQL Enterprise Server users.

This section describes some of the issues involved in using
MIT-pthreads.

On Linux, you should _not_ use MIT-pthreads.  Use the installed
LinuxThreads implementation instead. See *Note linux::.

If your system does not provide native thread support, you should build
MySQL using the MIT-pthreads package. This includes older FreeBSD
systems, SunOS 4.x, Solaris 2.4 and earlier, and some others. See *Note
which-os::.

MIT-pthreads is not part of the MySQL 5.0 source distribution. If you
require this package, you need to download it separately from
`http://dev.mysql.com/Downloads/Contrib/pthreads-1_60_beta6-mysql.tar.gz'

After downloading, extract this source archive into the top level of
the MySQL source directory. It creates a new subdirectory named
`mit-pthreads'.

   * On most systems, you can force MIT-pthreads to be used by running
     `configure' with the `--with-mit-threads' option:

          shell> ./configure --with-mit-threads

     Building in a non-source directory is not supported when using
     MIT-pthreads because we want to minimize our changes to this code.

   * The checks that determine whether to use MIT-pthreads occur only
     during the part of the configuration process that deals with the
     server code. If you have configured the distribution using
     `--without-server' to build only the client code, clients do not
     know whether MIT-pthreads is being used and use Unix socket file
     connections by default. Because Unix socket files do not work
     under MIT-pthreads on some platforms, this means you need to use
     `-h' or `--host' with a value other than `localhost' when you run
     client programs.

   * When MySQL is compiled using MIT-pthreads, system locking is
     disabled by default for performance reasons. You can tell the
     server to use system locking with the `--external-locking' option.
     This is needed only if you want to be able to run two MySQL
     servers against the same data files, but that is not recommended,
     anyway.

   * Sometimes the pthread `bind()' command fails to bind to a socket
     without any error message (at least on Solaris). The result is
     that all connections to the server fail. For example:

          shell> mysqladmin version
          mysqladmin: connect to server at '' failed;
          error: 'Can't connect to mysql server on localhost (146)'

     The solution to this problem is to kill the `mysqld' server and
     restart it. This has happened to us only when we have forcibly
     stopped the server and restarted it immediately.

   * With MIT-pthreads, the `sleep()' system call isn't interruptible
     with `SIGINT' (break). This is noticeable only when you run
     `mysqladmin --sleep'. You must wait for the `sleep()' call to
     terminate before the interrupt is served and the process stops.

   * When linking, you might receive warning messages like these (at
     least on Solaris); they can be ignored:

          ld: warning: symbol `_iob' has differing sizes:
              (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
          file /usr/lib/libc.so value=0x140);
              /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
          ld: warning: symbol `__iob' has differing sizes:
              (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
          file /usr/lib/libc.so value=0x140);
              /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken

   * Some other warnings also can be ignored:

          implicit declaration of function `int strtoll(...)'
          implicit declaration of function `int strtoul(...)'

   * We have not been able to make `readline' work with MIT-pthreads.
     (This is not necessary, but may be of interest to some.)