JavaScript Editor Js editor     Website development 

Main Page

Previous Page
Next Page

Installing Perl with MySQL Support on Windows

Although Perl was not created with Windows in mind, to program in Perl on your Windows computer is remarkably easy thanks to a product called ActivePerl. ActivePerl is freely distributed by ActiveState, which you can find at ActivePerl is a complete Perl package, easy to install and run on any Windows platform.

Along with Perl, you will need the DBI and DBD modules to write scripts that interact with MySQL. On Windows, with ActivePerl, you can use the Perl Package Manager (PPM) to add the extra DBI and DBD modules. The PPM comes with ActivePerl and simplifies the task of installing CPAN modules. (CPAN, short for Comprehensive Perl Archive Network, is a library of shared code that simplifies common programming tasks.) Despite all of these different tools, the only requirement of the following installation instructions is that you are connected to the Internet as you proceed through them.

To install Perl with MySQL support on Windows:

Download the most current version of ActivePerl from

If you are installing ActivePerl on Windows 2000 or XP, you need to download only the Windows Installer Package (an MSI file). Otherwise, you'll see the other requirements for installation when you go through the download steps. At the time of this writing the current version of ActivePerl was

Run the downloaded executable by double-clicking the file (Figure 8.1).

Figure 8.1. The ActivePerl Setup Wizard will take you through the installation of Perl on Windows.

The installer will take you through a few steps, giving you prompts at certain points to help customize the installation. Accepting the default settings will best ensure problem-free operation of ActivePerl.

Do make sure that you install the PPM (Perl Package Manager) on the Setup page (Figure 8.2).

Figure 8.2. The PPM (Perl Package Manager) must be installed in order to easily add Perl support for MySQL.

This concludes the installation of ActivePerl on your system. Now you'll need to install the database modules.

Access a DOS prompt.

There are many ways of doing this, including clicking the Start menu, selecting Run, and entering cmd in the box that appears (then pressing Enter).

Test that Perl was successfully installed by entering the following and pressing Enter (Figure 8.3):

Figure 8.3. If ActivePerl was installed correctly, you should see a message like this after running perl -v.

perl -v

The command perl -v will report on the version of Perl currently installed and running on your system, along with any other pertinent information. This is a simple test of the installation.

At the prompt, type ppm and press Enter (Figure 8.4).

Figure 8.4. The Perl Package Manager simplifies the installation of extra Perl modules.

This command should start up the ActivePerl Perl Package Manager. You'll see a ppm> prompt once you are within the application.

Install the DBI module by typing this at the prompt and pressing Enter:

install DBI

PPM will download and install all of the necessary files, reporting on its success (Figure 8.5).

Figure 8.5. Using PPM, you should first install the DBI module for general database interactions.

Install the MySQL module for Perl (Figure 8.6).

Figure 8.6. To use Perl with the MySQL database in particular, you'll need to install the DBD-MySQL package.

install DBD-MySQL

Once the DBI package has been installed, you'll need to install the database-specific modules, such as DBD-MySQL. The Perl scripts will use DBI and DBD-MySQL together to connect to the databases.

Exit out of PPM by typing quit and pressing Enter.


  • ActivePerl is also available in versions for other operating systems, although it's most frequently used as a Windows solution for Perl.

  • To learn more about Perl and CPAN, see and, respectively.

  • If you intend to use Perl to write CGI scripts, run install CGI within PPM.

  • Within PPM you can check what modules have been installed by entering query term within the application (after Step 5). For example, query mysql should reveal that DBD-mysql is installed.

  • You might see PPM referred to as either the Perl Package Manager or the Programmer's Package Manager.

Previous Page
Next Page

JavaScript Editor Js editor     Website development