shell脚本一键安装MySQL5.5
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了shell脚本一键安装MySQL5.5,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3432字,纯文字阅读大概需要5分钟。
内容图文
![shell脚本一键安装MySQL5.5](/upload/InfoBanner/zyjiaocheng/460/3ac412a5e7d2437484ef5bd95294a740.jpg)
执行脚本之前必须下载MySQL5.5二进制压缩安装包。我是事先下载好了的。下边执行shell脚本。
#!/bin/bash #auth:taoyake /bin/mkdir -p /taokey/tools cd /taokey/tools/ tar -zxf mysql-5.5.32-linux2.6-x86_64.tar.gz sleep 3 cp -R mysql-5.5.32-linux2.6-x86_64 /usr/local/mysql sleep 3 cd /usr/local/mysql/ /bin/mkdir -p /var/lib/mysql cp support-files/my-large.cnf /var/lib/mysql/my.cnf useradd -M -s /sbin/nologin mysql chown -R mysql.mysql /var/lib/mysql sed -i ‘40 s/^/datadir = \/var\/lib\/mysql\n/‘ /var/lib/mysql/my.cnf yum install -y libaio >/dev/null 2>&1 sleep 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脚本:
[root@db_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 % compatible with this binary MySQL version. The MySQL daemon, mysqld, should work normally with the exception that host name resolving will not work. This means that you should use IP addresses instead of hostnames when specifying MySQL privileges ! Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE 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_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly 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.pl cd ./mysql-test ; perl mysql-test-run.pl Please 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! [root@db_server ~]# ps -ef | grep mysql root 1245 1 0 23:30 pts/0 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/var/lib/mysql/my.cnf mysql 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=3306 root 1545 1118 0 23:31 pts/0 00:00:00 grep mysql
MySQL5.5已经安装成功。
本文出自 “岁月在流逝,光辉依然在” 博客,请务必保留此出处http://taokey.blog.51cto.com/4633273/1734400
shell脚本一键安装MySQL5.5
标签:null 二进制 local sleep mysql
本文系统来源:http://taokey.blog.51cto.com/4633273/1734400
内容总结
以上是互联网集市为您收集整理的shell脚本一键安装MySQL5.5全部内容,希望文章能够帮你解决shell脚本一键安装MySQL5.5所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。