1.安装依赖
[root@db01 ~]# yum install -y gcc gcc-c++ automake autoconf
[root@db01 ~]# yum -y install cmake bison-devel ncurses-devel libaio-devel
2.预编译
[root@db01 ~]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.6.40 \
> -DDEFAULT_CHARSET=utf8 \
> -DDEFAULT_COLLATION=utf8_general_ci \
> -DWITH_EXTRA_CHARSETS=all \
> -DWITH_INNOBASE_STORAGE_ENGINE=1 \
> -DWITH_FEDERATED_STORAGE_ENGINE=1 \
> -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
> -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
> -DWITH_ZLIB=bundled \
> -DWITH_SSL=bundled \
> -DENABLED_LOCAL_INFILE=1 \
> -DWITH_EMBEDDED_SERVER=1 \
> -DENABLE_DOWNLOADS=1 \
> -DWITH_DEBUG=0
3.编译&&安装
[root@db01 ~]# make && make install
4.安装后进行操作
[root@db01 ~]# useradd -s /sbin/nologin mysql -M
[root@db01 ~]# ln -s /usr/local/mysql-5.6.40/ /usr/local/mysql
[root@db01 ~]# chown -R mysql.mysql /usr/local/mysql/
5.初始化数据
[root@db01 ~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
[root@db01 ~]# \cp support-files/my-default.cnf /etc/my.cnf
[root@db01 ~]# cp support-files/mysql.server /etc/init.d/mysqld
[root@db01 ~]# vim /etc/profile
export PATH=/usr/local/mysql/bin:$PATH (文件末尾添加)
6.启动
[root@db01 ~]# /etc/init.d/mysqld start