2.11.4. MySQL Source-Configuration Options

The CMake program provides a great deal of control over how you configure a MySQL source distribution. Typically, you do this using options on the CMake command line. For information about options supported by CMake, run either of these commands in the top-level source directory:

shell> cmake . -LH
shell> ccmake .

You can also affect CMake using certain environment variables. See Section 2.14, “Environment Variables”.

The following table shows the available CMake options. In the Default column, PREFIX stands for the value of the CMAKE_INSTALL_PREFIX option, which specifies the installation base directory. This value is used as the parent location for several of the installation subdirectories.

Table 2.14. MySQL Source-Configuration Option Reference (CMake)

FormatsDescriptionDefaultIntroducedRemoved
BUILD_CONFIGUse same build options as official releases5.5.7 
CMAKE_BUILD_TYPEType of build to produceRelWithDebInfo5.5.7 
CMAKE_INSTALL_PREFIXInstallation base directory/usr/local/mysql5.5.8 
CPACK_MONOLITHIC_INSTALLWhether package build produces single fileOFF5.5.7 
DEFAULT_CHARSETThe default server character setlatin15.5.7 
DEFAULT_COLLATIONThe default server collationlatin1_swedish_ci5.5.7 
ENABLE_DEBUG_SYNCWhether to enable Debug Sync supportON5.5.7 
ENABLE_DOWNLOADSWhether to download optional filesOFF5.5.7 
ENABLE_DTRACEWhether to include DTrace support5.5.7 
ENABLED_LOCAL_INFILEWhether to enable LOCAL for LOAD DATA INFILEOFF5.5.7 
ENABLED_PROFILINGWhether to enable query profiling codeON5.5.7 
INSTALL_BINDIRUser executables directoryPREFIX/bin5.5.7 
INSTALL_DOCDIRDocumentation directoryPREFIX/docs5.5.7 
INSTALL_DOCREADMEDIRREADME file directoryPREFIX5.5.7 
INSTALL_INCLUDEDIRHeader file directoryPREFIX/include5.5.7 
INSTALL_INFODIRInfo file directoryPREFIX/docs5.5.7 
INSTALL_LAYOUTSelect predefined installation layoutSTANDALONE5.5.7 
INSTALL_LIBDIRLibrary file directoryPREFIX/lib5.5.7 
INSTALL_MANDIRManual page directoryPREFIX/man5.5.7 
INSTALL_MYSQLSHAREDIRShared data directoryPREFIX/share5.5.7 
INSTALL_MYSQLTESTDIRmysql-test directoryPREFIX/mysql-test5.5.7 
INSTALL_PLUGINDIRPlugin directoryPREFIX/lib/plugin5.5.7 
INSTALL_SBINDIRServer executable directoryPREFIX/bin5.5.7 
INSTALL_SCRIPTDIRScripts directoryPREFIX/scripts5.5.7 
INSTALL_SHAREDIRaclocal/mysql.m4 installation directoryPREFIX/share5.5.7 
INSTALL_SQLBENCHDIRsql-bench directoryPREFIX5.5.7 
INSTALL_SUPPORTFILESDIRExtra support files directoryPREFIX/support-files5.5.7 
MYSQL_DATADIRData directory5.5.7 
MYSQL_MAINTAINER_MODEWhether to enable MySQL maintainer-specific development environmentOFF5.5.7 
MYSQL_TCP_PORTTCP/IP port number33065.5.7 
MYSQL_UNIX_ADDRUnix socket file/tmp/mysql.sock5.5.7 
SYSCONFDIROption file directory5.5.7 
WITH_COMMENTComment about compilation environment5.5.7 
WITH_DEBUGWhether to include debugging supportOFF5.5.7 
WITH_EMBEDDED_SERVERWhether to build embedded serverOFF5.5.7 
WITH_xxx_STORAGE_ENGINECompile storage engine xxx statically into server5.5.7 
WITH_EXTRA_CHARSETSWhich extra character sets to includeall5.5.7 
WITH_LIBWRAPWhether to include libwrap (TCP wrappers) supportOFF5.5.7 
WITH_READLINEUse bundled readlineOFF5.5.7 
WITH_SSLType of SSL supportno5.5.7 
WITH_ZLIBType of zlib supportsystem5.5.7 
WITHOUT_xxx_STORAGE_ENGINEExclude storage engine xxx from build5.5.7 

The following sections provide more information about CMake options.

For boolean options, the value may be specified as 1 or ON to enable the option, or as 0 or OFF to disable the option.

Many options configure compile-time defaults that can be overridden at server startup. For example, the CMAKE_INSTALL_PREFIX, MYSQL_TCP_PORT, and MYSQL_UNIX_ADDR options that configure the default installation base directory location, TCP/IP port number, and Unix socket file can be changed at server startup with the --basedir, --port, and --socket options for mysqld. Where applicable, configuration option descriptions indicate the corresponding mysqld startup option.

General Options

  • -DBUILD_CONFIG=mysql_release

    This option configures a source distribution with the same build options used by Oracle to produce binary distributions for official MySQL releases.

  • -DCMAKE_BUILD_TYPE=type

    The type of build to produce:

    • RelWithDebInfo: Enable optimizations and generate debugging information. This is the default MySQL build type.

    • Debug: Disable optimizations and generate debugging information. This build type is also used if the WITH_DEBUG option is enabled. That is, -DWITH_DEBUG=1 has the same effect as -DCMAKE_BUILD_TYPE=Debug.

  • -DCPACK_MONOLITHIC_INSTALL=bool

    This option affects whether the make package operation produces multiple installation package files or a single file. If disabled, the operation produces multiple installation package files, which may be useful if you want to install only a subset of a full MySQL installation. If enabled, it produces a single file for installing everything.

Installation Layout Options

The CMAKE_INSTALL_PREFIX option indicates the base installation directory. Other options with names of the form INSTALL_xxx that indicate component locations are interpreted relative to the prefix and their values are relative pathnames. Their values should not include the prefix.

  • -DCMAKE_INSTALL_PREFIX=dir_name

    The installation base directory.

    This value can be set at server startup with the --basedir option.

  • -DINSTALL_BINDIR=dir_name

    Where to install user programs.

  • -DINSTALL_DOCDIR=dir_name

    Where to install documentation.

  • -DINSTALL_DOCREADMEDIR=dir_name

    Where to install README files.

  • -DINSTALL_INCLUDEDIR=dir_name

    Where to install header files.

  • -DINSTALL_INFODIR=dir_name

    Where to install Info files.

  • -DINSTALL_LAYOUT=name

    Select a predefined installation layout:

    • STANDALONE: Same layout as used for .tar.gz and .zip packages. This is the default.

    • RPM: Layout similar to RPM packages.

    • SVR4: Solaris package layout.

    • DEB: DEB package layout (experimental).

    You can select a predefined layout but modify individual component installation locations by specifying other options. For example:

    shell> cmake . -DINSTALL_LAYOUT=SVR4 -DMYSQL_DATADIR=/var/mysql/data
    
  • -DINSTALL_LIBDIR=dir_name

    Where to install library files.

  • -DINSTALL_MANDIR=dir_name

    Where to install manual pages.

  • -DINSTALL_MYSQLSHAREDIR=dir_name

    Where to install shared data files.

  • -DINSTALL_MYSQLTESTDIR=dir_name

    Where to install the mysql-test directory.

  • -DINSTALL_PLUGINDIR=dir_name

    The location of the plugin directory.

    This value can be set at server startup with the --plugin_dir option.

  • -DINSTALL_SBINDIR=dir_name

    Where to install the mysqld server.

  • -DINSTALL_SCRIPTDIR=dir_name

    Where to install mysql_install_db.

  • -DINSTALL_SHAREDIR=dir_name

    Where to install aclocal/mysql.m4.

  • -DINSTALL_SQLBENCHDIR=dir_name

    Where to install the sql-bench directory. To not install this directory, use an empty value (-DINSTALL_SQLBENCHDIR=).

  • -DINSTALL_SUPPORTFILESDIR=dir_name

    Where to install extra support files.

  • -DMYSQL_DATADIR=dir_name

    The location of the MySQL data directory.

    This value can be set at server startup with the --datadir option.

  • -DSYSCONFDIR=dir_name

    The default my.cnf option file directory.

    This location cannot be set at server startup, but you can start the server with a given option file using the --defaults-file=file_name option, where file_name is the full path name to the file.

Storage Engine Options

Storage engines are built as plugins. You can build a plugin as a static module (compiled into the server) or a dynamic module (built as a dynamic library that must be installed into the server using the INSTALL PLUGIN statement or the --plugin-load option before it can be used). Some plugins might not support static or dynamic building.

The MyISAM, MERGE, MEMORY, and CSV engines are mandatory (always compiled into the server) and need not be installed explicitly.

To compile a storage engine statically into the server, use -DWITH_engine_STORAGE_ENGINE=1. Some permissible engine values are ARCHIVE, BLACKHOLE, EXAMPLE, FEDERATED, INNOBASE (InnoDB), PARTITION (partitioning support), and PERFSCHEMA (Performance Schema). Examples:

-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1

To exclude a storage engine from the build, use -DWITHOUT_engine_STORAGE_ENGINE=1. Examples:

-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
-DWITHOUT_PARTITION_STORAGE_ENGINE=1

If neither -DWITH_engine_STORAGE_ENGINE nor -DWITHOUT_engine_STORAGE_ENGINE are specified for a given storage engine, the engine is built as a shared module, or excluded if it cannot be built as a shared module.

Feature Options

  • -DDEFAULT_CHARSET=charset_name

    The server character set. By default, MySQL uses the latin1 (cp1252 West European) character set.

    charset_name 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, utf8mb4, utf16, utf32. The permissible character sets are listed in the cmake/character_sets.cmake file as the value of CHARSETS_AVAILABLE.

    This value can be set at server startup with the --character_set_server option.

  • -DDEFAULT_COLLATION=collation_name

    The server collation. By default, MySQL uses latin1_swedish_ci. Use the SHOW COLLATION statement to determine which collations are available for each character set.

    This value can be set at server startup with the --collation_server option.

  • -DENABLE_DEBUG_SYNC=bool

    Whether to compile the Debug Sync facility into the server. This facility is used for testing and debugging. This option is enabled by default, but has no effect unless MySQL is configured with debugging enabled. If debugging is enabled and you want to disable Debug Sync, use -DENABLE_DEBUG_SYNC=0.

    When compiled in, Debug Sync is disabled by default at runtime. To enable it, start mysqld with the --debug-sync-timeout=N option, where N is a timeout value greater than 0. (The default value is 0, which disables Debug Sync.) N becomes the default timeout for individual synchronization points.

    For a description of the Debug Sync facility and how to use synchronization points, see MySQL Internals: Test Synchronization.

  • -DENABLE_DOWNLOADS=bool

    Whether to download optional files. For example, with this option enabled, CMake downloads the Google Test distribution that is used by the test suite to run unit tests.

  • -DENABLE_DTRACE=bool

    Whether to include support for DTrace probes. For information about DTrace, wee Section 5.7, “Tracing mysqld Using DTrace”

  • -DENABLED_LOCAL_INFILE=bool

    Whether to enable LOCAL capability in the client library for LOAD DATA INFILE.

    This option controls client-side LOCAL capability, but the capability can be set on the server side at server startup with the --local-infile option. See Section 5.3.5, “Security Issues with LOAD DATA LOCAL.

  • -DENABLED_PROFILING=bool

    Whether to enable query profiling code (for the SHOW PROFILE and SHOW PROFILES statements).

  • -DMYSQL_MAINTAINER_MODE=bool

    Whether to enable a MySQL maintainer-specific development environment. If enabled, this option causes compiler warnings to become errors.

  • -DMYSQL_TCP_PORT=port_num

    The port number on on which the server listens for TCP/IP connections. The default is 3306.

    This value can be set at server startup with the --port option.

  • -DMYSQL_UNIX_ADDR=file_name

    The Unix socket file path on which the server listens for socket connections. This must be an absolute path name. The default is /tmp/mysql.sock.

    This value can be set at server startup with the --socket option.

  • -DWITH_COMMENT=string

    A descriptive comment about the compilation environment.

  • -DWITH_DEBUG=bool

    Whether to include debugging support.

    Configuring 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.

  • -DWITH_EMBEDDED_SERVER=bool

    Whether to build the libmysqld embedded server library.

  • -DWITH_EXTRA_CHARSETS=name

    Which extra character sets to include:

    • all: All character sets. This is the default.

    • complex: Complex character sets.

    • none: No extra character sets.

  • -DWITH_LIBWRAP=bool

    Whether to include libwrap (TCP wrappers) support.

  • -DWITH_READLINE=bool

    Whether to use the readline library bundled with the distribution.

  • -DWITH_SSL=ssl_type

    The type of SSL support to include, if any:

    • no: No SSL support. This is the default.

    • yes: Use the system SSL library if present, else the library bundled with the distribution.

    • bundled: Use the SSL library bundled with the distribution.

    • system: Use the system SSL library.

    For information about using SSL support, see Section 5.5.8, “Using SSL for Secure Connections”.

  • -DWITH_ZLIB=zlib_type

    Some features require that the server be built with compression library support, such as the COMPRESS() and UNCOMPRESS() functions, and compression of the client/server protocol. The WITH_ZLIB indicates the source of zlib support:

    • bundled: Use the zlib library bundled with the distribution.

    • system: Use the system zlib library. This is the default.

Compiler Flags

To specify compiler flags, set the CFLAGS and CXXFLAGS environment variables before running CMake. Example:

shell> CFLAGS=-DDISABLE_GRANT_OPTIONS
shell> CXXFLAGS=-DDISABLE_GRANT_OPTIONS
shell> export CFLAGS CXXFLAGS
shell> cmake [options]

The following flags control configuration features:

  • DISABLE_GRANT_OPTIONS

    If this flag is defined, it causes the --bootstrap, --skip-grant-tables, and --init-file options for mysqld to be disabled.

  • HAVE_EMBEDDED_PRIVILEGE_CONTROL

    By default, authentication for connections to the embedded server is disabled. To enable connection authentication, define this flag.

Copyright © 2010-2024 Platon Technologies, s.r.o.           Index | Man stránky | tLDP | Dokumenty | Utilitky | O projekte
Design by styleshout