DBD::mysql is an implementation of DBI for MySQL, for Perl. It is required for running the MySQL Benchmark Suite scripts written in Perl language.
NOTE: Read more about DBI and libdbi.
We did not install DBD::mysql before installing MySQL Server, because DBD::mysql needs MySQL Server to be present prior to the installation.
DBD::mysql has mysql-libs package as a dependency. So we will compile and install DBD::mysql from source. Installing DBD::mysql from source code involves the following steps.
NOTE: Installation is performed based on the rules iRULE5 and iRULE1.
1) Installing missing dependencies
2) Downloading the source code
3) Unpacking and Installing
4) Post Installation procedures
1) Installing missing dependencies
Test::Deep is a perl module that provides extremely flexible deep comparison. It can handle circular data structures without getting caught in an infinite loop. It is required for utilising full features of DBD::mysql.
CentOS v6.3 DVD1 installation doesn’t come with Test::Deep package.
Perform the below steps for installing Test::Deep.
NOTE: Installation is performed based on the rule iRULE4.
♦ If you have an internet connection
♦ If you do not have an internet connection
If you have an internet connection
In the terminal, execute the following command.
# yum install perl-Test-Deep
OPTIONS EXPLAINED
install
Is used to install the latest version of a package or group of packages while ensuring that all dependencies are satisfied. (See Specifying package names for more information) If no package matches the given package name(s), they are assumed to be a shell glob and any matches are then installed. If the name starts with an @ character the rest of the name is used as though passed to the groupinstall command. If the name starts with a - character, then a search is done within the transaction and any matches are removed. If the name is a file, then install works like localinstall. If the name doesn’t match a package, then package "provides" are searched (Eg. "_sqlitecache.so()(64bit)") as are filelists (Eg. "/usr/bin/yum"). Also note that for filelists, wildcards will match multiple packages.
If you do not have an internet connection
Find a system that has an internet connection. Download the perl-Test-Deep package for CentOS v6.3 from http://vault.centos.org/6.3/os/i386/Packages/perl-Test-Deep-0.106-1.el6.noarch.rpm.
The size of downloaded RPM is 53.2 KB.
In the terminal, change to the directory holding the RPM file. Execute the following command.
# rpm -ivh perl-Test-Deep-0.106-1.el6.noarch.rpm
OPTIONS EXPLAINED -i This installs a new package. -v Print verbose information - normally routine progress messages will be displayed. -h Print 50 hash marks as the package archive is unpacked. Use with -v|--verbose for a nicer display.
2) Downloading the source code
DBD::mysql is available from the CPAN or Comprehensive Perl Archive Network. Goto http://search.cpan.org/~capttofu/DBD-mysql/. Click on Download. This will start the download.
The downloaded file DBD-mysql-4.027.tar.gz will be 134 KB in size.
3) Unpacking and Installing
Make sure you have copied the downloaded file DBD-mysql-4.027.tar.gz to directory /usr/src/. In the terminal, change to /usr/src/ directory.
# cd /usr/src
Extract the gzipped tarball containing DBD::mysql
# tar -xvzf DBD-mysql-4.027.tar.gz
OPTIONS EXPLAINED -x extract files from an archive -v verbosely list files processed -z filter the archive through gzip -f use archive file or device ARCHIVE
Now we will have directory DBD-mysql-4.027 with the extracted files. Switch to the directory in terminal.
# cd DBD-mysql-4.027
Execute the Makefile using Perl.
NOTE:
To see the complete configure options for DBD::mysql, execute the below command
command: # perl Makefile.PL –help
To see the complete configure options for DBD::mysql, see the link here.
# perl Makefile.PL --ssl
OPTIONS EXPLAINED
--ssl
Enable SSL support
This will check our system for required dependencies, assigns values for system-dependent variables and use these values to generate the Makefile.PL.
Execute make.
# make
make will look at our Makefile, compile our program code and create the executables in the sequence described.
Execute make install.
# make install
OPTIONS EXPLAINED
install
install will look for the target install in Makefile.PL, and install DBD::mysql to the specified location.
4) Post Installation Procedures
Adding DBD::mysql libraries to the shared library cache
NOTE: Before running this command, make sure you have added the directory /usr/local/ to the System library path as instructed here.
Run ldconfig.
# ldconfig
ldconfig scans the ld.so.conf.d folder and updates the shared library cache; so that dynamic-linker can find them during runtime.
Adding the DBD::mysql manpages to MANPATH
DBD::mysql manpages are located at /usr/local/share/man/. This path is already added in the /etc/man.config file. So we need not make any extra changes.
You may go back to the following section.
Installing MySQL Server