#!/bin/sh # # Unix shell script to download, install and configure MySQL. # Requires `curl` program, which is obtainable from http://curl.haxx.se/ # # whoschek@lbl.gov # ################################################ # directory where the installation will go into ################################################ INSTALL_DIR=`dirname $0`/../.. #INSTALL_DIR=/opt/firebundle #INSTALL_DIR=/tmp mkdir -p $INSTALL_DIR ################################################ # MYSQL VERSION do download, install & configure ################################################ VERSION=4.0.18 ################################################ # edit password and change to whatever suits you ################################################ PASSWORD=changeit ################################################ # detect download URL ################################################ MYSQL_OS=`uname -s` > /dev/null 2>&1 case "$MYSQL_OS" in Linux*) MYSQL_OS="pc-linux-i686";; SunOS*) MYSQL_OS="sun-solaris2.9-sparc";; Darwin*) MYSQL_OS="apple-darwin6.8-powerpc";; FreeBSD*) MYSQL_OS="unknown-freebsd4.7-i386";; *) echo "$MYSQL_OS platform not supported by script. Please install manually from http://www.mysql.com"; exit 1;; esac URL=http://www.mysql.com/get/Downloads/MySQL-4.0/mysql-standard-$VERSION-$MYSQL_OS.tar.gz/from/ftp://mirror.mcs.anl.gov/pub/mysql/ ################################################ # download binary mysql ################################################ cd $INSTALL_DIR rm -f mysql-standard-$VERSION-$MYSQL_OS.tar.gz curl --location --output mysql-standard-$VERSION-$MYSQL_OS.tar.gz $URL #wget $URL # use wget if your platform does not have 'curl' gunzip < mysql-standard-$VERSION-$MYSQL_OS.tar.gz | tar -xvf - rm mysql-standard-$VERSION-$MYSQL_OS.tar.gz rm -fr mysql mv mysql-standard-$VERSION-$MYSQL_OS mysql ################################################ # configure database ################################################ cd mysql scripts/mysql_install_db ################################################ # set root password of mysql # (this is NOT the OS root user; mysql may run as any unprivileged user). # for security, mysql denies access to its root user # from anything else than localhost. So even if you know the password # you can only access the database from localhost. ################################################ bin/mysqld_safe & sleep 5 bin/mysqladmin -u root password $PASSWORD bin/mysqladmin -u root -h `hostname` password $PASSWORD ################################################ # shutdown and restart mysql daemon ################################################ bin/mysqladmin -u root --password=$PASSWORD shutdown bin/mysqld_safe & echo "Congrats. Done with installation"