MySQL Forums
Forum List  »  PHP

Connecting to remote MySQL database via PHP
Posted by: David Schöfberger
Date: June 10, 2014 11:30AM

Hello everbody!

I have a problem with my settings in my MySQL database. I am currently using this php connection file with database from a hosting provider and it is working fine.

<?php
define('DB_SERVER',"servername");
define('DB_NAME',"database");
define('DB_USER',"username");
define('DB_PASSWORD',"password");

$conn = mysqli_connect(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME);
if(is_resource($conn))
{
mysqli_query($conn, "SET NAMES 'utf8'");
mysqli_query($conn, "SET CHARACTER SET 'utf8'");
}
?>

Now I got a virtual server from dediserve and I have installed apache, php, mysql and phpmyadmin and I wanted to used this php for connecting to the new mysql database, but it is not working (bind-adresses is hash tagged). That is the error:

Warning: mysqli_connect(): (HY000/2002): Connection timed out in /home/.sites/201/site2655003/web/temperature/03/inc/db.inc.php on line 7

The port 3306 is open and also configured as the standard port.

Can you help me? I have researched for hours in the internet, but its still not working!

--David

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.