centos6.5上mysql5.6源码安装

先用yum把依赖包都安装,最好在yum update一下升级系统。关闭selinux。

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-devel

创建mysql用户和组

groupadd -g 501 mysql
/usr/sbin/useradd -u 501 -g mysql -c "MySQL Server" mysql -s /sbin/nologin

先安装cmake

tar zxf cmake-2.8.8.tar.gz
cd cmake-2.8.8
./bootstrap
make -j8 && make install 或者gmake

安装 bison-2.5
cd bison-2.5
./configure
make -j8 && make install 或者gmake

tar zxf mysql-5.6.25.tar.gz

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=0

make -j8 && make install

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

你可能感兴趣的:(centos6.5上mysql5.6源码安装)