4.7.3 Options communes de configure

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-server option:
    shell> ./configure --without-server
    
    If you don't have a C++ compiler, mysql will not compile (it is the one client program that requires 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 will still try to build mysql, but you can ignore any warnings about `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 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.
  • 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 configure command 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 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 will not attempt to link in libg++ or libstdc++. 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-shared option to configure. In this case, configure will not build a shared libmysqlclient.so.# library.
  • You can configure MySQL not to use DEFAULT column values for non-NULL columns (i.e., columns that are not allowed to be NULL). This causes INSERT statements to generate an error unless you explicitly specify values for all columns that require a non-NULL value. To suppress use of default values, run configure like 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-charset option:
    shell> ./configure --with-charset=CHARSET
    
    CHARSET may be one of big5, cp1251, cp1257, czech, danish,dec8, dos, euc_kr, german1, hebrew, hp8, hungarian, koi8_ru, koi8_ukr, latin1, latin2, sjis, swe7, tis620, ujis, usa7, win1251 or win1251ukr. 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 a make distclean between configurations! If you want to convert characters between the server and the client, you should take a look at the SET OPTION CHARACTER SET command. SET OPTION. Warning: If you change character sets after having created any tables, you will have to run isamchk -r -q on 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-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. 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.