File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1153,6 +1153,32 @@ sub mysql_setup {
11531153 return 1;
11541154 }
11551155 else {
1156+ # If password was not provided and noask is not set, prompt for it
1157+ if ( $opt {pass } eq 0 && $opt {' noask' } == 0 ) {
1158+ print STDERR
1159+ " Please enter your MySQL administrative password: " ;
1160+ system (" stty -echo >$devnull 2>&1" );
1161+ my $password = <STDIN >;
1162+ system (" stty echo >$devnull 2>&1" );
1163+ chomp ($password );
1164+
1165+ $mysqllogin = " -u $opt {user}" ;
1166+ if ( length ($password ) > 0 ) {
1167+ if ($is_win ) {
1168+ $mysqllogin .= " -p\" $password \" " ;
1169+ }
1170+ else {
1171+ $mysqllogin .= " -p'$password '" ;
1172+ }
1173+ }
1174+ $mysqllogin .= $remotestring ;
1175+
1176+ $loginstatus = ` $mysqladmincmd ping $mysqllogin 2>&1` ;
1177+ if ( $loginstatus =~ / mysqld is alive/ ) {
1178+ goodprint " Logged in using credentials with prompted password" ;
1179+ return 1;
1180+ }
1181+ }
11561182 badprint
11571183 " Attempted to use login credentials, but they were invalid" ;
11581184 exit 1;
You can’t perform that action at this time.
0 commit comments