先用yum把依賴包都安裝,最好在yum update一下升級系統。關閉selinux。mysql
yum -y install ntp vim-enhanced vixie-cron gcc gcc-c++ gcc-g77 flex bison autoconf automake glibc make gmake \
glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libtool* zlib-devellinux
建立mysql用戶和組c++
groupadd -g 501 mysql
/usr/sbin/useradd -u 501 -g mysql -c "MySQL Server" mysql -s /sbin/nologinsql
先安裝cmake數據庫
tar zxf cmake-2.8.8.tar.gz
cd cmake-2.8.8
./bootstrap
make -j8 && make install 或者gmakebootstrap
安裝 bison-2.5
cd bison-2.5
./configure
make -j8 && make install 或者gmakevim
tar zxf mysql-5.6.25.tar.gzflex
cd mysql-5.6.25
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.6.25
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=all \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_INNODB_MEMCACHED=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_FAST_MUTEXES=1 \
-DWITH_ZLIB=bundled \
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_DEBUG=0server
make -j8 && make installip
chmod +w /usr/local/mysql-5.6-25
chown -R mysql:mysql /usr/local/mysql-5.6-25
mkdir -p /database/mysql/3306/{data,logs/{binlog,relaylog}}
chown -R mysql:mysql /data/mysql/
my.cnf配置文件,在下一章mysql基本配置的時候,貼上。
cat > /data/mysql/3306/my.cnf<<EOF
初始化數據庫
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/database/mysql/3306/data --user=mysql --defaults-file=/database/mysql/3306/my.cnf
cp mysql.server /etc/init.d/mysqld
chmod 500 /etc/init.d/mysqld
chkconfig mysqld on
server mysqld start