File tree Expand file tree Collapse file tree 4 files changed +11
-14
lines changed Expand file tree Collapse file tree 4 files changed +11
-14
lines changed Original file line number Diff line number Diff line change 66 ip-address =
77
88[mysql]
9- host = localhost
9+ client- host = localhost
1010 db-name = false
1111 db-user = false
1212
Original file line number Diff line number Diff line change @@ -12,8 +12,7 @@ function ee_lib_mysql_info()
1212 local ee_mysql_max_used_connections=$( mysql -e " show global status" | grep Max_used_connections | awk ' {print($2)}' )
1313
1414 ee_lib_echo
15- ee_lib_echo " MySQL ($ee_mysql_version ):"
16- ee_lib_echo_escape " user\t\t\t\t \033[37m$EE_MYSQL_USER "
15+ ee_lib_echo " MySQL ($ee_mysql_version ) on $EE_MYSQL_HOST :"
1716 ee_lib_echo_escape " port\t\t\t\t \033[37m$ee_mysql_port "
1817 ee_lib_echo_escape " wait_timeout\t\t\t \033[37m$ee_mysql_wait_timeout "
1918 ee_lib_echo_escape " interactive_timeout\t\t \033[37m$ee_mysql_interactive_timeout "
Original file line number Diff line number Diff line change 3939fi
4040
4141# Find out MySQL hostname
42- if [ -z $( $EE_CONFIG_GET mysql .host) ]; then
42+ if [ -z $( git config --file $HOME /.my.cnf client .host) ]; then
4343 readonly EE_MYSQL_HOST=localhost
4444else
45- readonly EE_MYSQL_HOST=$( $EE_CONFIG_GET mysql .host)
45+ readonly EE_MYSQL_HOST=$( git config --file $HOME /.my.cnf client .host)
4646fi
4747
48- # Find out MySQL login
49- if [ -f ~ /.my.cnf ]; then
50- readonly EE_MYSQL_USER=$( cat ~ /.my.cnf | grep user | cut -d' =' -f2)
51- readonly EE_MYSQL_PASS=$( cat ~ /.my.cnf | grep pass | cut -d' =' -f2 | sed -e ' s/^"//' -e ' s/"$//' )
52- elif [ -f /root/.my.cnf ]; then
53- readonly EE_MYSQL_USER=$( cat /root/.my.cnf | grep user | cut -d' =' -f2)
54- readonly EE_MYSQL_PASS=$( cat /root/.my.cnf | grep pass | cut -d' =' -f2 | sed -e ' s/^"//' -e ' s/"$//' )
48+ # Find out MySQL client-host to setup grants
49+ if [ -z $( $EE_CONFIG_GET mysql.client-host) ]; then
50+ readonly EE_MYSQL_CLIENT_HOST=localhost
51+ else
52+ readonly EE_MYSQL_CLIENT_HOST=$( $EE_CONFIG_GET mysql.client-host)
5553fi
Original file line number Diff line number Diff line change @@ -56,11 +56,11 @@ function ee_mod_setup_database()
5656 || ee_lib_error " Unable to create $EE_DB_NAME database, exit status = " $?
5757
5858 # Create MySQL User
59- mysql -e " create user '$EE_DB_USER '@'$EE_MYSQL_HOST ' identified by '$EE_DB_PASS '" \
59+ mysql -e " create user '$EE_DB_USER '@'$EE_MYSQL_CLIENT_HOST ' identified by '$EE_DB_PASS '" \
6060 || ee_lib_error " Unable to create $EE_DB_USER database user, exit status = " $?
6161
6262 # Grant permission
63- mysql -e " grant all privileges on \` $EE_DB_NAME \` .* to '$EE_DB_USER '@'$EE_MYSQL_HOST '" \
63+ mysql -e " grant all privileges on \` $EE_DB_NAME \` .* to '$EE_DB_USER '@'$EE_MYSQL_CLIENT_HOST '" \
6464 || ee_lib_error " Unable to grant privileges for $EE_DB_USER database user, exit status = " $?
6565 mysql -e " flush privileges"
6666}
You can’t perform that action at this time.
0 commit comments