From owner-freebsd-database@FreeBSD.ORG Mon Feb 13 16:52:38 2006 Return-Path: X-Original-To: freebsd-database@freebsd.org Delivered-To: freebsd-database@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 360F816A423 for ; Mon, 13 Feb 2006 16:52:38 +0000 (GMT) (envelope-from maillist@brundoggy.com) Received: from outbound1.mail.tds.net (outbound1.mail.tds.net [216.170.230.91]) by mx1.FreeBSD.org (Postfix) with ESMTP id A54B543D69 for ; Mon, 13 Feb 2006 16:52:30 +0000 (GMT) (envelope-from maillist@brundoggy.com) Received: from outaamta02.mail.tds.net (outaamta02.mail.tds.net [216.170.230.32]) by outbound1.mail.tds.net (8.13.4/8.12.2) with ESMTP id k1DGqQOK019080; Mon, 13 Feb 2006 10:52:29 -0600 (CST) Received: from krynn.brundoggy.com ([66.222.49.214]) by outaamta02.mail.tds.net with ESMTP id <20060213165224.JDLZ18752.outaamta02.mail.tds.net@krynn.brundoggy.com>; Mon, 13 Feb 2006 10:52:24 -0600 Received: from mdsnwikwbas08-pool26-a214.mdsnwikw.tds.net (mdsnwikwbas08-pool26-a214.mdsnwikw.tds.net [66.222.49.214]) by krynn.brundoggy.com (8.12.10/8.12.10) with ESMTP id k1DGqLgK037475; Mon, 13 Feb 2006 10:52:21 -0600 (CST) Date: Mon, 13 Feb 2006 10:52:20 -0600 (CST) From: "S. Greg Cuff" X-X-Sender: sgc@krynn.brundoggy.com To: freebsd-database@freebsd.org In-Reply-To: <43F051C3.7090704@quip.cz> Message-ID: <20060213092504.D37371-100000@krynn.brundoggy.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: Subject: Re: Error connecting to mysql via php X-BeenThere: freebsd-database@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Database use and development under FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2006 16:52:38 -0000 I received the same message using $host = '192.168.1.2'; or $host = '192.168.1.2:3306'; It was my understanding that only if the host is null or the string is 'localhost' then sockets would be used to connect to the database. This seems such a drastic solution and I'm reluctant to do this but, should I delete any packages and reinstall? If, so what is the best way to go about this? Any preferred order? Thanks, Greg On Mon, 13 Feb 2006, Miroslav Lachman wrote: ...S. Greg Cuff wrote: ... ...> Here is the ERROR: ...> Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) ...> ...> Background: ...> ...> Two servers running FreeBSD v6.0 STABLE ...> ...> Server1: apache-2.2.0_2, php5-5.1.1, php5-mysql-5.1.1, ...> mysql-client-5.0.16 ...> Server2: mysql-server-5.0.16, mysql-client-5.0.16 ...> ...> What I've tried: ...> ...> 1. Connecting via command line works fine: ...> me@server1% mysql -h server2 -p -u me ...> Enter password: ...> Reading table information for completion of table and column names ...> You can turn off this feature to get a quicker startup with -A ...> ...> Welcome to the MySQL monitor. Commands end with ; or \g. ...> Your MySQL connection id is 64 to server version: 5.0.16 ...> ...> Type 'help;' or '\h' for help. Type '\c' to clear the buffer. ...> ...> mysql>quit; ...> ...> 2. Connecting via php (error above): ...> $host='server2'; ...> $user='me'; ...> $passwd='mypassword'; ...> ...> $cn = mysql_connect("$host", "$user", "$passwd"); ...> if(!$cn) ...> { ...> die(mysql_error()); ...> } ...> ...> I am assuming the reason the /tmp/mysql.sock file doesn't exist on server1 ...> is because mysql is not running on this server. ...> ...> Thanks in advanced, ...> ...> Greg ... ... ...Try to connect with IP address instead of hostname. AFAIK .../tmp/mysql.sock is used for localhost connections only. ... ...Miroslav Lachman ...