Knowledge Base

We are not offering 24/7 telephone support at this time, please open a Support Ticket

  • knowledgebase
  • announcements
Search

Most Popular
Recently Added
Recently Updated

How do I connect to mySQL through Perl?

Use the following outline to connect and begin querying the mySQL server from a Perl script. Remember that you cannot connect to your databases remotely due to security concerns, you can only connect from localhost.

Accessing MySQL with the MySQL Perl Module

1. Declarations
You must require the mySQL package for your script to function properly. Do this by including the following line in your code: use Mysql;

2. Connect To The Database
Somewhere near the beginning of your script, you need to make your initial connection to the database server. Using the following form, substitute your database, username, and password for the examples to connect succesfully. Mysql->connect('localhost','DATABASENAME','USERNAME','USERPASSWORD');

3. Executing A Query
You are now ready to begin querying the database server. Most problems that you may incur will generally occur due to invalid permission settings for the specified user.


Properties ID: 000209   Views: 5236   Updated: 13 years ago
Filed under:
Support » Web Site » Web Hosting » Scripts
Support » Web Site » Web Hosting » Perl Tips

For news and system status updates, check: status.his.com

Check our Knowledge Base for How-To tips and answers to common questions.

We are not offering 24/7 telephone support at this time, please open a Support Ticket