Centos7安装mysql -- 脚本实现

 Mysql安装

             安装所需依赖  ncurses ncurses-devel gcc-c++ bison cmake

             此处为了简单利用yum安装即可。yum install ncurses ncurses-devel gcc-c++ bison cmake -y

    源码安装  

           1.利用wget下载

                      wget -c http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.46.tar.gz

           2.解压

                      tar -zxvf mysql-5.5.46.tar.gz

           3.安装编译(此处使用cmake编译,具体参数根据自己需求设置即可。)

                     cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql

           4. Make&&make install

                     make -j2 && make install -j2

           5. 配置(my.cnf)

                     根据需求配置即可

           6.重启服务

                     service mysql start

    脚本实现

#/bin/bash
#describe: install mysql
#author: kan

if [ -s /etc/my.cnf ]; then
    mv /etc/my.cnf /etc/my.cnf.bak
    mv /etc/my.cnf.d /etc/my.cnf.d.bak
fi

# this applies to the installation of yum
:<

你可能感兴趣的:(centos7)