本文实例为大家分享了mysql5.6.29的shell脚本,供大家参考,具体内容如下
创建脚本mysql.sh,直接运行sh mysql.sh
#!/bin/bash if [ -d /software ] ;then cd /software else mkdir /software && cd /software fi #is exist command ,if not,yum install is_exist() { which $1 if [ $" " -f 1 ` mysql_md5_true="aaa21c6450adee3a1894fd1710f02bf5" if [ "$mysql_md5" = "$mysql_md5_true" ] ;then tar -zxvf mysql-5.6.29.tar.gz else rm -rf mysql-5.6.29.tar.gz rm -rf mysql-5.6.29 fi else is_exist wget wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.29.tar.gz tar -zxvf mysql-5.6.29.tar.gz fi #see the yum source is use yum cleanup yum makecache #install the depend package yum -y install gcc make cmake ncurses-devel libxml2-devel libtool-ltdl-devel gcc-c++ autoconf automake bison zlib-devel #add mysql group and user is_user_mysql=`cat /etc/passwd |awk -F ":" '{print $1}' |grep mysql` is_group_mysql=`cat /etc/group |awk -F ":" '{print $1}' |grep mysql` if [ "$is_group_mysql" != "mysql" ] ;then groupadd mysql fi if [ "$is_user_mysql" != "mysql" ] ;then useradd -r -s /sbin/nologin -g mysql mysql fi #compile and install cd mysql-5.6.29 cmake . make && make install chown -R mysql.mysql /usr/local/mysql #init database /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data #copy the important file to /etc #cp /usr/local/mysql/my.cnf /etc/my.cnf sed -i 's/\# basedir \= ...../basedir \= \/usr\/local\/mysql/g' /usr/local/mysql/my.cnf sed -i 's/\# port = ...../port = 3306/g' /usr/local/mysql/my.cnf sed -i 's/\# datadir \= ...../datadir \= \/usr\/local\/mysql\/data/g' /usr/local/mysql/my.cnf sed -i '/\[mysqld\]/a\log-error=\/usr\/local\/mysql\/log\/error.log' /usr/local/mysql/my.cnf #sed -i '/\[mysqld\]/a\log=\/usr\/local\/mysql\/log\/log' /usr/local/mysql/my.cnf #sed -i '/\[mysqld\]/a\log-slow-queries=\/usr\/local\/mysql\/log\/slowquery.log' /usr/local/mysql/my.cnf sed -i '/\[mysqld\]/a\long_query_time=2' /usr/local/mysql/my.cnf sed -i '/\[mysqld\]/a\pid-file=\/usr\/local\/mysql\/data\/mysql.pid' /usr/local/mysql/my.cnf sed -i '/\[mysqld\]/a\character-set-server=utf8' /usr/local/mysql/my.cnf echo "[client] " /usr/local/mysql/my.cnf echo "socket = /var/lib/mysql/mysql.sock" /usr/local/mysql/my.cnf /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data #use database /usr/local/mysql/bin/mysqld_safe --user=mysql & cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld chkconfig --add mysqld chkconfig mysqld on `ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock` #start the service service mysqld restart #import environment PATH=$PATH:/usr/local/mysql/bin echo "export PATH=$PATH:/usr/local/mysql/bin /etc/profile" source /etc/profile
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com
暂无评论...
更新日志
2024年12月25日
2024年12月25日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]