mysql5.6.28自动安装shell脚本,为了包装源码包的可靠性,请自行下载mysql-5.6.28.tar.gz,接着我就不说废话,附上自动安装脚本。#!/bin/bash
#author abao http://www.xubaojin.com
yum remove -y mysql mysql-server
clear
echo 'This shell will Auto Install Mysql5.6.28'
yum install cmake ncurses-devel lrzsz gcc-c++ -y
rz
tar -xf mysql-5.6.28.tar.gz -C /usr/local/src && cd /usr/local/src/mysql-5.6.28
useradd -M -s /sbin/nologin mysql
mkdir /usr/local/mysql
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_MYISAM_STORAGE_ENGINE=1\
-DWITH_INNOBASE_STORAGE_ENGINE=1\
-DWITH_MEMORY_STORAGE_ENGINE=1\
-DWITH_READLINE=1\
-DENABLED_LOCAL_INFILE=1\
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DMYSQL-USER=mysql
make -j 4 && make install
chown -R mysql:mysql /usr/local/mysql
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
mv /etc/my.cnf /etc/my.cnf.bak
cp -r /usr/local/src/mysql-5.6.28/support-files/my-default.cnf /etc/my.cnf
sed -i '/^\[mysqld\]/adatadir = /usr/local/mysql/data' /etc/my.cnf
sed -i '/^\[mysqld\]/abasedir = /usr/local/mysql' /etc/my.cnf
cp -r /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
echo "PATH=/usr/local/mysql/bin:$PATH" >>/etc/profile
service mysqld restart
echo
echo "install success"
source /etc/profile
echo "source /etc/profile" >>/etc/rc.local
service mysqld restart
chkconfig mysqld on
echo "If you now running mysql and others commands,Please running: source /etc/profile"
到此您就安装成功,建议重启测试效果,谢谢![root@centos67-169 ~]# mysql -V
mysql Ver 14.14 Distrib 5.6.28, for Linux (x86_64) using EditLine wrapper