diff options
author | Anel Husakovic <anel@mariadb.org> | 2020-10-13 14:36:25 +0200 |
---|---|---|
committer | Anel Husakovic <anel@mariadb.org> | 2021-06-21 11:55:16 +0200 |
commit | bcedb4200f26468d33f7064c1e6e126d81b21162 (patch) | |
tree | e6b78280320a9d658d75a1ebf6fea4a652907472 | |
parent | 59e3ac2e67b7bab72f4d3ddd2a07f13f1a557411 (diff) | |
download | mariadb-git-bcedb4200f26468d33f7064c1e6e126d81b21162.tar.gz |
MDEV-25878: mytop bugs: check for mysql driver and sockets
- Adding socket check for MariaDB/Mysql driver
Reviewed by: serg@mariadb.com
-rw-r--r-- | scripts/mytop.sh | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/scripts/mytop.sh b/scripts/mytop.sh index a6a31b73199..65bfb8c976e 100644 --- a/scripts/mytop.sh +++ b/scripts/mytop.sh @@ -6,7 +6,7 @@ =head1 NAME -mytop - display MariaDB server performance info like `top' +mytop - display MariaDB/MySQL server performance info like `top' =cut @@ -241,16 +241,17 @@ my $BOLD = BOLD() || ''; my $dsn; ## Socket takes precedence. - +my $prefix= 'mysql'; if (eval {DBI->install_driver("MariaDB")}) { $dsn = "DBI:MariaDB:database=$config{db};mariadb_read_default_group=mytop;"; + $prefix= 'mariadb' } else { $dsn = "DBI:mysql:database=$config{db};mysql_read_default_group=mytop;"; } if ($config{socket} and -S $config{socket}) { - $dsn .= "mariadb_socket=$config{socket}"; + $dsn .= "${prefix}_socket=$config{socket}"; } else { @@ -272,7 +273,7 @@ my $dbh = DBI->connect($dsn, $config{user}, $config{pass}, if (not ref $dbh) { my $Error = <<EODIE -Cannot connect to MariaDB server. Please check the: +Cannot connect to MariaDB/MySQL server. Please check the: * database you specified "$config{db}" (default is "") * username you specified "$config{user}" (default is "root") @@ -2284,8 +2285,8 @@ Default: unset. =item B<-S> or B<--socket> I</path/to/socket> -If you're running B<mytop> on the same host as MariaDB, you may wish to -have it use the MariaDB socket directly rather than a standard TCP/IP +If you're running B<mytop> on the same host as MariaDB/MySQL, you may wish to +have it use the MariaDB/MySQL socket directly rather than a standard TCP/IP connection. If you do,just specify one. Note that specifying a socket will make B<mytop> ignore any host |