#!/bin/bash export download_file=__MYSQL_FILE__ export mysql_compile_dir=__MYSQL_COMPILE_DIR__ export ftp_dir=__FTP_DIR__ export prefix=__PREFIX__ ### Change this variable to whereever you downloaded your files to. export compile_home=__COMPILE_HOME__ ### We don't use root_password and mysql_password in this script. ### However, if you edit this script, you can enable it. export root_password='this is a dumb password, please change.' export mysql_password='simple password' #------------------------------------------------- ## Lets add the mysql.mysql account in case it doesn't exist. echo 'Adding mysql user and group if it does not exist'. adduser -g mysql mysql #------------------------------------------------------------ # Cd to the directory where we will build MySQL 4.1 echo "Compiling in dirdctory $compile_home" mkdir -p $compile_home cd $compile_home # Download the version of MySQL you want. if [ ! -e $download_file ]; then echo "Downloading $download_file" echo "$ftp_dir/$download_file" wget -O $download_file $ftp_dir/$download_file fi ### Remove the previous compile #rm -rf $mysql_compile_dir ## We will delete the previous install. Hope you don't have data you need. #rm -rf $prefix #------------------------------------------------------------------ ## Compile the program and install it. tar -zxvf $download_file cd $mysql_compile_dir make clean ### Even though we try to isolate mysql to a specific directory, ### the lock file, pid file, and data dir end up being outside prefix. ### We have to change some things later to isolate mysql to the prefix. command="./configure --prefix=$prefix --datadir=$prefix/data --libdir=$prefix/lib \ --localstatedir=$prefix/var \ --enable-thread-safe-client --enable-assembler --enable-local-infile \ --with-pthread --with-comment --with-embedded-server --with-mysqlmanager \ --with-openssl --with-example-storage-engine \ --with-archive-storage-engine --with-csv-storage-engine \ --with-blackhole-storage-engine --with-ndbcluster --with-ndb-test \ --with-ndb-docs --with-federated-storage-engine \ --with-berkeley-db" echo $command $command make if ! make install ; then echo "Installation failed." exit fi mkdir -p $prefix/var/lib/mysql mkdir -p $prefix/var/log/ mkdir -p $prefix/var/run/mysqld/ mkdir -p $prefix/data/mysql mkdir -p $prefix/var/lock/subsys/ mkdir -p $prefix/tmp mkdir -p $prefix/slave_load mkdir -p $prefix/data mkdir -p $prefix/instance chown -R mysql $prefix chown -R mysql.mysql $prefix chmod 700 $prefix/data