in reply to cpanm mysql fails with errors
Although I generally prefer to install Perl modules from CPAN, I make an exception for DBI/DBD, because it tends to be a PITA to get all the pieces to line up just right, as you discovered. apt-get install libdbd-mysql (and/or libdbd-mariadb-perl) is so much quicker and easier, unless you have a specific reason for wanting to build it from source.
In Section
Seekers of Perl Wisdom