Let’s start with a review of how to install the
DBD::mysql driver, and how to use that driver to perform
traditional interactions (i.e., those not using stored programs) with
MySQL. These form the building blocks that we can use to work with
stored programs. However, if you are already familiar with the Perl
DBI, you may wish to skip forward to "Executing Stored Programs with
DBD::mysql,” later in this chapter.
To access MySQL from Perl, you will normally use the
DBD::mysql is a Perl package that
implements the classes defined by the DBI package that allow Perl to
interact with relational databases in a database-independent
The DBI package is probably already included in your Perl distribution. If it is not, you can follow the instructions given in this section.
Make sure to install the DBI package before
The easiest way to install
DBD::mysql on a Linux/Unix system is to
use the CPAN (Comprehensive Perl Archive Network) shell. To invoke
the CPAN shell, run the following command from a command line (as
[root@guyh3 root]# perl -MCPAN -e 'shell'
This invokes the CPAN command line:
[root@guyh3 root]# perl -MCPAN -e 'shell' cpan shell -- CPAN exploration and modules installation (v1.61) ReadLine support enabled cpan>
You can then type
DBD::mysql to download, build and install the
DBD::mysql driver. It’s probably best ...