tar
重编译
Shell>rm –rf CMakeCache.txt
Shell>make clean
Ccmake配置更改,自己生成makefile
进入配置界面,按C继续,按T,然后选择好功能,这个编译默认会把字符集全部编译安装,选择扩展字符集为none。退出,生成编译文件。
make阶段,有些警告,如果gcc版本低比如2.0的,就没警告,3.0+的会有警告,这是mysql源码的问题,直接无视就好了,除非你好纠正源码,gcc3.0+对源码编译检测增加新的功能,所以产生了警告。
部分编译代码解释
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信息很多。
+ 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.
-DWITH_DEBUG=1跟这个选项是一样的,使用这个模式关闭使用最优化模式生成调试信息。
* -DCPACK_MONOLITHIC_INSTALL=bool
If enabled, the make package operation produces a single
distribution file. If disabled, the operation produces
multiple files.
启用这个设置make操作生成一个文件,关闭会生成多个文件。这个设置对编译没什么用。
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.
这个参数跟下面那个参数差不多,使用这个参数指定的产品的base目录,那么下面的一些组件默认是在base目录之下,安装组件的时候只写base后面的路径即可。
下面一些简单通用的参数,不解释。
* -DCMAKE_INSTALL_PREFIX=dir_name
The installation base directory.
* -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/.zip
packages. This is the default.
+ RPM: Layout similar to RPM packages.
+ SVR4: Solaris package layout.
+ DEB: DEB package layout (experimental).
* -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.
* -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=).
基准测试工具,要运行基准测试,还需要BDB:PERL支持才能用。
* -DINSTALL_SUPPORTFILESDIR=dir_name
Where to install extra support files.
* -DMYSQL_DATADIR=dir_name
The location of the MySQL data directory.
* -DSYSCONFDIR=dir_name
The default my.cnf option file directory.
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.
存储引擎现在都是插件模式了。你也可以把插件编译成静态模块(编译进mysql服务里面,一般就是MYSQLD啦),或动态模块(组件是一个动态库,必须使用INSTALL PLUGIN安装,或使用—plugin-load参数在服务启动的时候装载)。有一些插件可能不支持静态或动态联编。(innodb就不行啦,这个在以前5.1的时候只能动态联编的,当然5.1也有innodb_plugin,5.5就直接是plugin了)
The MyISAM, MERGE, MEMORY, and CSV engines are mandatory (always
compiled into the server) and need not be installed explicitly.
MYISAM,MERGE,MEMORY,CSV是默认被安装的,因此不需要明确指定要安装它们。
Tocompile 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
把存储因为静态编译进服务,使用DWITH_engine_STORAGE_ENGINE=1。可以使用的值有
(就上面的几个了)
Toexclude 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
编译的时候,排除的存储引擎。
Ifneither -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
字符集,不解释。中国一般GBK,双字节。浪费一点UTF8三字节也行。
* -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.
* -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.
* -DENABLE_DEBUG_SYNC=bool
Whether to compile the Debug Sync facility into the server.
This facility is used for testing and debugging. When compiled
in, Debug Sync is disabled by default. 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.
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.
这个参数默认开启,除非mysql编译debug支持,否则也无效。关闭参数是0。
For a description of the Debug Sync facility and how to use
synchronization points, see MySQL Internals: Test
Synchronization
(http://forge.mysql.com/wiki/MySQL_Internals_Test_Synchronizat
ion).
瀑布汗,为了说明这个功能,叫咱去看文档。用来对不熟悉的新版本进行测试的时候非常有用的。
* -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.
* -DENABLED_LOCAL_INFILE=bool
Whether to enable LOAD DATA LOCAL INFILE.
遵循客户端协议从客户端装载数据在服务器上,文件可以在客户端主机。
* -DENABLED_PROFILING=bool
Whether to enable query profiling code (the SHOW PROFILE and
SHOW PROFILES statements).
* -DMYSQL_MAINTAINER_MODE=bool
Whether to enable a MySQLmaintainer-specific development
environment. If enabled, this option causes compiler warnings
to become errors.
编译警告变成错误,终止编译,不应该出现任何警告,但是如果使用gcc版本3.X以上,那么不要开始,否则将无法编译成功。
* -DMYSQL_TCP_PORT=port_num
The port number on on which the server listens for TCP/IP
connections. The default is 3306.
* -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.
* -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.
* -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
Tospecify compiler flags, set the CFLAGS and CXXFLAGS environment
variables. Example:
shell> CFLAGS=-DDISABLE_GRANT_OPTIONS
shell> CXXFLAGS=-DDISABLE_GRANT_OPTIONS
shell> export CFLAGS CXXFLAGS
指定C/C++环境变量
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.
Mysqld将没有—bootstrap,--skip-grant-tables–init-file参数。
* HAVE_EMBEDDED_PRIVILEGE_CONTROL
By default, authentication for connections to the embedded
server is disabled. To enable authentication for the embedded
server, define this flag.
可以开启。建议保持默认
联系客服