shell指令碼一鍵安裝MySQL5.5

來源:互聯網
上載者:User

標籤:null   二進位   local   sleep   mysql   

執行指令碼之前必須下載MySQL5.5二進位壓縮安裝包。我是事先下載好了的。下邊執行shell指令碼。

#!/bin/bash#auth:taoyake/bin/mkdir -p /taokey/toolscd /taokey/tools/tar -zxf mysql-5.5.32-linux2.6-x86_64.tar.gz sleep 3cp -R mysql-5.5.32-linux2.6-x86_64 /usr/local/mysqlsleep 3cd /usr/local/mysql//bin/mkdir -p /var/lib/mysqlcp support-files/my-large.cnf /var/lib/mysql/my.cnfuseradd -M -s /sbin/nologin mysqlchown -R mysql.mysql /var/lib/mysqlsed -i ‘40 s/^/datadir = \/var\/lib\/mysql\n/‘ /var/lib/mysql/my.cnfyum install -y libaio >/dev/null 2>&1sleep 2/usr/local/mysql/scripts/mysql_install_db --defaults-file=/var/lib/mysql/my.cnf --user=mysql/usr/local/mysql/bin/mysqld_safe --defaults-file=/var/lib/mysql/my.cnf &sleep 5/usr/local/mysql/bin/mysql -u root -S /tmp/mysql.sock -e "select version();"if [ "$?" -eq "0" ]  then    echo -e "\e[1;32m MySQL-5.5 install Success! \e[0m"  else    echo -e "\e[1;31m MySQL-5.5 install Fail! \e[0m"  fi

執行shell指令碼:

[[email protected]_server ~]# sh mysql_script.sh WARNING: The host ‘db_server‘ could not be looked up with resolveip.This probably means that your libc libraries are not 100 % compatiblewith this binary MySQL version. The MySQL daemon, mysqld, should worknormally with the exception that host name resolving will not work.This means that you should use IP addresses instead of hostnameswhen specifying MySQL privileges !Installing MySQL system tables...OKFilling help tables...OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:./bin/mysqladmin -u root password ‘new-password‘./bin/mysqladmin -u root -h db_server password ‘new-password‘Alternatively you can run:./bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default.  This isstrongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with:cd . ; ./bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.plcd ./mysql-test ; perl mysql-test-run.plPlease report any problems with the ./bin/mysqlbug script!160112 23:30:48 mysqld_safe Logging to ‘/var/lib/mysql/db_server.err‘.160112 23:30:48 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql+------------+| version()  |+------------+| 5.5.32-log |+------------+ MySQL-5.5 install Success! [[email protected]_server ~]# ps -ef | grep mysqlroot      1245     1  0 23:30 pts/0    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/var/lib/mysql/my.cnfmysql     1524  1245  5 23:30 pts/0    00:00:01 /usr/local/mysql/bin/mysqld --defaults-file=/var/lib/mysql/my.cnf --basedir=/usr/local/mysql --datadir=/var/lib/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/lib/mysql/db_server.err --pid-file=/var/lib/mysql/db_server.pid --socket=/tmp/mysql.sock --port=3306root      1545  1118  0 23:31 pts/0    00:00:00 grep mysql

MySQL5.5已經安裝成功。

本文出自 “歲月在流逝,光輝依然在” 部落格,請務必保留此出處http://taokey.blog.51cto.com/4633273/1734400

shell指令碼一鍵安裝MySQL5.5

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.