Support
- Advanced Backup
- Client Side
- Cloud Enterprise
- ColdFusion
- Control Panel
- cPanel
- Customer Portal
- DNS Information
- Dedicated Servers
- DirectAdmin
- Domain Name
- dotDefender
- Dreamweaver
- FileCatalyst
- Front Page
- FTP
- General Information
- Hosted Exchange & SharePoint
- IIS6
- IIS7
- Juniper Netscreen Firewalls
- Linux
- List Server
- MIVA Merchant
- MySQL
- Adddatabase
- Amconversion
- Aspstring
- Coldfusionstring
- Connectionstrings
- Phpmyadmin
- Upgradedatabase
- Mysql
- Backup my MySQL database via SSH
- Change the collation on a MySQL database via PhpMyAdmin
- Repair a corrupt or invalid MySQL table
- Import and Export MySQL dump file from phpMyAdmin
- Manage your MySQL Database with Navicat
- Use Sequel Pro for Mac OS X to manage MySQL databases
- Optimize MySQL Databases in Plesk
- Access
- Controlpanel
- Perl
- Advisable MMM Solutions
- Managing Your MMM Environment
- Php
- Common Issues With MMM
- How To Add A Timeout Variable
- Patching / Server Updates
- phpMyAdmin
- Plesk
- Policies and Procedures
- Premium Spam Filtering
- Programming
- Ruby on Rails
- Search Engine Submission
- SharePoint 3
- SharePoint 2010
- SiteDesigner
- SmarterMail 3
- SmarterMail 4
- SmarterMail 5
- SmarterMail 6
- SmarterMail 7
- SmarterStats
- SmarterTrack
- SQL Server
- Secure Socket Layer (SSL)
- Uploading Your Website
- Video Tutorials
- Windows Server 2003
- Windows Server 2008
- Web Design
- WordPress
- Advanced Monitoring
- MediaWiki
- Enkompass
- Microsoft Outlook 2010
- Android
- Outlook Web Access
- Critical Availability Service
- NAS Data Transfer
- Customer Portal Demos
- Joomla
- Moodle
- Cloud Dedicated
- Gallery CMS
- phpBB
- Standard Monitoring
- Righteous Restore
- NAS (Network Attached Storage)
- Networking
- SmarterMail 8
- PCI Security Scan
- LinkTiger
- Windows Cloud VPS
- Linux Cloud VPS
- Linux VPS
- Windows VPS
- Hyper V
- ENSIM
- Alert Logic
- Webmin
- e107
- Vbulletin
- VPN
- Visual Vault
- Mozilla Thunderbird
- PyroCMS
- Active Directory
- Vmware Related
- Drupal
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:
use DBI; - Type the following connection string to connect to your
database:
$connection=DBI-
>connect("DBI:mysql:database=$database;host=$host:port=3306",
$username, $password);- $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
