安装

#tar zxf mysql-5.6.30.tar.gz

#cd mysql-5.6.30

#cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql/ \
        -DMYSQL_UNIX_ADDR=/opt/mysql/tmp/mysql.sock \
        -DSYSCONFDIR=/opt/mysql/ \
        -DDEFAULT_CHARSET=utf8 \
        -DDEFAULT_COLLATION=utf8_general_ci \
        -DWITH_EXTRA_CHARSETS=all \
        -DWITH_EXTRA_CHARSETS:STRING=all \
        -DWITH_MYISAM_STORAGE_ENGINE=1 \
        -DWITH_INNOBASE_STORAGE_ENGINE=1 \
        -DWITH_INNODB_MEMCACHED=1 \
        -DWITH_DEBUG=OFF \
        -DWITH_ZLIB=bundled \
        -DENABLED_LOCAL_INFILE=1 \
        -DENABLED_PROFILING=ON \
        -DMYSQL_MAINTAINER_MODE=OFF \
        -DMYSQL_DATADIR=/opt/mysql/var \
        -DMYSQL_TCP_PORT=3306

#make && make install

初始化

my.cnf配置文件 my.cnf

#cp ./my.cnf /opt/mysql/

#/opt/mysql/scripts/mysql_install_db \
        --defaults-file=/opt/mysql/my.cnf \
        --basedir=/opt/mysql/ \
        --datadir=/opt/mysql/var \
        --user=mysql

设置启动文件

#cp /opt/mysql/support-files/mysql.server /etc/init.d/mysqld
#chown mysql:mysql -R /opt/mysql
#chmod 700 /etc/init.d/mysqld

设置自自动

echo "/etc/init.d/mysqld"  >> /etc/rc.local