diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2020-01-23 12:40:29 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2020-01-23 12:40:29 +0200 |
commit | bb9f85ecb5f9d36b250ec1c84e44298b25e6632f (patch) | |
tree | 2016c6342083c30cb96682b5039aeef7be8d1dfb | |
parent | 70a86be6c01f123cb166715ee03c21a5a5ded34b (diff) | |
download | mysqlstat-bb9f85ecb5f9d36b250ec1c84e44298b25e6632f.tar.gz mysqlstat-bb9f85ecb5f9d36b250ec1c84e44298b25e6632f.tar.bz2 |
Minor fixes in mysqlstat-setup
-rw-r--r-- | setup/mysqlstat-setup.pl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/setup/mysqlstat-setup.pl b/setup/mysqlstat-setup.pl index 6c8eecc..6366e33 100644 --- a/setup/mysqlstat-setup.pl +++ b/setup/mysqlstat-setup.pl @@ -263,15 +263,17 @@ sub db_modify { my $dbd = shift; my $q = shift; my $sth = $dbd->prepare($q); - my $res = $sth->execute(@_) or croak($sth->errstr); + my $res = $sth->execute(@_) or die($sth->errstr); $sth->finish; return $res; } sub sql_create_user { my $dbd = db_connect(); - my $q = q{GRANT PROCESS, REPLICATION CLIENT ON *.* TO ?@?}; my @args = ($snmp_user, $snmp_host); + db_modify($dbd, q{CREATE USER IF NOT EXISTS ?@?}, @args); + + my $q = q{GRANT PROCESS, REPLICATION CLIENT ON *.* TO ?@?}; if ($snmp_password) { push @args, $snmp_password; $q .= ' IDENTIFIED BY ?'; |