Shell script one-click Installation MySQL5.5

Source: Internet
Author: User

You must download the MySQL5.5 binary compression installation package before executing the script. I have downloaded it in advance. Execute the shell script below.

#!/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

Execute shell script:

[[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&nbsP 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 has been installed successfully.

This article from the "Years in the passing, shining still in" blog, please be sure to keep this source http://taokey.blog.51cto.com/4633273/1734400

Shell script one-click Installation MySQL5.5

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.