./configure命令常用选项详解
时间:2008-12-08 来源:fuowen20
Typical `configure' Options
.................................... 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. For a full list of options supported by `configure', run this command: shell> ./configure --help 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. * 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" * `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" 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 character-sets::.
(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
Debugging a MySQL Server
(http://dev.mysql.com/doc/refman/5.0/en/debugging-server.html). 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. * 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.
.................................... 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. For a full list of options supported by `configure', run this command: shell> ./configure --help 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. * 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" * `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" 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 character-sets::.
(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
Debugging a MySQL Server
(http://dev.mysql.com/doc/refman/5.0/en/debugging-server.html). 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. * 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.
相关阅读 更多 +