The Helper house has mentioned mysql installation many times, but these are basically installed through rmp or common binary format. This will introduce how to install mysql through source code.
MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF
Install MySQL 5.6 in Linux 5 (RPM Mode)
How to install MySQL 6.4 in RHEL 5.6 (i386)
MySQL installation method and simple configuration in RHEL6.4
1. Local Environment
System |
CentOS release 6.5 (Final) (minimal installation) |
Development Tools |
Development tools Server Platform Development (installed) |
Mysql version |
MySQL-5.6.16-1.el6.src.rpm |
Compilation tool |
Cmake-2.6 (requires installation using yum install cmake) |
Ii. Installation Process Diagram
1. Download the rpm package containing the source code
1 |
# wget http://cdn.mysql.com/archives/mysql-5.6/MySQL-5.6.16-1.el6.src.rpm |
2. Run the rpm command to install
Note:
Xxxxxxxxx. rpm <= RPM: compiled and packaged rpm package. You can directly use rpm-ivh or yum install to install the rpm package ...... Xxxxx. src. rpm <= SRPM format, contains uncompiled source code packaged by rpm, this should be decompressed by rpm-ivh. Then compile the source code.
1 |
#rpm -ivh MySQL-5.6.16-1.el6.src.rpm |
After unpacking, an rpmbuild directory is generated in the home directory of the current user. (Rpmbuild: Create an rpm package as the name suggests. It is a package used to indicate that the conversion source code is compiled into a binary file)
Go to the rpmbuild directory
In rpmbuild, there are two directories: SOURCES and SPECS.
-- SOURCES # path of the source package
-- SPECS # path for storing spec documents
However, we need to use mysql-5.6.16.tar.gz in sources.
3. decompress it using the tar command (you can also copy it to the custom directory to decompress it)
123 |
#mv /root/rpmbuild/SOURCES/mysql-5.6.16.tar.gz /download/ #tar xf /download/mysql-5.6.16.tar.gz #cd /download/mysql-5.6.16 |
Decompress mysql-5.6.16.tar.gz
4. Install cmake
Note:
Since mysql 5.5.8, cmake has been used for compiling and installation of MySQL source code packages. There is no essential difference in the compilation process, but it is much more intuitive.
The method for cmake to specify compilation options is different from that for configure. The implementation methods are as follows:
./Configure cmake.
./Configure -- help cmake.-LH or ccmake.
This option is often used to specify the installation path of the installation file:
-DCMAKE_INSTALL_PREFIX =/usr/local/mysql # specify the installation directory
-DMYSQL_DATADIR =/data/mysql # data file storage location
-DSYSCONFDIR =/etc # configuration file storage directory
By default, the compiled storage engines include csv, myisam, myisammrg, and heap. To install other storage engines, you can use the following compilation options:
-DWITH_INNOBASE_STORAGE_ENGINE = 1 # enable the innodb Storage Engine
-DWITH_ARCHIVE_STORAGE_ENGINE = 1
-DWITH_BLACKHOLE_STORAGE_ENGINE = 1
-DWITH_FEDERATED_STORAGE_ENGINE = 1
To explicitly specify not to compile a storage engine, you can use the following options:
-DWITHOUT _ <ENGINE> _ STORAGE_ENGINE = 1
For example:
-DWITHOUT_EXAMPLE_STORAGE_ENGINE = 1
-DWITHOUT_FEDERATED_STORAGE_ENGINE = 1
-DWITHOUT_PARTITION_STORAGE_ENGINE = 1
If you want to compile it into other functions, such as SSL, you can use the following options to compile a database or not use a database:
-DWITH_READLINE = 1 # shortcut key function
-DWITH_SSL = system # enable security encryption
-DWITH_ZLIB = system
-DWITH_LIBWRAP = 0
Other common options:
-DMYSQL_TCP_PORT = 3306 # Set the listening port
-DMYSQL_UNIX_ADDR =/tmp/mysql. sock # specify the location of the sock File
-DENABLED_LOCAL_INFILE = 1 # Allow Local Data Import
-DEXTRA_CHARSETS = all # Install the extended Character Set
-DDEFAULT_CHARSET = utf8 # Use utf8 characters
-DDEFAULT_COLLATION = utf8_general_ci # Check characters
-DWITH_DEBUG = 0
-DENABLE_PROFILING = 1
For more parameter descriptions, refer to mysql cmake
For more details, please continue to read the highlights on the next page: