How do I use the Perl DBI module to access my MySQL database?
Please note: This support article is a guide for our Linux users only.
The following article explains how to connect to a MySQL database using Perl. A MySQL database can be accessed on our web servers using all of the programming languages available on the server, and Perl is one of the most commonly used languages. To access a MySQL database with Perl, the DBI module must be used. Using the DBI module will include all of the exported functions and constants from the DBI module necessary for your script to access your database.
In order to access your MySQL database with the Perl DBI module, please follow these steps:
- Log into your Linux web server via Secure Shell.
- Type the following at the prompt to include the DBI module in your script:
- Type the following connection string to connect to your database:
- $database: enter the name of your database
- $host: insert the name of the MySQL server that you are assigned to, for example, mysql4.safesecureweb.com
- $username: enter the username provided for your database
- $password: enter the password provided for your database
Note: Complete documentation for the Perl DBI module is available on our servers. Log into your web server via Secure Shell and type the following at the prompt:
$ perldoc DBI