> ## Documentation Index
> Fetch the complete documentation index at: https://kb.mochahost.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Accessing your MySQL database with Perl

The Perl module, DBI.pm is a convenient way to connect to the database from within Perl scripts. Please read the documentation about DBI.pm. Full documentation for the Perl module use is available from [this link](http://search.cpan.org/~timb/DBI-1.622/DBI.pm#NAME)

Please be advised that Mochahost can not support your custom programming or scripts.

Here are the basics of connecting:

NOTE: substitute the following values in the script below:

\$hostname = "Your-DB-Server-Hostname"

NOTE: We use Remote MySQL servers for most shared packages, [check this article](https://clientarea.mochahost.com/knowledgebase/675) for details on what your hostname might be.

`$database = the new database 
 $user = your username and $password = the password you set. 
 use DBI; $driver = "mysql"; 
$dsn = "DBI:$driver:database=$database; 
host=$hostname"; 
$dbh = DBI->connect($dsn, $user, $password);`
