This article describes how to compile and install MySQL5.6.26 in RHEL6.5. For more information, see
1. prepare the compiling environment and install the required dependent packages
Yum groupinstall 'development '-y
Yum install openssl-devel zlib-devel-y
Yum install readline-devel pcre-devel ncurses-devel bison-devel cmake-y
II. compilation and installation
1. use cmake for Compilation. the cmake compilation method is different from make. the comparison is as follows:
Make:
./Configure
./Configure -- help
Cmake:
Cmake.
Cmake.-LH or ccmake.
2. compilation options
Specify common installation path options
-DCMAKE_INSTALL_PREFIX =/usr/local/mysql
-DMYSQL_DATADIR =/data/mysql
-DSYSCONFDIR =/etc
Storage Engine configuration:
-DWITH_INNOBASE_STORAGE_ENGINE = 1
-DWITH_ARCHIVE_STORAGE_ENGINE = 1
-DWITH_BLACKHOLE_STORAGE_ENGINE = 1
-DWITH_FEDERATED_STORAGE_ENGINE = 1
To explicitly specify not to compile an engine, you can use a command similar to the following:
-DWITHOUT _ _ STORAGE_ENGINE = 1
To compile other functions, such as SSL, you can use the following options to compile a function or not use it:
-DWITH_READLINE = 1
-DWITH_SSL = system
-DWITH_ZLIB = system
-DWITH_LIBWRAP = 0
Other common options:
-DMYSQL_TCP_PORT = 3306
-DMYSQL_UNIX_ADDR =/tmp/mysql. sock
-DENABLED_LOCAL_INFILE = 1
-DEXTRA_CHARSETS = all
-DDEFAULT_CHARSET = utf8
-DDEFAULT_COLLATION = utf8_general_ci
-DWITH_DEBUG = 0
-DENABLE_PROFILING = 1
For specific compilation options, refer to the official documentation http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html
To clear the files generated after compilation, run the make clean command.
After compilation, you can install make & make install.
3. configure MySQL
1. provide an account for MySQL to run processes securely and modify the main group of the MySQL installation directory
Useradd-r-s/sbin/nologin-M mysql
Chown-R mysql: mysql/usr/local/mysql/
2. initialize MySQL
MYSQL _ $ HOME/scripts/mysql_install_db -- user = mysql -- basedir =/usr/lolinoleic/mysql -- datadir =/usr/local/mysql/data
3. provide the primary configuration file for MySQL
Cp support-files/my-default.cnf/etc/my. cnf
4. provide the sysv service script for MySQL and add it to the service startup list.
Cp support-files/mysql. server/etc/rc. d/init. d/mysqld
Chkconfig -- add mysqld
Chkconfig mysqld on
Chkconfig -- list mysqld
5. add the MySQL MAN manual to the MAN search path and modify/etc/man. conf to add
MANPAN/usr/local/mysql/man
6. output the MySQL header file to the system header file path
Ln-sv/usr/local/mysql/include // usr/include/mysql
7. output the MySQL database file to the system search path and reload the system database
Echo '/usr/local/mysql/lib'>/etc/ld. so. conf. d/mysql. conf
Ldconfig
8. modify environment variables and add them to MySQL. edit/etc/profile to add paths and reload them.
Export PATH = "$ PATH:/usr/local/mysql/bin"
Source/etc/profile
9. start MySQL
Service mysqld start
The above content is the RHEL6.5 compilation and installation of MySQL5.6.26 tutorial shared by Alibaba Cloud.