码迷,mamicode.com
首页 > 数据库 > 详细

一键安装mysql5.6

时间:2015-09-19 19:39:33      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:

#!/bin/bash
# @Name:install_mysql.sh
# @Author:Eivllom
# @Create time:2015-09-16
# @Modify time:2015-09-16

app_soft="/app/soft" #软件包存放目录

if [ `ls "${app_soft}" |wc -l` -le 0 ];then
    echo 软件包可能还没上传到${app_soft}目录,请检查后再执行脚本!;
    exit 1
fi

echo  "正在安装cmake"
(
cd ${app_soft}
tar zxf cmake-2.8.5.tar.gz 
cd cmake-2.8.5
./configure --prefix=/usr/local/cmake
make && make install
) &> /dev/null && echo cmake安装完成 || exit

export PATH=/usr/local/cmake/bin:$PATH
echo  "正在安装mysql"
(
yum -y install ncurses-devel
groupadd mysql
useradd -s /sbin/nologin -g mysql mysql
cd ${app_soft}
tar zxf mysql-5.6.25.tar.gz
cd mysql-5.6.25
cmake -DCMAKE_INSTALL_PREFIX=/app/mysql -DMYSQL_DATADIR=/app/mysql/data -DMYSQL_UNIX_ADDR=/app/mysql/data/mysql.sock -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_EXAMPLE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=3306 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_USER=mysql -DWITH_DEBUG=0
make && make install
chown -R mysql.mysql /app/mysql
cd /app/mysql/scripts
./mysql_install_db --user=mysql --basedir=/app/mysql --datadir=/app/mysql/data
cd ..
cd support-files/
cp mysql.server /etc/rc.d/init.d/mysql
cp my-default.cnf /etc/my.cnf
chkconfig --add mysql
chkconfig mysql on
/etc/init.d/mysql start
ln -s /app/mysql/bin/* /usr/bin/
) &> /dev/null && echo ‘cmake安装完成‘ || exit

 

一键安装mysql5.6

标签:

原文地址:http://www.cnblogs.com/Eivll0m/p/4821995.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!