Page 1 of 1

Connect to External Db

PostPosted: 04. August 2010 15:09
by emanresu
Since upgrading to 1.7.2 from 1.6.xx, my development sites running on Xampp can no longer connect to an external DB

Error message is

Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'dbxxxx.oneandone.co.uk' (11004) in C:\xampp\htdocs\xxxxx\db.php on line 9
Couldn't connect to MySQL

Nothing has been changed at the server side so its either a version issue or a Xampp config issue.

Someone has suggest that its a conflict with MySQLi and 1and1.

Anyone else with the problem and what was the solution?

Re: Connect to External Db

PostPosted: 04. August 2010 19:53
by JonB
What's the difference in the PHP and MySQL versions in XAMPP?

Any chance of a non-standard MySQL port?

Good Luck
:)

Re: Connect to External Db

PostPosted: 22. August 2010 10:40
by emanresu
1and1 suggests connecting through for "/tmp/mysql5.sock" mysql5 and suggests the following

<?php
$hostname="localhost:/tmp/mysql5.sock";
$username = "dbxxxxxx";
$password = "xxxxxx";
$database="xxxxxx";
$link = mysql_connect("$hostname", "$username", "$password", "$database");
if (!$link) {
die('connection failed: ' . mysql_error());
}
echo 'connection established successfully';
mysql_close($link);
?>

Still runs into problems

I've seen suggestions to add lines to .htaccess and/or php.ini but no joy.


Anyone successfully connecting to 1and1's Mysql5 databases externally?

Re: Connect to External Db

PostPosted: 22. August 2010 16:27
by JonB
From what I know (a fair amount) I'm pretty sure you should not need a proxy (the /tmp thing) for a remote connection. In theory, pretty much all MySQL databases in the same version are equivalent. There are two different types of connectors - but they have to do with whether its a Unix scoket or TCP/IP.

SO - it just occurred to me that your user might not have been GRANTed adequate PRIVILEGES. That could be from a security tightening at the host, and not be a XAMPP issue. Its worth checking.

Most database setups assume that the users will connect from localhost. Use their database administration tool and browse the MySQL database for the User permissions - if the user you are connecting as has 'host' set to localhost - that's the problem. You can either specify % as a wildcard - connect from any host, an IPv4 address, or a DNS resolvable hostname.

On some hosts, they have to fix that for you.

Edit - I have never used them - Does 1and1 have user forums?

Good Luck