The LDS logo Go to the Home Page Read about the company Read about our products Get some assistance Drop us a line

Jump to: Index | MySQL | Connecting to MySQL From A Web Application


This article explains how to connect to the Labyrinth Data Services MySQL server from an application running in your web space (such as a PHP or Perl script). If you are looking for a brief overview of MySQL or information on how to connect to MySQL using the command-line client, see Connecting To Mysql.

To use MySQL, you must first create a database using the Management Interface. The Creating Databases page contains information on how to do this.

MySQL access is provided on the standard port 3306, on the host 'mysql.labyrinthdata.net.au'. You can also use the shorthand 'mysql.ld.net.au' or just 'mysql' (the latter only directly from the shell server). MySQL sockets are not supported.

You should configure your web application to use this host and a database you have created.

For example, in PHP:

...
$conn = mysql_connect('mysql.labyrinthdata.net.au:3306', 'USERNAME', 'PASSWORD');
mysql_select_db('DATABASE', $conn);
...

In Python (using MySQLdb):

...
import MySQLdb
conn = MySQLdb.connect(host='mysql.labyrinthdata.net.au', port='3306', user='USERNAME', passwd='PASSWORD', db='DATABASE')
db = conn.cursor()
...

In Perl:

...
use DBI;

$dbstring = "dbi:mysql:database=DATABASE;host=mysql.labyrinthdata.net.au:3306";
$dbh = DBI->connect($dbstring, "USERNAME", "PASSWORD")
     or die "Cannot open database: $DBI::errstr";
...

If you are having difficulties, contact support and we can help.


Jump to: Index | MySQL | Connecting to MySQL From A Web Application

Site design and content © 2008 Labyrinth Data Services
ABN 48 235 864 103 Get Firefox