WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.

Bug reports, technical issues, and troubleshooting for EFA v5 systems
Post Reply
ajmind
Posts: 10
Joined: Tue Oct 14, 2025 2:56 pm
Been thanked: 1 time

WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.

Post by ajmind »

My current eFA v5 gateway running on Rocky Linux 9.x was recently updated which resulted in this daily message:

Code: Select all

/etc/cron.daily/eFa-Tokens.cron:

WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.
Everything works so far as visible as usual, but it brings the risk to the surface that nobody is maintaining the code anymore.
(Rolling back on Rocky Linux is not available).
adrastosefa
Site Admin
Posts: 76
Joined: Wed Oct 08, 2025 5:14 am
Location: Las Vegas
Has thanked: 5 times
Been thanked: 15 times
Contact:

Re: WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.

Post by adrastosefa »

Please post output from the following:

The full contents of
/etc/cron.daily/eFa-Tokens.cron

The output of:
mysql --version
rpm -qa | egrep 'mysql|maria|DBD'

(Optional but helpful) Which recent update coincided with the warning first appearing.

This will tell us whether the message is coming from:
the MySQL client library itself,
the Perl DBD driver in use,
or a specific eFA v5 script calling the database layer.

Setting expectations:

eFA v5 is in legacy / maintenance-only status and no longer receives upstream compatibility updates. While this warning is currently benign, similar deprecation messages will continue to appear over time as operating systems and database libraries evolve.

Short-term mitigations (driver pinning, updating DBD modules, or filtering cron output) are usually sufficient if you must remain on eFA v5. Long-term, continued OS updates will increasingly expose these kinds of issues.

Our recommendation is that you migrate to openefa. It could be easy or more difficult depending your current configuration. We have a new release coming out soon, and we have support options, both in the forum and paid support type.

Please post the output and we will help. sb
ajmind
Posts: 10
Joined: Tue Oct 14, 2025 2:56 pm
Been thanked: 1 time

Re: WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.

Post by ajmind »

First of all, Happy New Year 2026!

thank you for your reply. After my break here are the requested information:

adrastosefa wrote: Thu Dec 25, 2025 6:43 am ...
The full contents of
/etc/cron.daily/eFa-Tokens.cron

Code: Select all

#!/usr/bin/perl
# +--------------------------------------------------------------------+
# eFa-Tokens.cron
# Expires old tokens from efa database
# Version 20210130
# +--------------------------------------------------------------------+
# Copyright (C) 2012~2021 http://www.efa-project.org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
# +--------------------------------------------------------------------+

use strict 'vars';
use strict 'refs';

use DBI;
use Sys::Syslog qw( :DEFAULT setlogsock);

my($user) = $ENV{'USER'};
setlogsock('unix');

my($db_name) = 'efa';
my($db_host) = 'localhost';
my($db_user) = 'efa';
# Issue #66 Grab Passwords from eFa-Config
my($fh);
my($pw_config) = '/etc/eFa/eFa-Config';
open($fh, "<", $pw_config);
if (!$fh) {
  openlog($0,'','user');
  syslog('error', "Unable to retrieve password from /etc/eFa/eFa-Config, aborting!");
  closelog;
  exit 1;
}
my($db_pass) = grep(/^EFASQLPWD/,<$fh>);
$db_pass =~ s/EFASQLPWD://;
$db_pass =~ s/\n//;
close($fh);

my($sql,$sth,$dbh);

# Connect to the database
$dbh = DBI->connect("DBI:mysql:database=$db_name;host=$db_host",
                      $db_user, $db_pass,
                      {PrintError => 0});

if ($dbh) {
  $sql = "DELETE from tokens WHERE datestamp < DATE_SUB(NOW() , INTERVAL 3 DAY)";
  $sth = $dbh->prepare($sql);
  $sth->execute;

  $sth->finish();
  $dbh->disconnect();

  openlog($0,'','user');
  syslog('info', "Successfully expired old tokens.");
  closelog;
} else {

  openlog($0,'','user');
  syslog('ERR', "Unable to open efa database, tokens not expired!");
  closelog;
}
The output of:
mysql --version
rpm -qa | egrep 'mysql|maria|DBD'

Code: Select all

mysql  Ver 15.1 Distrib 10.5.27-MariaDB, for Linux (x86_64) using  EditLine wrapper
...
perl-DBD-SQLite-1.66-5.el9.x86_64
mariadb-connector-c-config-3.2.6-1.el9_0.noarch
mariadb-connector-c-3.2.6-1.el9_0.x86_64
mariadb-common-10.5.27-1.el9_5.0.2.x86_64
mariadb-errmsg-10.5.27-1.el9_5.0.2.x86_64
mariadb-server-utils-10.5.27-1.el9_5.0.2.x86_64
mariadb-backup-10.5.27-1.el9_5.0.2.x86_64
mariadb-10.5.27-1.el9_5.0.2.x86_64
mariadb-gssapi-server-10.5.27-1.el9_5.0.2.x86_64
mariadb-server-10.5.27-1.el9_5.0.2.x86_64
php-mysqlnd-8.0.30-3.el9_6.x86_64
mysql-common-8.0.43-1.el9_6.x86_64
mysql-libs-8.0.43-1.el9_6.x86_64
perl-DBD-MySQL-4.053-1.el9.0.1.x86_64
mysql-selinux-1.0.14-1.el9_6.noarch
perl-DBD-MariaDB-1.21-17.el9.x86_64

(Optional but helpful) Which recent update coincided with the warning first appearing.

Code: Select all

2025-12-02T11:33:00+0100 SUBDEBUG Installed: mysql-common-8.0.43-1.el9_6.x86_64
2025-12-02T11:33:00+0100 SUBDEBUG Installed: mysql-libs-8.0.43-1.el9_6.x86_64
2025-12-02T11:33:01+0100 SUBDEBUG Upgrade: perl-DBD-MySQL-4.053-1.el9.0.1.x86_64
2025-12-02T11:33:01+0100 SUBDEBUG Upgrade: mysql-selinux-1.0.14-1.el9_6.noarch
2025-12-02T11:33:44+0100 SUBDEBUG Upgraded: mysql-selinux-1.0.13-1.el9_5.noarch
2025-12-02T11:34:05+0100 SUBDEBUG Upgraded: perl-DBD-MySQL-4.050-13.el9.x86_64
This will tell us whether the message is coming from:
the MySQL client library itself,
the Perl DBD driver in use,
or a specific eFA v5 script calling the database layer.

Setting expectations:
We are already testing openeFa, but it seems to me it is not fully useable for us. We need to tweak settings but have no information where and how to. (Mentioned in my previous posts.)
Woger
Posts: 28
Joined: Wed Oct 08, 2025 12:15 pm
Location: Wouw (NL)
Has thanked: 6 times
Been thanked: 2 times

Re: WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.

Post by Woger »

I made this script to get rid of these errors in the logs. However, it still gives this error when I manually tag a mail as spam.

Code: Select all

#!/bin/bash
# Script to fix MySQL deprecated reconnect warnings in MailScanner

# Backup all files first
sudo cp /usr/share/MailScanner/perl/custom/MailWatch.pm /usr/share/MailScanner/perl/custom/MailWatch.pm.bak
sudo cp /usr/share/MailScanner/perl/custom/SQLBlackWhiteList.pm /usr/share/MailScanner/perl/custom/SQLBlackWhiteList.pm.bak
sudo cp /usr/share/MailScanner/perl/custom/SQLSpamSettings.pm /usr/share/MailScanner/perl/custom/SQLSpamSettings.pm.bak
sudo cp /usr/share/MailScanner/perl/custom/CustomAction.pm /usr/share/MailScanner/perl/custom/CustomAction.pm.bak
sudo cp /usr/share/MailScanner/perl/MailScanner/ConfigSQL.pm /usr/share/MailScanner/perl/MailScanner/ConfigSQL.pm.bak
sudo cp /usr/share/MailScanner/perl/MailScanner/CustomConfig.pm /usr/share/MailScanner/perl/MailScanner/CustomConfig.pm.bak
sudo cp /usr/share/MailScanner/perl/MailScanner/SA.pm /usr/share/MailScanner/perl/MailScanner/SA.pm.bak

# Fix each file by adding mysql_auto_reconnect=0 to the connection strings
sudo sed -i 's/DBI->connect("DBI:mysql:database=\$db_name;host=\$db_host"/DBI->connect("DBI:mysql:database=$db_name;host=$db_host;mysql_auto_reconnect=0"/g' /usr/share/MailScanner/perl/custom/MailWatch.pm
sudo sed -i 's/DBI->connect("DBI:mysql:database=\$db_name;host=\$db_host"/DBI->connect("DBI:mysql:database=$db_name;host=$db_host;mysql_auto_reconnect=0"/g' /usr/share/MailScanner/perl/custom/SQLBlackWhiteList.pm
sudo sed -i 's/DBI->connect("DBI:mysql:database=\$db_name;host=\$db_host"/DBI->connect("DBI:mysql:database=$db_name;host=$db_host;mysql_auto_reconnect=0"/g' /usr/share/MailScanner/perl/custom/SQLSpamSettings.pm
sudo sed -i 's/DBI->connect("DBI:mysql:database=\$db_name;host=\$db_host"/DBI->connect("DBI:mysql:database=$db_name;host=$db_host;mysql_auto_reconnect=0"/g' /usr/share/MailScanner/perl/custom/CustomAction.pm
sudo sed -i 's/DBI->connect("DBI:mysql:mailscanner:192.168.0.51"/DBI->connect("DBI:mysql:mailscanner:192.168.0.51;mysql_auto_reconnect=0"/g' /usr/share/MailScanner/perl/MailScanner/CustomConfig.pm

echo "All files backed up and patched!"
ajmind
Posts: 10
Joined: Tue Oct 14, 2025 2:56 pm
Been thanked: 1 time

Re: WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.

Post by ajmind »

Woger wrote: Mon Jan 05, 2026 4:04 pm I made this script to get rid of these errors in the logs. However, it still gives this error when I manually tag a mail as spam.
This is also valid when you release a message and mark it as ham.
Post Reply