Install the full version of MySQL source code in Linux
Install MySQL in Linux, usually by using RPM and source code. For the production environment, you need to customize the installation path, data file location, Character Set, and supported storage engines by using the source code for installation. I have written an article about source code installation. in Linux, MySQL 5.6 () is installed based on the source code, but it is not complete. Therefore, this article can be used as a supplement. The installation steps are as follows.
1. description before installation
Essential packages and tools
Gcc/g ++: MySQL 5.6 starts and needs to be compiled using g ++.
Cmake: Start with MySQL 5.5 and use cmake for project management. cmake requires version 2.8 or later.
Bison: MySQL syntax parser must use bison for compilation.
Ncurses-devel: A Development Kit for terminal operations.
Zlib: MySQL uses zlib for compression
Feature package
Libxml: used for XML input/output.
Openssl: Use openssl Secure Sockets for communication.
Dtrace: used to diagnose MySQL problems.
MySQL compilation Parameters
Version types compiled by CMAKE_BUILD_TYPE: RelWithDebInfo and Debug. The difference is that RelWithDebInfo will be optimized.
CMAKE_INSTALL_PREFIX specifies the target path of the make install installation.
SYSCONFDIR specifies the default path of the configuration file.
MYSQL_DATADIR specifies the default path of the data directory.
WITH_DEBUG specifies whether debugging information exists. It is generally used for source code debugging. When WITH_DEBUG is enabled, the production environment is closed.
ENABLED_PROFILING specifies whether to use show profile to display detailed information about the operation execution.
DEFAULT_CHARSET specifies the default character set, which can be specified in the startup configuration file.
DEFAULT_COLLATION specifies the default character comparison and sorting rules.
WITH_EXTRA_CHARSETS specify other character sets that may be used.
WITH_SSL specifies the SSL type. The default bundled type starts from 5.6.6. You can also specify the path address of the SSL library.
WITH_ZLIB specifies the zlib type for compression.
ENABLED_LOCAL_INFILE specifies whether to allow the load data infile function.
WITH_EMBEDDED_SERVER specifies whether to compile the libmysqld embedded library.
INSTALL_LAYOUT specifies the layout type of the installation.
WITH_storage_STORAGE_ENGINE specifies the storage engine supported by compilation. By default, the storage engine MyISAM, MERGE, MEMORY, and CSV are supported.
For more detailed parameters, see http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html
This installation environment
[Root @ SZ-RD03 ~] # Cat/etc/issue
CentOS release 5.9 (Final)
Kernel \ r on an \ m
[Root @ SZ-RD03 ~] # Uname-
Linux SZ-RD03 2.6.18-348. el5 #1 SMP Tue Jan 8 17:53:53 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
MySQL version: 5.6.12-log Source distribution
Installation Directory:/app/soft/mysql/
Data Directory:/data/mysqldata
Storage engines include MEMORY, MyISAM, and InnoDB.
Character Set: UTF8
2. Install MySQL with source code
Install the required libraries first:
Yum-y install gcc-c ++
Yum-y install ncurses-devel
Download the required software package:
# Put all downloaded files in the/usr/local/src directory, as shown below:
# Cd/usr/local/src
# Wget http://www.cmake.org/files/v2.8/cmake-2.8.11.1.tar.gz
# Wget http://ftp.gnu.org/gnu/bison/bison-2.7.tar.gz
# Wget http://ftp.gnu.org/gnu/m4/m4-1.4.16.tar.gz
# Wget http://www.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.12.tar.gz/from/http://cdn.mysql.com/
Install the cmake Compiler
# Cd/usr/local/src
# Tar-xvf cmake-2.8.11.1.tar.gz
# Cd cmake-2.8.11.1
#./Bootstrap
# Make & make install
Install m4
# Cd/usr/local/src
# Tar-xvf m4-1.4.16.tar.gz
# Cd m4-1.4.16
#./Configure & make install
Install bison
# Cd/usr/local/src
# Tar-xvf bison-2.7.tar.gz
# Cd bison-2.7
#./Configure & make install
Create mysql users and groups and related directories
#/Usr/sbin/groupadd mysql
#/Usr/sbin/useradd-g mysql
# Mkdir-p/app/soft/mysql
# Chown-R mysql: mysql/app/soft/mysql
# Mkdir-p/data/mysqldata
# Chown-R mysql: mysql/data/mysqldata/
Install mysql
# Cd/usr/local/src
# Tar-xvf mysql-5.6.12.tar.gz
# Export CFLAGS = "-O3-g-fno-exceptions-static-libgcc-fno-omit-frame-pointer-fno-strict-aliasing"
# Export CXXFLAGS = "-O3-g-fno-tions-fno-rtti-static-libgcc-fno-omit-frame-pointer-fno-strict-aliasing"
# Export CXX = g ++
# Cd mysql-5.6.12
# Cmake-DCMAKE_INSTALL_PREFIX =/app/soft/mysql/-DMYSQL_UNIX_ADDR =/tmp/mysql. sock
-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-DWITH_EXTRA_CHARSETS = utf8, gbk
-DWITH_PERFSCHEMA_STORAGE_ENGINE = 1-DWITH_FEDERATED_STORAGE_ENGINE = 1-DWITH_PARTITION_STORAGE_ENGINE = 1
-DWITH_ARCHIVE_STORAGE_ENGINE = 1-DMYSQL_DATADIR =/data/mysqldata/-DSYSCONFDIR =/app/soft/mysql/
-DWITH_SSL = bundled-DENABLED_LOCAL_INFILE = 1-DWITH_INNOBASE_STORAGE_ENGINE = 1
-DWITH_BLACKHOLE_STORAGE_ENGINE = 1-DENABLE_DOWNLOADS = 1
# Make & make install
Initialize Database
# Cd/app/soft/mysql/
#./Scripts/mysql_install_db -- user = mysql -- ldata =/data/mysqldata
3. finishing work after installation
Configure the runtime environment
# Vi/etc/profile
# PATH =/app/soft/mysql/bin:/app/soft/mysql/lib: $ PATH
# Export PATH
# Source/etc/profile
Create boot start
# Cp support-files/my-default.cnf/etc/my. cnf # You can also copy my. cnf directly to the location of the Installation File
# Cp support-files/mysql. server/etc/init. d/mysqld
# Chkconfig -- level 35 mysqld on
# Service mysqld start
Check whether startup is successful
Netstat-ntlp | grep mysql
Set root Password
# Mysqladmin-u root password 'xxx'
Login Account
# Mysql-uroot-pxxx
Configuration parameters
Configure the my. cnf file according to system and business requirements
-------------------------------------- Split line --------------------------------------
Install MySQL in Ubuntu 14.04
MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF
Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL
Build a MySQL Master/Slave server in Ubuntu 14.04
Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS
Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04
MySQL-5.5.38 universal binary Installation
-------------------------------------- Split line --------------------------------------
This article permanently updates the link address: