香港云主机最佳企业级服务商!

ADSL拨号VPS包含了中国大陆(联通,移动,电信,)

中国香港,国外拨号VPS。

当前位置:云主机 > MYSQL >

电信ADSL拨号VPS
联通ADSL拨号VPS
移动ADSL拨号VPS

Centos7安装 mysql5.6.29 shell脚本


时间:2020-11-03 13:28 作者:admin610456


本文实例为大家分享了mysql/' target='_blank'>mysql5.6.29的shell脚本,供大家参考,具体内容如下

创建脚本MySQL.sh,直接运行sh mysql.sh

#!/bin/bashif [ -d /software ] ;then  cd /softwareelse  mkdir /software && cd /softwarefi#is exist command ,if not,yum installis_exist() {  which $1  if [ $? -ne 0 ] ;then     yum -y install $1  fi}#dolownad the mysql install package,if exist,check the md5sum,if correct,tar;else rm and downloadif [ -f mysql-5.6.29.tar.gz ] ;then  mysql_md5=`md5sum mysql-5.6.29.tar.gz | cut -d " " -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  fielse  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.gzfi#see the yum source is useyum cleanupyum makecache#install the depend packageyum -y install gcc make cmake ncurses-devel libxml2-devel libtool-ltdl-devel gcc-c++ autoconf automake bison zlib-devel#add mysql group and useris_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 mysqlfiif [ "$is_user_mysql" != "mysql" ] ;then   useradd -r -s /sbin/nologin -g mysql mysqlfi#compile and installcd mysql-5.6.29cmake .make && make installchown -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.cnfsed -i 's/\# basedir \= ...../basedir \= \/usr\/local\/mysql/g' /usr/local/mysql/my.cnfsed -i 's/\# port = ...../port = 3306/g' /usr/local/mysql/my.cnfsed -i 's/\# datadir \= ...../datadir \= \/usr\/local\/mysql\/data/g' /usr/local/mysql/my.cnfsed -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.cnfsed -i '/\[mysqld\]/a\long_query_time=2' /usr/local/mysql/my.cnfsed -i '/\[mysqld\]/a\pid-file=\/usr\/local\/mysql\/data\/mysql.pid' /usr/local/mysql/my.cnfsed -i '/\[mysqld\]/a\character-set-server=utf8' /usr/local/mysql/my.cnfecho "[client] " >> /usr/local/mysql/my.cnfecho "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/mysqldchkconfig --add mysqldchkconfig mysqld on`ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock`#start the serviceservice mysqld restart#import environmentPATH=$PATH:/usr/local/mysql/binecho "export PATH=$PATH:/usr/local/mysql/bin >> /etc/profile"source /etc/profile

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。

(责任编辑:admin)






帮助中心
会员注册
找回密码
新闻中心
快捷通道
域名登录面板
虚机登录面板
云主机登录面板
关于我们
关于我们
联系我们
联系方式

售前咨询:17830004266(重庆移动)

企业QQ:383546523

《中华人民共和国工业和信息化部》 编号:ICP备00012341号

Copyright © 2002 -2018 香港云主机 版权所有
声明:香港云主机品牌标志、品牌吉祥物均已注册商标,版权所有,窃用必究

云官方微信

在线客服

  • 企业QQ: 点击这里给我发消息
  • 技术支持:383546523

  • 公司总台电话:17830004266(重庆移动)
  • 售前咨询热线:17830004266(重庆移动)