Last active
December 22, 2015 05:39
-
-
Save UlricQin/6425628 to your computer and use it in GitHub Desktop.
install script for mysql 5.5.28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# for version 5.5.28 | |
# author Ulric Qin | |
# | |
# dependency: cmake | |
set -eu | |
echo "set env..." | |
INSTALL_DIR="/home/users/ulric/mysql5" | |
DATA_DIR="$INSTALL_DIR/data" | |
SOCK_PATH="$INSTALL_DIR/tmp/mysql.sock" | |
PORT=8306 | |
WORKSPACE=$(cd $(dirname $0); pwd) | |
echo "set env done" | |
echo "cmake configure..." | |
cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DMYSQL_UNIX_ADDR=$SOCK_PATH -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=$DATA_DIR | |
echo "cmake configure done" | |
echo "make..." | |
make | |
echo "make done" | |
echo "make install..." | |
make install | |
echo "make install done" | |
echo "cd $INSTALL_DIR ..." | |
cd $INSTALL_DIR | |
echo "cd $INSTALL_DIR done" | |
echo "copy support-files/my-huge.cnf..." | |
cp support-files/my-huge.cnf my.cnf | |
echo "copy support-files/my-huge.cnf done" | |
echo "modify port..." | |
find -name 'my.cnf' | xargs perl -pi -e "s|3306|$PORT|g" | |
echo "modify port done" | |
echo "init mysql db..." | |
mkdir -p $DATA_DIR | |
scripts/mysql_install_db --defaults-file=my.cnf --basedir=. --datadir=data | |
echo "init mysql db done" | |
echo "start mysql..." | |
./bin/mysqld_safe & | |
echo "start mysql done" | |
sleep 5 | |
echo "set mysql root passwd" | |
./bin/mysqladmin -P $PORT -u root password 'root' | |
./bin/mysqladmin -P $PORT -u root -h `hostname` password 'root' | |
echo "set mysql root passwd done" | |
echo "delete user whose passwd is blank..." | |
./bin/mysql -P $PORT -uroot -proot -e "delete from mysql.user where Password is null or Password = '';flush privileges;" | |
echo "delete user whose passwd is blank done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment