You are here: Re: Remote MySQL Server « PHP Programming Language « IT news, forums, messages
Re: Remote MySQL Server

Posted by burgermeister01 on 08/14/07 20:39

On Aug 14, 3:18 pm, Jerim <wyo...@gmail.com> wrote:
> I have a script on one server, trying to access the MySQL database on
> another server. The server with the script is on an outside network,
> hosted with another company. The MySQL server is here in the
> office;behind a firewall. Script works fine when it is on the local
> machine, but when I moved it to the offsite webserver it gives me:
>
> Warning: mysql_connect() [function.mysql-connect]: Lost connection to
> MySQL server during query in /directory/directory2/functions/
> shared_data_connections.php on line 29
> Unable to connect to database.
>
> The script is:
>
> $username = "user";
> $password = "password";
> $hostname = "ip_address";
> $database = "database";
>
> $connection = mysql_connect($hostname, $username, $password)
> or die ("Unable to connect to database.");
> $open = mysql_select_db($database, $connection)
> or die ("Unable to select database.".mysql_error());
> return $connection;
>
> One obvious problem could be the firewall. But since making any
> adjustments to the firewall is frowned upon around here, I want to
> cover some other bases first. Want to get some evidence that it
> probably isn't something else. Any other ideas? I am very certain that
> the user/pass are correct and that is the correct IP address. I have
> also made certain that the user has access from any host.

My immediate thought, and this is more of a shot in the dark than
anything, but are you specifying the correct port number. It wouldn't
be an issue if you were on a local machine, but if you are connecting
to a remote host they might have MySQL running on a different port,
not to mention the SSH connection. If that doesn't help, I googled
this article which may be helpful:

http://blog.taragana.com/index.php/archive/mysql-tip-mysql-server-has-gone-away-or-lost-connection-to-server-during-query-fix/

Good luck!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация