1. Download the official source code
2. Compile and install MySQL before you start
sudo yum install gcc gcc-c++ ncurses-devel perl-y
3. Compile and install CMake
Tar xzvf cmake-3.0.2.tar.gz
CD cmake-3.0.2
./bootstrap
Make
Make install
4. Adding MySQL Users and Groups
sudo useradd MYSLQ
5. Create the required directory for MySQL
Mkdir-p/usr/local/mysql
Mkdir-p/data/mysqldb
Chmod-r Mysql:mysql/usr/local/mysql
Chmod-r Mysql:mysql/data/mysqldb
6. Compile and install MySQL
compilation Options |
Option Description |
-dcmake_install_prefix=dir_name |
Setting up the MySQL installation directory |
-dmysql_unix_addr=file_name |
Set the listener socket path |
-ddefault_charset=charset_name |
Set the character set of the server |
-ddefault_collation=collation_name |
Set the collation of the server |
-dmysql_datadir=dir_name |
Set the MySQL database file directory |
-dmysql_tcp_port=port_num |
To set the port for a listening socket |
Tar-zxv-f mysql-5.6.22.tar.gz
CD mysql-5.6.22
Cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_unix_addr=mysql.mysql-ddefault_charset=gbk-ddefault_ Collation=gbk_chinese_ci-dwith_innobase_storage_engine=1-dwith_archive_storage_engine=1-dwith_blackhole_ Storage_engine=1-dmysql_datadir=/data/mysqldb-dmysql_tcp_port=3306-denable_downloads=1
Make && make install
Cd/usr/local/mysql
7. Copy the configuration file and startup script for the MySQL service
scripts/mysql_install_db--user=mysql--datadir=/data/mysqldb CP support-files/mysql.server/etc/init.d/mysqld
CP/USR/LOCAL/MYSQL/SUPPORT-FILES/MY-DEFAULT.CNF/ETC/MY.CNF CP Support-files/mysql.server/etc/init.d/mysqld
Vim/etc/profile
path=/usr/local/mysql/bin:/usr/local/mysql/lib:/$PATH
Export PATH
Source/etc/profile
Start Mysql:service mysqld Start
Join boot: chkconfig--level mysqld on
This article is from the "Ops Boy" blog, please make sure to keep this source http://kaliroot.blog.51cto.com/8763915/1875576
Centos 6.6 Compile and install MySQL-5.6.23