Fixing MYSQL_OPT_RECONNECT warning by choosing the right Perl DB driver (DBD::MariaDB vs DBD::mysql)

Alma Linux 9.7
Webmin 2.520

I never have to worry about available software updates, I always am being informed when there are new ones and proceed always from Webmin.
This time, because I’m receiving “WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.” emails every 5 minutes, I found there’s the version 2.6, not available from Webmin Packages updates here.

Where are you seeing the error, I use the same OS and same Webmin and don’t see the error.
I presume its coming from the monitor.pl from a previous post.
Have you seen a bug report that 2.6 will fix?

Just released by the looks.

I got the same update just now. I don’t know if the update will fix that. I receive an email every 5 minutes from a week ago or something with that body text.
Thank you

I can’t find that error at all, so not sure why you would have that issue.

It started Nov 17th, 23:15

Subject: Cron root@host /etc/webmin/status/monitor.pl
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Auto-Submitted: auto-generated
Precedence: bulk
X-Cron-Env: <XDG_SESSION_ID=410409>
X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/0>
X-Cron-Env: <DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus>
X-Cron-Env: <XDG_SESSION_TYPE=unspecified>
X-Cron-Env: <XDG_SESSION_CLASS=background>
X-Cron-Env: <LANG=en_US.UTF-8>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>

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

You can disable any status monitor that you don’t want to hear about.

I have also been receiving the same repeated warning when using the CLI and from some built in scripts:

virtualmin list-users --domain

/etc/webmin/mysql/backup.pl

For example:

virtualmin list-users --domain xxxxxx.com
WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.
User                 Real name            Mail FTP        DBs  Quota          
-------------------- -------------------- ---- ---------- ---- ---------------
Webmin version	2.610
Virtualmin version	7.50.0 GPL
Operating system	AlmaLinux 9.7
Usermin version	2.510

Operating system Rocky Linux 9.7
Webmin version 2.610
Usermin version 2.510
Virtualmin version 7.50.2 GPL

Just updated Webmin to 2.610, and started to get these e-mails too. Haven’t seen them before.

So, every 5 minutes, from every updated server I get this email:

Cron root@xxxxxxx /etc/webmin/status/monitor.pl
WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.

Anyone having this issue, try applying this patch and see if it fixes it:

webmin patch https://github.com/webmin/webmin/commit/9ba627e

@Jamie, this error is coming from libmysqlclient the client C library driver, which internally sets MYSQL_OPT_RECONNECT. We should fix the code to use either DBD::mysql or DBD::MariaDB depending on which database server is being installed, right?

And, also, we shouldn’t try to install one of these from CPAN because they are available in the standard package manager.

After looking into it more, I see that the packaged version of DBD::mysql removed MYSQL_OPT_RECONNECT years ago. People having this issue probably installed DBD::mysql from CPAN and never updated it.

Hi, I applied the patch successfully to one of my servers. Restarted webmin and sql (mariadb), but still getting the e-mails.

What are the outputs of:

perl -MDBD::mysql   -e 'print "$DBD::mysql::VERSION\n"'

and

perl -MDBD::MariaDB -e 'print "$DBD::MariaDB::VERSION\n"'

Is that really needed?? I thought that both MySQL and MariaDB implemented the same network protocol for SQL queries..

# perl -MDBD::mysql -e ‘print “$DBD::mysql::VERSION\n”’
4.053
# perl -MDBD::MariaDB -e ‘print “$DBD::MariaDB::VERSION\n”’
1.21

Webmin 2.610
I had disabled /etc/webmin/status/monitor.pl cron job
I’ve just enabled it, restarted Webmin.
No more mails every 5 minutes.
perl -MDBD::mysql -e 'print "$DBD::mysql::VERSION\n"’
4.053
perl -MDBD::MariaDB -e 'print "$DBD::MariaDB::VERSION\n"'
1.21

(I didn’t apply the patch)

1 Like

Yeah, version 4.053 is outdated. I’d recommend deleting these CPAN modules and using the dnf install perl-DBD-mysql command to get the latest version that won’t set the parameter causing an error.

The protocol is the same, but the MariaDB version of the driver is maintained by the MariaDB team and reportedly aims to match MariaDB features better.

I suppose at the very least we could use DBD::MariaDB if DBD::mysql isn’t installed

I think we might want to prefer DBD::MariaDB instead of the opposite. Mariadb is the de facto standard implementation of MySQL these days. Might as well assume that’s what we have.

2 Likes