一鍵安裝Mysql單一實例

來源:互聯網
上載者:User

標籤:mysql

#!/bin/sh#################################################Author: Created by randolph 2016-04#Blog:http://randolph.blog.51cto.com#Function: This scripts function is Install MySQL#Version:4.1.2#################################################. /etc/init.d/functionsuid=`id|awk -F "[=(]+" ‘{print $1}‘`if [ $uid -ne 0 ];then  action "Only root can execute the script." /bin/false  exit 1fiyum -y install ncurses ncurses-devel openssl-devel bison gcc gcc-c++ cmake makeuseradd mysql -s /sbin/nologin -Mcd /home/zhangyiling/tools/mysqltar zxf mysql-5.5.32.tar.gz cd mysql-5.5.32cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32 -DMYSQL_DATADIR=/application/mysql-5.5.32/data -DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_PARTITION_STORAGE_ENGINE=1 -DWITH_FAST_MUTEXES=1 -DWITH_ZLIB=bundled -DENABLED_LOCAL_INFILE=1 -DWITH_READLINE=1 -DWITH_EMBEDDED_SERVER=1 -DWITH_DEBUG=0make && make install    if [ $? -ne 0 ];then    action "Install mysql is failed!"  /bin/falseexit $?fisleep 2ln -s /application/mysql-5.5.32/ /application/mysql/bin/cp  /home/zhangyiling/tools/mysql/mysql-5.5.32/support-files/my-small.cnf /etc/my.cnf cp /home/zhangyiling/tools/mysql/mysql-5.5.32/support-files/mysql.server /etc/init.d/mysqld chmod 700 /etc/init.d/mysqld echo "export PATH=/application/mysql/bin:$PATH">>/etc/profilesource /etc/profilechown -R mysql.mysql /application/mysql/data//application/mysql/scripts/mysql_install_db  --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysqlif [ $? -ne 0 ];then    action "install mysql is failed!"  /bin/false    exit $?fi/etc/init.d/mysqld startif [ $? -ne 0 ];then    action "mysql start is failed!"  /bin/false    exit $?fi/application/mysql/bin/mysql -e "select version();" >/dev/null 2>&1if [ $? -eq 0 ];then    echo "+---------------------------+"    echo "+------mysql安裝完成--------+"    echo "+---------------------------+"fi


本文出自 “randolph” 部落格,轉載請與作者聯絡!

一鍵安裝Mysql單一實例

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.