Statement
The Stars last night
Blog:http://yestreenstars.blog.51cto.com/
This article by oneself creation, if need reprint, please indicate source, thank cooperation!
Objective
One-click Automation to install MySQL server.
Environment
Os:centos 6.2 32
mysql:5.6.20
Configuration
#!/bin/bash# script name: one-key automatic install mysql server# Author: yestreenstars# create time: 2014-08-18mysql_user_root_password= "Redhat" CMAKE_ install_prefix= "/usr/local/mysql" mysql_datadir= "/wwwroot/data" default_charset= "UTF8" default_collation= "utf8_ General_ci "echo -n "--installing related software ... "YUM -Y INSTALL GCC gcc-c++ make cmake bison ncurses-devel unzip wget perl > /dev/null 2>&1 && echo "completed!" echo -n "--installing mysql-server ..." (useradd -m -s /sbin/nologin mysqlmkdir -p $MYSQL _datadirchown -r mysql:mysql $MYSQL _datadirwget -p /tmp / http://dev.mysql.com/get/downloads/mysql-5.6/mysql-5.6.20.tar.gztar xzf /tmp/ Mysql-5.6.20.tar.gz -c /usr/src/cd /usr/src/mysql-5.6.20/cmake -dcmake_install_prefix= $CMAKE _install_prefix -dmysql_datadir= $MYSQL _datadir -ddefault_charset= $DEFAULT _ charset -ddefault_collation= $DEFAULT _collationmakemake install) > /dev/null 2> &1 && echo "completed!" echo -n "--initializing ..." (Cd /usr/local/mysql/./scripts/mysql_install_db --user=mysql --basedir= $CMAKE _install_prefix --datadir= $MYSQL _datadir/bin/cp -f $PWD/support-files/ mysql.server /etc/init.d/mysqld/bin/cp -f $PWD/support-files/my-default.cnf /etc/ my.cnfecho "Path= $CMAKE _install_prefix/bin/: $PATH" >> /etc/profilechkconfig --add mysqldchkconfig mysqld onservice mysqld start$cmake_install_prefix/bin/mysqladmin -uroot password $MYSQL _user_root_password) > /dev/null 2>&1 && echo "completed!"
After running the above script, you need to run the following command manually:
Source/etc/profile
This article is from the "Last Night Stars" blog, please make sure to keep this source http://yestreenstars.blog.51cto.com/1836303/1541562