MySQL Source code installation elaborate

Source: Internet
Author: User
Tags memcached mysql in readline

MySQL provides us with three ways to install: binary, RPM, source code compilation. Here we discuss in detail the MySQL source code compilation installation method.

After the 5.5 release, MySQL no longer provides configure compilation, instead using the CMake compilation tool, a notable feature of the CMake tool is that it compiles independently of the source code, that is, we can use CMake to compile MySQL in a directory other than the source code, such as

[Email protected] tmp]# Ls-l | grep mysqldrwxr-xr-x  2 root root         4096 April  21:11 mysql2drwxr-xr-x 7161 wheel        4096 March  03:07 mysq l-5.6.17-rw-r--r--  1 Easy oinstall 32862539 April  20:52 mysql-5.6.17.tar.gzdrwx------  2 Easy Oinstall     4096 April  22:43 mysql-workbench.easy[[email protected] tmp]# CD Mysql2[[email protected] mysql2]# cmake. /mysql-5.6.17

This allows us to compile the source files multiple times in different directories without affecting each other.

With CMake, you can get all the compilation options through-lah

[Email protected] mysql1]# CMake. /mysql-5.6.17-lah--Running cmake version 2.6.4--mysql 5.6.17--packaging as:mysql-5.6.17-linux-x86_64--Have_visibili ty_hidden--have_visibility_hidden--have_visibility_hidden--Using cmake version 2.6.4--not building ndb--Library mysq Lclient depends on oslibs-lpthread;m;rt;dl--Library MySQLServer depends on oslibs-lpthread;m;rt;crypt;dl;aio--Configu Ring done--generating done--Build files has been written to:/tmp/mysql1--Cache values//path to the executableaclocal _executable:filepath=/usr/bin/aclocal.....//Missing descriptionwith_zlib:string=bundled


If you want to clear the compilation information, you can use the following command:

[[email protected] mysql1]# make Clean[[email protected] mysql1]# RM CMakeCache.txt RM: Delete normal file "CMakeCache.txt"? Y

Compile options:

Some of the options used to specify the path to the executable file used during compilation, such as Aclocal_executable:filepath=/usr/bin/aclocal, can be researched by themselves and no longer described here.


-dbuild_config=mysql_release
With this option, the compiler can be prompted to compile the program in accordance with the Oracle Generation official version option, for example:

Cmake-dbuild_config=mysql_release

?
-dcmake_build_type=type
This option has two selection values
? Relwithdebinfo: Default value, enable optimizations, and generate debug information
? Debug: Disable optimizations and generate debug information, same effect as-dwith_debug=1
?
-dcpack_monolithic_install=bool

This option affects the behavior of the make package operation and, if set to true, generates a single file, or multiple files are generated. The default is to generate multiple files


The Cmake_install_prefix option indicates the base installation directory. Other options with
Names of the form install_xxx that indicate component locations is interpreted relative to the
Prefix and their values are relative pathnames. Their values should not include the prefix.
?
-dcmake_install_prefix=dir_name

This option specifies the installation directory for MySQL, and in addition to specifying this value at compile time, we can also use--basedir to set the base directory at MySQL startup. At compile time, the option of install_xxx format is relative to the prefix relative path, which is a point to note
?
-dinstall_bindir=dir_name
Directory of bin Files
?
-dinstall_layout=name
Using the pre-defined file layout, we can manually set the location of some directories on the basis of these layouts.
? 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).
As follows
Shell> CMake. -dinstall_layout=svr4-dmysql_datadir=/var/mysql/data
?
-dinstall_mysqltestdir=dir_name
Where to install the Mysql-test directory. As of MySQL 5.6.12, to suppress installation of this
directory, explicitly set the option to the empty value (-dinstall_mysqltestdir=).
?
-dinstall_sqlbenchdir=dir_name
Where to install the Sql-bench directory. To suppress installation of this directory, explicitly set the
option to the empty value (-dinstall_sqlbenchdir=).
?
-dmysql_datadir=dir_name
Specify the location of the data file, or you can use--datadir to set it after installation


?
-dodbc_includes=dir_name
The location of the ODBC includes directory, and May is used while configuring CONNECTOR/ODBC. (may be used when configuring ODBC)
?
-dodbc_lib_dir=dir_name
The location of the ODBC Library directory, and May is used while configuring CONNECTOR/ODBC.
?
-dsysconfdir=dir_name
The default my.cnf option file directory. This location cannot is set at server startup, but 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.


When compiling MySQL, we can specify how to compile the storage engine into MySQL: Static compilation and dynamic compilation. It is considered more efficient for statically compiled servers.

By default MyISAM, MERGE, memory, CSV four storage engines are required and are statically compiled into the server. If we need to statically compile other storage engines, we can use the following parameters

-dwith_engine_storage_engine=1

The engine here can be valued archive, Blackhole, EXAMPLE, Federated, Innobase,ndb or Ndbcluster (NDB), PARTITION (partitioning support), and Perfschema (performance Schema).

We can also show the exclusion of some kind of storage engine, such as

-dwithout_engine_storage_engine=1.

If there is no display ingestion or exclusion for an engine, MySQL compiles the engine into a shared module and excludes the engine if it cannot be compiled into a shared module.


-ddefault_charset=charset_name

Specifies the default character set for the database, and the value of the character set can be found under Cmake/charset-sets.cmake

-ddefault_collation=collation_name

Specifies how the database is sorted, can be specified by the--collation_server option when the database is started, and can be viewed with the show collation command for optional sorting

-denable_debug_sync=bool

The Sync debugging feature that is used to turn on MySQL, which is turned on by default, but only when MySQL is configured to enable debugging. This feature is enabled, it is also turned off at run time, the--DEBUG-SYNC-TIMEOUT=N option is required to start the MySQL server, the default n is 0, that is, the function is disabled, and if n is greater than 0, synchronous debugging will wait for n time units, otherwise it will time out.

?
-denable_downloads=bool
Used to download some optional files, such as Google's Test branch.

-denable_dtrace=bool
Whether to enable DTrace
?
-denable_gcov=bool
Whether to include Gcov support (Linux only).
?
-denable_gprof=bool
Whether to enable Gprof (optimized Linux builds only). This option is added in MySQL 5.6.6.
?
-denabled_local_infile=bool
The MySQL client has the function of load data infile, which has security implications,

?
-denabled_profiling=bool
Whether the profiling feature is enabled, recommended for performance monitoring


?
-dignore_aio_check=bool
If the-dbuild_config=mysql_release option is given on Linux, the Libaio library must be
Linked in by default. If you don't have Libaio or does not want to install it, you can suppress the
Check for it by Specifying-dignore_aio_check=1. This option is added in MySQL 5.6.1.
?
-dinnodb_page_atomic_ref_count=bool
Whether to enable or disable atomic page reference counting. Fetching and releasing pages from the buffer pool and tracking, the page state is expensive and complex operations. Using a page
Mutex to track these operations does no scale well. With Innodb_page_atomic_ref_count=on (default), fetch and release are tracked using Atomics where available. For platforms that does not
Support Atomics, set Innodb_page_atomic_ref_count=off to disable ATOMIC PAGE reference counting.
When atomic page reference counting is enabled (default), "[Note] innodb:using Atomics
To ref count buffer pool pages "is printed to the error log at server startup. If Atomic page reference counting is disabled, ' [Note] innodb:using mutexes to ref count buffer pool pages ' is printed in Stead.
This build option is introduced with the fix for MySQL Bug #68079.
?
-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 which the server listens for TCP/IP connections. The default is 3306. This value can is 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 is an absolute path name. The default Is/tmp/mysql.sock.
This value can is set at server startup with the--socket option.

?
-doptimizer_trace=bool
Whether to support optimizer tracing. See MySQL internals:tracing the Optimizer. This option is added in MySQL 5.6.3.
?
-dwith_asan=bool
Whether to enable Addresssanitizer, for compilers. The default is off. This option is added in MySQL 5.6.15.
?
-dwith_debug=bool
Whether to include debugging support.
Configuring MySQL with debugging support enables the--debug= "d,parser_debug" option when you start the server. This causes the Bison parser that's used to process SQL statements to dump a parser trace to the server's standard error Output. Typically, this output was written to the error log.

?
-dwith_default_feature_set=bool
Whether to use the flags from Cmake/build_configurations/feature_set.cmake. This
option is added in MySQL 5.6.6.
?
-dwith_editline=value
Which Libedit/editline library to use. The permitted values are bundled (the default) and
System.
With_editline is added in MySQL 5.6.12. It replaces With_libedit, which has been
removed.
?
-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_innodb_memcached=bool
Whether to generate memcached shared libraries (libmemcached.so and innodb_engine.so).

?
-dwith_libevent=string
Which Libevent library to use. Permitted values is bundled (default), System, and yes. If
You specify system or Yes and the system Libevent Library is used if present. If The System library
Is isn't found, the bundled Libevent library is used. The Libevent library is required by InnoDB
Memcached.

-dwith_libedit=bool
Whether to use the Libedit library bundled with the distribution.
With_libedit is removed in MySQL 5.6.12. Use With_editline instead.
?
-dwith_libwrap=bool
Whether to include libwrap (TCP wrappers) support.
?
-dwith_readline=bool
Whether to use the ReadLine library bundled with the distribution. This option is removed in
MySQL 5.6.5 because ReadLine is no longer bundled.

?
-dwith_unixodbc=1
Enables UnixODBC support, for CONNECTOR/ODBC.

?
-dwith_zlib=zlib_type
Some features require that the server is 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.
?
-dwithout_server=bool
Whether to build without the MySQL server. The default is OFF, which does build the server.



Knowing the meaning of each option, you can perform the installation

# preconfiguration setupshell> groupadd mysqlshell> useradd-r-G MySQL mysql# Beginning of Source-build specific in Structionsshell> tar zxvf mysql-version.tar.gzshell> cd mysql-versionshell> cmake .shell> makeshell> Make install# End of Source-build specific instructions# postinstallation setupshell> cd/usr/local/mysqlshell> cho wn-r MySQL .shell> chgrp-r mysql .shell> scripts/mysql_install_db--user=mysqlshell> chown-r root .shell> C Hown-r MySQL datashell> bin/mysqld_safe--user=mysql Next command is optionalshell> CP SUPPORT-FILES/MYSQL.S Erver/etc/init.d/mysql.server


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.