Fixed asking for username/password when it's already passed.
This commit is contained in:
parent
c4dbc7e499
commit
69ffbc7126
1 changed files with 22 additions and 8 deletions
|
@ -598,7 +598,7 @@ sub mysql_setup {
|
||||||
# Login went just fine
|
# Login went just fine
|
||||||
$mysqllogin = " $remotestring ";
|
$mysqllogin = " $remotestring ";
|
||||||
|
|
||||||
# Did this go well because of a .my.cnf file or is there no password set?
|
# Did this go well because of a .my.cnf file or is there no password set?
|
||||||
my $userpath = `printenv HOME`;
|
my $userpath = `printenv HOME`;
|
||||||
if ( length($userpath) > 0 ) {
|
if ( length($userpath) > 0 ) {
|
||||||
chomp($userpath);
|
chomp($userpath);
|
||||||
|
@ -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);
|
||||||
print STDERR "Please enter your MySQL administrative login: ";
|
# If --user is defined no need to ask for username
|
||||||
my $name = <>;
|
if( $opt{user} ne 0 )
|
||||||
print STDERR "Please enter your MySQL administrative password: ";
|
{
|
||||||
system("stty -echo >$devnull 2>&1");
|
$name = $opt{user};
|
||||||
my $password = <>;
|
}
|
||||||
system("stty echo >$devnull 2>&1");
|
else{
|
||||||
|
print STDERR "Please enter your MySQL administrative login: ";
|
||||||
|
$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: ";
|
||||||
|
system("stty -echo >$devnull 2>&1");
|
||||||
|
$password = <STDIN>;
|
||||||
|
system("stty echo >$devnull 2>&1");
|
||||||
|
}
|
||||||
chomp($password);
|
chomp($password);
|
||||||
chomp($name);
|
chomp($name);
|
||||||
$mysqllogin = "-u $name";
|
$mysqllogin = "-u $name";
|
||||||
|
|
Loading…
Reference in a new issue