Just ran into this same problem, 12 years later, after an upgrade from fedora 39 to 40. (Sharing in case it is useful to anyone else having this same problem).
```cli
$ perl -MDBD::mysql -le'print $DBD::mysql::VERSION'
Can't load '/usr/lib64/perl5/vendor_perl/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.21: cannot open shared object file: No such file or directory at /usr/lib64/perl5/DynaLoader.pm line 206. at -e line 0.
Compilation failed in require.
BEGIN failed--compilation aborted.
```
but
```cli
$ ls -l /usr/lib64/mysql/libmysqlclient.so.21
lrwxrwxrwx 1 root root 25 Feb 27 19:00 /usr/lib64/mysql/libmysqlclient.so.21 -> libmysqlclient.so.21.2.41
$ ls -l /usr/lib64/perl5/vendor_perl/auto/DBD/mysql/mysql.so
-rwxr-xr-x 1 root root 127008 Jul 2 2024 /usr/lib64/perl5/vendor_perl/auto/DBD/mysql/mysql.so
$ perl -MDBD::MariaDB -le'print $DBD::MariaDB::VERSION'
1.23
```
So the files were there, but it was still failing, and yet `MariaDB` seems to be fine for some reason.
Reinstalling `mariadb*` and `mysql*` and `perl-DBD-MySQL` and `perl-DBD-MariaDB` did not fix things either.
The file `/usr/lib64/perl5/DynaLoader.pm` itself (near line 206) says that the error message might be misleading.
The clue came when I ran
```cli
$ ldconfig -p | grep libmysqlclient
```
and got an empty result. It seems that for some reason, upgrading `glibc` wrecked my `ldconfig` install. The file `/etc/ld.so.conf` disappeared, and so the `/etc/ld.so.conf.d/*` files were not loading (including `/etc/ld.so.conf.d/mysql8.0-x86_64.conf` which contained `/usr/lib64/mysql`).
I then reinstalled `glibc` (with `dnf reinstall`) and `/etc/ld.so.conf` reappeared. I ran `ldconfig` again, and now everything works.
```cli
$ perl -MDBD::mysql -le'print $DBD::mysql::VERSION'
5.007
```
Hope that helps someone out there.
Just ran into this same problem, 12 years later, after an upgrade from fedora 39 to 40. (Sharing in case it is useful to anyone else having this same problem).
```cli
$ perl -MDBD::mysql -le'print $DBD::mysql::VERSION'
Can't load '/usr/lib64/perl5/vendor_perl/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.21: cannot open shared object file: No such file or directory at /usr/lib64/perl5/DynaLoader.pm line 206. at -e line 0.
Compilation failed in require.
BEGIN failed--compilation aborted.
```
but
```cli
$ ls -l /usr/lib64/mysql/libmysqlclient.so.21
lrwxrwxrwx 1 root root 25 Feb 27 19:00 /usr/lib64/mysql/libmysqlclient.so.21 -> libmysqlclient.so.21.2.41
$ ls -l /usr/lib64/perl5/vendor_perl/auto/DBD/mysql/mysql.so
-rwxr-xr-x 1 root root 127008 Jul 2 2024 /usr/lib64/perl5/vendor_perl/auto/DBD/mysql/mysql.so
$ perl -MDBD::MariaDB -le'print $DBD::MariaDB::VERSION'
1.23
```
So the files were there, but it was still failing, and yet `MariaDB` seems to be fine for some reason.
Reinstalling `mariadb*` and `mysql*` and `perl-DBD-MySQL` and `perl-DBD-MariaDB` did not fix things either.
The file `/usr/lib64/perl5/DynaLoader.pm` itself (near line 206) says that the error message might be misleading.
The clue came when I ran
```cli
$ ldconfig -p | grep libmysqlclient
```
and got an empty result. It seems that for some reason, upgrading `glibc` wrecked my `ldconfig` install. The file `/etc/ld.so.conf` disappeared, and so the `/etc/ld.so.conf.d/*` files were not loading (including `/etc/ld.so.conf.d/mysql8.0-x86_64.conf` which contained `/usr/lib64/mysql`).
I then reinstalled `glibc` (with `dnf reinstall`) and `/etc/ld.so.conf` reappeared. I ran `ldconfig` again, and now everything works.
```cli
$ perl -MDBD::mysql -le'print $DBD::mysql::VERSION'
5.007
```
Hope that helps someone out there.