How do I connect to my MySQL database?

This article applies to 123-reg Linux Shared Hosting accounts.

This answer explains how you can connect to your MySQL database using a simple PHP script.

PHP is a scripting language designed for producing dynamic web pages.

The database itself does not exist as a file that you can upload or download using FTP, however, you can connect to the database using PHP.

For direct integration of the database into your web pages for dynamic updates we provide the HTML-embedded scripting language PHP.

The basic command that you need to use in your PHP script is one of the following:

If your database is useing server: cust-mysql-123-01

$mysql_link = mysql_connect("cust-mysql-123-01", "USERNAME", "PASSWORD")

If your database is useing server: cust-mysql-123-02

$mysql_link = mysql_connect("cust-mysql-123-02", "USERNAME", "PASSWORD")

If you require further details of commands needed to handle the database once you’re connected, please visit http://www.php.net/.

We also support CGI and PERL DB modules to allow you to connect. For further information regarding this method, please visit http://www.cpan.org/.

Offer

Answer options

Your feedback was successfully added.

Answer tracking

Track

Watch the content of this article for changes.