Fixed asking for username/password when it's already passed.

This commit is contained in:
mhasbini 2016-02-13 23:57:16 +00:00
parent c4dbc7e499
commit 69ffbc7126

View file

@ -615,13 +615,27 @@ sub mysql_setup {
badprint "Attempted to use login credentials, but they were invalid"; badprint "Attempted to use login credentials, but they were invalid";
exit 1; exit 1;
} }
my ($name, $password);
# If --user is defined no need to ask for username
if( $opt{user} ne 0 )
{
$name = $opt{user};
}
else{
print STDERR "Please enter your MySQL administrative login: "; print STDERR "Please enter your MySQL administrative login: ";
my $name = <>; $name = <STDIN>;
}
# If --pass is defined no need to ask for password
if( $opt{pass} ne 0 )
{
$password = $opt{pass};
}
else{
print STDERR "Please enter your MySQL administrative password: "; print STDERR "Please enter your MySQL administrative password: ";
system("stty -echo >$devnull 2>&1"); system("stty -echo >$devnull 2>&1");
my $password = <>; $password = <STDIN>;
system("stty echo >$devnull 2>&1"); system("stty echo >$devnull 2>&1");
}
chomp($password); chomp($password);
chomp($name); chomp($name);
$mysqllogin = "-u $name"; $mysqllogin = "-u $name";