Lounge Network - Knowledge Base

  View Printer Friendly Version Search
KNOWLEDGE BASE HOME » 16. INFORMATION: DATABASE QUESTIONS Viewing Answer
[LINUX] How do I connect to a MySQL database?
Corporate and Business Plan Users:

MySQL Host Address:

Local: 127.0.0.1

Remote: Please log into your Control Panel at www.controlpanel.co.nz , and go to the databases section where your database is setup. This will tell you the remote database connection address to use.


cPanel Users:

MySQL Host Address: localhost


Example Connection Strings:
Perl: $dbh = DBI->connect("DBI:mysql:YOUR DATABASE HERE:localhost","YOUR DATABASE USERNAME HERE","PASSWORD HERE");
PHP: $dbh=mysql_connect ("localhost", "YOUR DATABASE USERNAME HERE", "PASSWORD HERE") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("YOUR DATABASE HERE");

KNOWLEDGE BASE HOME » 16. INFORMATION: DATABASE QUESTIONS Viewing Answer




Knowledgebase Manager

© Copyright Lounge Network 2001-2017