Connect to External Db

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Connect to External Db

Postby emanresu » 04. August 2010 15:09

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?
emanresu
 
Posts: 2
Joined: 04. August 2010 15:02

Re: Connect to External Db

Postby JonB » 04. August 2010 19:53

What's the difference in the PHP and MySQL versions in XAMPP?

Any chance of a non-standard MySQL port?

Good Luck
:)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Connect to External Db

Postby emanresu » 22. August 2010 10:40

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?
emanresu
 
Posts: 2
Joined: 04. August 2010 15:02

Re: Connect to External Db

Postby JonB » 22. August 2010 16:27

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
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 167 guests