Perl CPAN DBD::mysql error “FAILED–Further testing stopped” after upgrading Watch MySQL (XSLoader.pm, libmysqlclient.so)
I recently ran into an issue with Perl connecting to MySQL after upgrading a plugin for cPanel/WHM called Watch MySQL. After going through the logs files I determined the error was with a missing dependency file XSLoader.pm and libmysqlclient.so. The problem actually ended up being that those files were not installed because the Perl CPAN upgrade for DBD::mysql failed. After some research it was actually very easy to fix …
The specific errors I was receiving were similar to the errors below. Specifically this was the error in the logs from Watch MySQL:
1 |
HUPCan't load '/usr/local/lib/perl5/site_perl/5.8.8/i686-linux/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.16: cannot open shared object file: No such file or directory at /usr/local/lib/perl5/5.8.8/i686-linux/XSLoader.pm line 70. |
So that error above told me there was a problem with the DBD::mysql module. So the next step was to attempt and manually upgrade/install the Perl CPAN DBD::mysql module. Logged in a root shell you would need to execute these commands below:
First log into a CPAN shell:
1 |
perl -MCPAN -e shell |
Next attempt to install DBD::mysql:
1 |
install DBD::mysql |
That command above will attempt to install the DBD::mysql module. Chances are it will throw and error and not complete. This is the specific error I was seeing below:
1 2 3 4 5 6 7 8 9 |
t/10connect.t ........................ Bailout called. Further testing stopped: ERROR: Access denied for user 'root'@'localhost' (using password: NO) FAILED--Further testing stopped: ERROR: Access denied for user 'root'@'localhost' (using password: NO) gmake: *** [test_dynamic] Error 255 CAPTTOFU/DBD-mysql-4.027.tar.gz /usr/bin/gmake test -- NOT OK //hint// to see the cpan-testers results for installing this module, try: reports CAPTTOFU/DBD-mysql-4.027.tar.gz Failed during this command: CAPTTOFU/DBD-mysql-4.027.tar.gz : make_test NO |
So what that’s telling me is that the installer attempted to do testing by connecting to MySQL but was unable to, and thus ended in an error and exited the install process.
Now you have two options here, you can try and figure out why the install process was unable to connect to MySQL to do testing, and chances are it has something to do with this line from the installer log:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
PLEASE NOTE: For 'make test' to run properly, you must ensure that the database user 'root' can connect to your MySQL server and has the proper privileges that these tests require such as 'drop table', 'create table', 'drop procedure', 'create procedure' as well as others. mysql> grant all privileges on test.* to 'root'@'localhost' identified by 's3kr1t'; You can also optionally set the user to run 'make test' with: perl Makefile.PL --testuser=username |
As you can see the installer clearly shows and specifies the requirements for running make test which is actually being called during the installation process. So you could build from source and specify all of these options, or skip the testing, run this command below to force the installation:
First, exit from CPAN shell:
1 |
exit |
Next type in this command to force install DBD::mysql:
1 |
cpan -f -i DBD::mysql |
Using the above command to force the installation bypassed the testing and installed all modules and libs required. After that I had no problem using Watch MySQL or anything else connecting to MySQL using perl.
Profit!