-
Notifications
You must be signed in to change notification settings - Fork 5
/
setenv
21 lines (17 loc) · 877 Bytes
/
setenv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
export WS_HOME=$PWD
export PATH=${WS_HOME}/mysqlsrc/bin:$PATH
[ ! -e ${WS_HOME}/mysqlsrc/bin/mysql ] && echo "Can not find MySQL binaries, please create mysqlsrc link (${WS_HOME}/mysqlsrc) to MySQL binaries" && return 1;
version=`${WS_HOME}/mysqlsrc/bin/mysql --version | sed -n 's/.*\([0-9]\.[0-9]\.[0-9][0-9]\).*/\1/p' | cut -d'.' -f1,2`
echo "MySQL Version ($version)"
MY_FILE="${WS_HOME}/my.cnf"
[ -e $MY_FILE ] && return
echo "[mysqld_safe]" > $MY_FILE
echo "socket = $WS_HOME/mysql.sock" >> $MY_FILE
echo " " >> $MY_FILE
echo "[mysqld]" >> $MY_FILE
echo "basedir = $WS_HOME/mysqlsrc" >> $MY_FILE
echo "datadir = $WS_HOME/mysqldata" >> $MY_FILE
echo "port = 3306" >> $MY_FILE
echo "secure_file_priv = /tmp" >> $MY_FILE
[ $version="8.0" ] && echo "default_authentication_plugin = mysql_native_password" >> $MY_FILE
echo " " >> $MY_FILE