[debian-mysql] Bug#1109394: /usr/bin/mytop: mytop: Connection error: port cannot be specified when host is localhost or embedded

Jean Weisbuch jean at phpnet.org
Wed Jul 16 16:49:23 BST 2025


It's because DBD-MariaDB unlike DBD-MySQL returns an error is the host 
is localhost (using socket connection unlike 127.0.0.1) and a port is 
specified : 
https://github.com/perl5-dbi/DBD-MariaDB/blob/a005081c0f98d564e4256068d5dda22362293e49/dbdimp.c#L1511

Proposed fix :

--- mytop.sh.old    2025-07-16 17:47:19.489264407 +0200
+++ mytop.sh    2025-07-16 17:48:29.911676064 +0200
@@ -256,7 +256,11 @@

  if ($config{socket} and -S $config{socket})
  {
-  $dsn .= "${prefix}_socket=$config{socket}";
+    $dsn .= "${prefix}_socket=$config{socket}";
+}
+elsif($config{host} eq "localhost")
+{
+    $dsn .= "host=$config{host}";
  }
  else
  {




More information about the pkg-mysql-maint mailing list