编译之前:安装“Development tools”和“Server Platform Development”包组

下载mysql版本:mysql-5.6.17.tar.gz

系统:centos6.4

cat /etc/passwd|grep mysql

groupadd -r mysql

useradd -g mysql -r -s /sbin/nologin -M mysql

mkdir /data/mysqldata -pv

chown -R mysql:mysql /data/mydata

下载mysql编译工具cmake:cmake-3.5.0.tar.gz

tar xf cmake-3.5.0.tar.gz

cd cmake-3.5.0

./configure 

make && make install

tar mysql-5.6.17.tar.gz

cd mysql-5.6.17

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DMYSQL_DATADIR=/data/mydata \

-DSYSCONFDIR=/etc \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_ARCHIVE_STORAGE_ENGINE=1 \

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

-DWITH_READLINE=1 \

-DWITH_SSL=system \

-DWITH_ZLIB=system \

-DWITH_LIBWRAP=0 \

-DWITH_UNIX_ADDR=/tmp/mysql.sock \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci

make && make install

chown -R:mysql /usr/local/mysql

cd /usr/local/mysql/scripts

./mysql_install_db --user=mysql --datadir=/data/mydata

cp support-files/my-large.cnf /etc/my.cnf

cp support-files/mysql.server /etc/init.d/mysqld

vim /etc/profile.d/mysqld.sh

export PATH=$PATH:/usr/local/mysql/bin

. /etc/profile.d/mysqld.sh

echo $PATH

chkconfig --add mysqld

chkconfig --list|grep mysqld

service mysqld start

netstat -tunlp |grep 3306

ps -ef|grep mysqld