zoukankan      html  css  js  c++  java
  • mysql安装脚本

     #!/bin/bash

    set -x
    src="/home/software"
    tgt="/usr/local"
    install_file="/home/software/install_file.log"
    error_file="/home/software/error_file.log"

    makeinstall(){
    [ $1 -ne 0 ] && tail -30 $install_file |tee -a $error_file && exit 1;
    make >>$install_file 2>&1
    [ $1 -ne 0 ] && tail -30 $install_file |tee -a $error_file && exit 1;
    make install >>$install_file 2>&1
    [ $1 -ne 0 ] && tail -30 $install_file |tee -a $error_file && exit 1;

    }

    install(){

    #install cmake
    cd $src
    touch {install_file,error_file}.log
    tar zxvf cmake-2.8.12.1.tar.gz >>$install_file 2>&1
    cd cmake-2.8.12.1
    ./bootstrap >>$install_file 2>&1
    makeinstall $?


    #install mysql
    yum -y install ncurses* >>$install_file 2>&1
    cd $src
    tar zxvf mysql-5.5.35.tar.gz
    cd  mysql-5.5.35
    $src/cmake-2.8.12.1/bin/cmake -DCMAKE-INSTALL-PRIFIX=/usr/local/mysql -DDEFAULT-CHARSET=utf8 >>$install_file 2>&1
    makeinstall $?

    cp -f support-files/my-large.cnf /etc/my.cnf >>$install_file 2>&1
    cp support-files/mysql.server  /etc/init.d/mysqld >>$install_file 2>&1
    chmod 755 /etc/init.d/mysqld
    useradd mysql >>$install_file 2>&1

    cd /usr/local/mysql/  >>$install_file 2>&1

    chown -R mysql:mysql *   >>$install_file 2>&1

    ./scripts/mysql_install_db  --user=mysql  >>$install_file 2>&1

    chown -R root *  >>$install_file 2>&1

    chown -R mysql data >>$install_file 2>&1

    echo "/usr/local/mysql/bin/mysqld_safe &" >> /etc/rc.local

    service mysqld start

    }

    install

    但行好事,莫问前程。
  • 相关阅读:
    c-指针
    iOS 多线程
    iOS 必备技术点
    网络请求
    objective-c基础教程——学习小结
    id类型
    排序算法
    iOS网络
    iOS 绘图
    Python——字符串2.0(实验)(python programming)
  • 原文地址:https://www.cnblogs.com/txhy/p/10643878.html
Copyright © 2011-2022 走看看