-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlogpath.sh
25 lines (22 loc) · 1011 Bytes
/
logpath.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
##==============================================================================================
## load login-path variables
##==============================================================================================
LOGIN_PATH_NAME=$1
LOGIN_USER=$2
HOST=$3
PORT=$4
PASSWD=$5
##==============================================================================================
## remove MySQL login-path first
##==============================================================================================
mysql_config_editor remove --login-path="${LOGIN_PATH_NAME}"
##==============================================================================================
## generate MySQL login-path
##==============================================================================================
expect -c "
spawn mysql_config_editor set --login-path=${LOGIN_PATH_NAME} --user=${LOGIN_USER} --host=${HOST} --port=${PORT} --password
expect -nocase \"Enter Password:\"
send \"${PASSWD}\r\"
interact
"