Connecting to MySQL database server
Remote connection
Our MySQL database server is available externally, if you wish to login to the server using a third party software program. Below are the connection details:
Server hostname: mysql.yourdomainname
NOTE: SHOW_DATABASES command is prohibited on this server for security reasons, therefore you must use a program which does not require this function in order to connect. In other words, the MySQL GUI software available from the MySQL website will not be successful in connecting to our database server.
As a solution, we recommend MySQL Front software to use for external connection to the database server.
Script connection
You can use three languages to connect to the database via a website. Please find sample code below for Java, PHP, Python and CGI/Perl developers.
Java
//ensure that the driver is loaded
Class.forName("com.mysql.jdbc.Driver").newInstance()
Connection conn = null;
String connectionString = "jdbc:mysql://mysql.yourdomainname/dbname_domain_com";
String username = "dbusername";
String password = "dbpassword";
try {
conn = DriverManager.getConnection(connectionString,
username,
password);
} catch (SQLEException sqle) {
//handle your exception;
}
PHP
<?
$host = "mysql.yourdomainname";
$dbname = "dbname_domain_com";
$username = "dbusername";
$password = "dbpassword";
$connection = mysql_connect($host, $username, $password);
mysql_select_db($dbname,$connection);
/*
Check to see if connection was successful
*/
?>
CGI/ Perl
use DBI;
my $dbh = DBI->connect('Dbi:mysql:dbname=dbname_domain_com;host=mysql.yourdomainname',
'dbusername',
'dbpassword'
) || die "Database connection not made: $DBI::errstr";
NOTE: The values for "dbname_domain_com", "dbusername" and "dbpassword" should be replaced with the actual values corresponding to your MySQL database.
|