mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-03 11:05:48 +00:00
Fixing other small things and MariaDB specific,
- Use of VIA - Use of USING - Incompatible syntax with MySQL - ADD IF NOT EXISTS - convert the script to us AS to maintain the hash as they are Add a parameter --convert-MariaDB as parameter (default false)
This commit is contained in:
@@ -2048,16 +2048,25 @@ sub main {
|
||||
PTDEBUG && _d($EVAL_ERROR);
|
||||
$exit_status = 1;
|
||||
}
|
||||
if ($#create_user > 0){
|
||||
if ($#create_user >= 0){
|
||||
PTDEBUG && _d('CreateUser:', Dumper(\@create_user));
|
||||
# make this replication safe converting the CREATE USER into
|
||||
# CREATE USER IF NOT EXISTS and then doing an ALTER USER
|
||||
my $create = $create_user[0];
|
||||
my $alter = $create;
|
||||
my $alter = $create_user[0];
|
||||
$create =~ s{CREATE USER}{CREATE USER IF NOT EXISTS};
|
||||
$create =~ s{ IDENTIFIED .*}{};
|
||||
$create =~ s{ IDENTIFIED VIA }{ IDENTIFIED AS };
|
||||
$create =~ s{ BY }{ AS };
|
||||
$create =~ s{ AS.*PASSWORD }{ AS };
|
||||
$alter =~ s{CREATE USER}{ALTER USER};
|
||||
@create_user = ( $create, $alter );
|
||||
# Alter user should not be pass in the latest MySQL version
|
||||
#we need to cleanup other MariaDB diversions
|
||||
if ( VersionCompare::cmp($version, 'MariaDB') >= 0 &&
|
||||
$o->get('convert-MariaDB')){
|
||||
$create =~ s/IDENTIFIED.*USING.*unix_socket.*/IDENTIFIED WITH auth_socket/;
|
||||
$create =~ s/IDENTIFIED AS/IDENTIFIED WITH mysql_native_password AS/;
|
||||
}
|
||||
@create_user = ( $create);
|
||||
PTDEBUG && _d('AdjustedCreateUser:', Dumper(\@create_user));
|
||||
}
|
||||
}
|
||||
@@ -2442,6 +2451,10 @@ type: array
|
||||
|
||||
Only show grants for this comma-separated list of users.
|
||||
|
||||
=item --convert-MariaDB
|
||||
|
||||
When set it convert some of the proprietary MariaDB syntax into valid MySQL form
|
||||
|
||||
=item --password
|
||||
|
||||
short form: -p; type: string
|
||||
|
Reference in New Issue
Block a user