File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 25
25
26
26
MYSQL_SOCKET=$( /srv/hops/mysql-cluster/ndb/scripts/get-mysql-socket.sh)
27
27
echo " Using socket: $MYSQL_SOCKET "
28
+
29
+ password_arg=" -p\$ MYSQL_ROOT_PASSWORD"
30
+ if [ -z $MYSQL_ROOT_PASSWORD ]; then
31
+ password_arg=" --skip-password"
32
+ fi
33
+
28
34
if [ " $EXECUTE_SQL " = " -e" ]; then
29
- mysql_command=' /srv/hops/mysql/bin/mysql --defaults-file=$MYSQL_CONF -u root --skip-password -S $MYSQL_SOCKET $DB $EXECUTE_SQL "$@"'
35
+ mysql_command=' /srv/hops/mysql/bin/mysql --defaults-file=$MYSQL_CONF -u root $password_arg -S $MYSQL_SOCKET $DB $EXECUTE_SQL "$@"'
30
36
# Don't echo code in production because other programs rely on reading the script's output
31
37
# echo "Executing command: $mysql_command"
32
38
eval $mysql_command
33
39
else
34
40
# Case 3
35
- mysql_command=" /srv/hops/mysql/bin/mysql --defaults-file=$MYSQL_CONF -u root --skip-password -S $MYSQL_SOCKET $DB $@ "
41
+ mysql_command=" /srv/hops/mysql/bin/mysql --defaults-file=$MYSQL_CONF -u root $password_arg -S $MYSQL_SOCKET $DB $@ "
36
42
# Don't echo code in production because other programs rely on reading the script's output
37
43
# echo "Executing command: $mysql_command"
38
44
eval $mysql_command
You can’t perform that action at this time.
0 commit comments