首页 > 代码库 > mysql安装脚本
mysql安装脚本
#!/bin/shif [ -s /etc/my.cnf ];thenrm -rf /etc/my.cnffiecho "----------------------------------start install mysql -----------------------------"yum install -y ncurses gcc gcc-c++ ncurses ncurses-devel openssl openssl-devel libtool* cmakemkdir -p /data/mysqlif [ ‘grep "mysql" /etc/passwd | wc -l‘ ]; thenecho "adding user mysql"groupadd mysql useradd -s /sbin/nologin -M -g mysql mysqlelseecho "mysql user exists"fiecho "-------------------------------downloading mysql----------------------------------"wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.46.tar.gz echo "------------------------------unpackaging mysql -----------------------------------"tar -xvf mysql-5.5.46.tar.gz cd mysql-5.5.46 echo "-------------------------configuring mysql,please wait-----------------"cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci \-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_MEMORY_STORAGE_ENGINE=1 \-DWITH_READLINE=1 \-DENABLED_LOCAL_INFILE=1 \-DMYSQL_DATADIR=/var/mysql/data \-DMYSQL_USER=mysqlif [ $? -ne 0 ];thenecho "configure failed ,please check it out!"exit 1fiecho "make mysql, please wait for 20 minutes"makeif [ $? -ne 0 ];thenecho "make failed ,please check it out!"exit 1fimake installchown -R mysql:mysql /usr/local/mysqlchown -R mysql.mysql /data/mysql/ /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql #chown -R mysql /usr/local/mysql/varchgrp -R mysql /usr/local/mysql/cp -f ./support-files/my-large.cnf /etc/my.cnf sed -i ‘s#^thread_concurrency = 8#& \ndatadir = /data/mysql#g‘ /etc/my.cnfcp ./support-files/mysql.server /etc/rc.d/init.d/mysqlchmod 755 /etc/init.d/mysql #chkconfig --add mysqld #chkconfig --level 2345 mysqld onln -s /usr/local/mysql/lib/mysql /usr/lib/mysqlln -s /usr/local/mysql/include/mysql /usr/include/mysqlln -s /usr/local/mysql/bin/mysql /usr/bin/mysqlln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldumpln -s /usr/local/mysql/bin/myisamchk /usr/bin/myisamchkln -s /usr/local/mysql/bin/mysqld_safe /usr/bin/mysqld_safeecho "mysql starting"/usr/local/mysql/bin/mysqld --user=mysqlif [ $? -ne 0 ];thenecho "mysql start filed ,please check it out!"elseecho "mysql start successful,congratulations!"fi
mysql安装脚本
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。