Bookmark and Share

PERL - MySQL Module

MySQL queries and the like can be executed with PERL via the MySQL Module. This module should already be installed with your web server if not contact your web host.

Advertise on

As a quick overview, this module installs the necessary functions required to execute MySQL queries using a PERL script. Please take note that this module only works with the MySQL platform. Other SQL platforms will require the use of the DBI module discussed in our PERL DBI Module lesson.

PERL - MySQL Config

Before we dive head first into the functions, we may want to set up some config variables that we will be calling upon in each script to first connect to our database. Have the following information easily accessible.

  • Our Web Host's data source name (DSN)
  • User Name for the MySQL Database
  • Password for the MySQL Database
  • Name of Database
  • Name of Table(s)


use Mysql;

$host = "localhost";
$database = "store";
$tablename = "inventory";
$user = "username";
$pw = "password";

A config set-up like this simplifies our connection script and the queries that will be executed later.

Bookmark and Share

Found Something Wrong in this Lesson?

Report a Bug or Comment on This Lesson - Your input is what keeps Tizag improving with time!

Advertise Here

More Tutorials!
Microsoft Office Tutorials Artist Tutorials