From 59e3ac2e67b7bab72f4d3ddd2a07f13f1a557411 Mon Sep 17 00:00:00 2001 From: Jean Weisbuch Date: Mon, 18 May 2020 15:18:56 +0200 Subject: [PATCH] MDEV-25878: mytop bugs: check for mysql driver and sockets mytop fall-back to DBD::mysql if DBD::MariaDB is not available Apply #1546 --- scripts/mytop.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/mytop.sh b/scripts/mytop.sh index 7d40c44c2d6..a6a31b73199 100644 --- a/scripts/mytop.sh +++ b/scripts/mytop.sh @@ -242,7 +242,11 @@ my $dsn; ## Socket takes precedence. -$dsn ="DBI:MariaDB:database=$config{db};mariadb_read_default_group=mytop;"; +if (eval {DBI->install_driver("MariaDB")}) { + $dsn = "DBI:MariaDB:database=$config{db};mariadb_read_default_group=mytop;"; +} else { + $dsn = "DBI:mysql:database=$config{db};mysql_read_default_group=mytop;"; +} if ($config{socket} and -S $config{socket}) { @@ -2095,7 +2099,7 @@ following: * Perl 5.005 or newer * Getopt::Long - * DBI and DBD::MariaDB + * DBI and DBD::MariaDB or DBD::mysql * Term::ReadKey from CPAN Most systems are likely to have all of those installed--except for