MySQL connectivity from Perl is handled in the same way that you can communicate with many other types of database: using the Perl Database Interface, or DBI.
If you have already used DBI with another database, you already know the essentials and will find it very easy to interface with MySQL.
DBI is independent of the database back ends and uses a specific database driver module, known as DBD, to interface with each DBMS.
If you do not already have DBI installed, use cpan to download and install it, as follows. You should either run this command as the root user on your system or have your system administrator run it for you.
# cpan cpan> install DBI
The installation process produces a lot of output as it downloads and installs DBI and any other modules that it is dependent upon.
You also need to install a database driver for MySQL, which is called DBD::mysql. Enter this command at the cpan> prompt:
cpan> install DBD::mysql
On Windows systems using the ActivePerl distribution, use the ppm.bat script to install Perl modules, as follows:
C:\perl\bin> ppm.bat ppm> install DBI ... ppm> install dbd::mysql