configure
Options
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. See section F 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 here:
--without-server
option:
shell> ./configure --without-serverIf 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.)
libmysqld.a
) you should
use the --with-embedded-server
option.
configure
command, something like one
of these:
shell> ./configure --prefix=/usr/local/mysql shell> ./configure --prefix=/usr/local \ --localstatedir=/usr/local/mysql/dataThe 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
. After you have compiled MySQL, you can
change these options with option files. See section 4.1.2 `my.cnf' Option Files.
configure
command like this:
shell> ./configure --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sockNote that the given file must be an absolute pathname. You can also later change the location `mysql.sock' by using the MySQL option files. See section A.4.5 How to Protect or Change the MySQL Socket File `/tmp/mysql.sock'.
configure
like this:
shell> ./configure --with-client-ldflags=-all-static \ --with-mysqld-ldflags=-all-static
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 ./configureWhen you use
gcc
as your C++ compiler, it will not attempt to link in
libg++
or libstdc++
. This may be a good idea to do even if you
have the above libraries installed, as some versions of these libraries have
caused strange problems for MySQL users in the past.
Here are some common environment variables to set depending on
the compiler you are using:
Compiler | Recommended options |
gcc 2.7.2.1 | CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors" |
egcs 1.0.3a | CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" |
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" |
--prefix=/usr/local/mysql --enable-assembler \ --with-mysqld-ldflags=-all-staticThe 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-staticThe binaries we provide on the MySQL web site at http://www.mysql.com/ are all compiled with full optimisation and should be perfect for most users. See section 2.2.10 MySQL Binaries Compiled by MySQL AB. There are some things you can tweak to make an even faster binary, but this is only for advanced users. See section 5.5.3 How Compiling and Linking Affects the Speed of MySQL. 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.
DEFAULT
column values for
non-NULL
columns (that is, columns that are not allowed to be
NULL
). See section 1.8.5.2 Constraint NOT NULL
and DEFAULT
values.
shell> CXXFLAGS=-DDONT_USE_DEFAULT_FIELDS ./configure
--with-charset
option:
shell> ./configure --with-charset=CHARSET
CHARSET
may be one of big5
, cp1251
, cp1257
,
czech
, danish
, dec8
, dos
, euc_kr
,
gb2312
, gbk
, german1
, hebrew
, hp8
,
hungarian
, koi8_ru
, koi8_ukr
, latin1
,
latin2
, sjis
, swe7
, tis620
, ujis
,
usa7
, or win1251ukr
.
See section 4.6.1 The Character Set Used for Data and Sorting.
If you want to convert characters between the server and the client,
you should take a look at the SET CHARACTER SET
command.
See section 5.5.6 SET
Syntax.
Warning: If you change character sets after having created any
tables, you will have to run myisamchk -r -q --set-character-set=charset
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.)
With the option --with-extra-charsets=LIST
you can define
which additional character sets should be compiled into the server.
Here LIST
is either a list of character
sets separated with spaces,
complex
to include all characters that can't be dynamically loaded,
or all
to include all character sets into the binaries.
--with-debug
option:
shell> ./configure --with-debugThis causes a safe memory allocator to be included that can find some errors and that provides output about what is happening. See section E.1 Debugging a MySQL server.
--enable-thread-safe-client
configure options. This will create a
libmysqlclient_r
library with which you should link your threaded
applications. See section 9.1.14 How to Make a Threaded Client.
Posted by Tom on Sunday July 21 2002, @8:21am | [Delete] [Edit] |
Thanks a lot for that last tip, DaPhreak. You saved
my mysql install. :)
Posted by [name withheld] on Wednesday December 18 2002, @5:27pm | [Delete] [Edit] |
For all who had the same Prolem like me :
If you get some error like this :
No curses/termcap library found
configure you're Source Distribution with the
option --with-named-curses-
libs=/your/path/to/lib/libncurses.so.5.0
Best Regards DaPhreak
Posted by Celeste Suliin Burris on Friday April 4 2003, @5:48pm | [Delete] [Edit] |
One thing puzzles me. How do you get the compile to put the libraries in /usr/local/mysql/lib? When I use --libdir=/usr/local/mysql/lib, I get the libraries in /usr/local/mysql/lib/mysql