From owner-freebsd-database@FreeBSD.ORG Mon Feb 13 04:04:49 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 6E36816A420 for ; Mon, 13 Feb 2006 04:04:49 +0000 (GMT) (envelope-from maillist@brundoggy.com) Received: from outbound3.mail.tds.net (outbound3.mail.tds.net [216.170.230.93]) by mx1.FreeBSD.org (Postfix) with ESMTP id CCF6E43D48 for ; Mon, 13 Feb 2006 04:04:48 +0000 (GMT) (envelope-from maillist@brundoggy.com) Received: from outaamta02.mail.tds.net (outaamta02.mail.tds.net [216.170.230.32]) by outbound3.mail.tds.net (8.13.4/8.12.2) with ESMTP id k1D44jaq007876 for ; Sun, 12 Feb 2006 22:04:47 -0600 (CST) Received: from krynn.brundoggy.com ([66.222.49.214]) by outaamta02.mail.tds.net with ESMTP id <20060213040445.DDJO18752.outaamta02.mail.tds.net@krynn.brundoggy.com> for ; Sun, 12 Feb 2006 22:04:45 -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 k1D44ggK035965 for ; Sun, 12 Feb 2006 22:04:42 -0600 (CST) Date: Sun, 12 Feb 2006 22:04:41 -0600 (CST) From: "S. Greg Cuff" X-X-Sender: sgc@krynn.brundoggy.com To: freebsd-database@freebsd.org Message-ID: <20060212213438.O35939-100000@krynn.brundoggy.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: 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 04:04:49 -0000 Hi, I've searched and searched and am a little numb at this point. I haven't been able to find a solution to an error I am receiving when attempting to connect to a remote mysql server with a php script. 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 From owner-freebsd-database@FreeBSD.ORG Mon Feb 13 09:30:46 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 9289D16A420 for ; Mon, 13 Feb 2006 09:30:46 +0000 (GMT) (envelope-from 000.fbsd@quip.cz) Received: from home.quip.cz (grimm.quip.cz [213.220.192.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2913043D48 for ; Mon, 13 Feb 2006 09:30:45 +0000 (GMT) (envelope-from 000.fbsd@quip.cz) Received: from [192.168.1.2] (qwork.quip.test [192.168.1.2]) by home.quip.cz (Postfix) with ESMTP id E7B1B61F8; Mon, 13 Feb 2006 10:30:43 +0100 (CET) Message-ID: <43F051C3.7090704@quip.cz> Date: Mon, 13 Feb 2006 10:30:43 +0100 From: Miroslav Lachman <000.fbsd@quip.cz> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: cs, cz, en, en-us MIME-Version: 1.0 To: "S. Greg Cuff" References: <20060212213438.O35939-100000@krynn.brundoggy.com> In-Reply-To: <20060212213438.O35939-100000@krynn.brundoggy.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-database@freebsd.org 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 09:30:46 -0000 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 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 ... From owner-freebsd-database@FreeBSD.ORG Mon Feb 13 19:59:54 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 20E9516A420 for ; Mon, 13 Feb 2006 19:59:54 +0000 (GMT) (envelope-from justin.bastedo@gmail.com) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.202]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9F7E443D45 for ; Mon, 13 Feb 2006 19:59:53 +0000 (GMT) (envelope-from justin.bastedo@gmail.com) Received: by xproxy.gmail.com with SMTP id i26so733651wxd for ; Mon, 13 Feb 2006 11:59:53 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Q4rk9cpDKOUqGJavWy0+QZrF26C6J6NGyz77l/bQgAxpTTnvlbeu5IgFO5fHQDnQji05g0ILN0da464keIb4jmuUTHMcD4T2ZqDUYro6udrn4yys0JRpPXr6ywUcmDnRZa7UxMBLR52zXMCA+30uTOM//tild7feKCWCFWm/He8= Received: by 10.70.79.17 with SMTP id c17mr2653942wxb; Mon, 13 Feb 2006 11:59:52 -0800 (PST) Received: by 10.70.36.14 with HTTP; Mon, 13 Feb 2006 11:59:52 -0800 (PST) Message-ID: <8a5255240602131159u295cafc4x4939a6451db9fef4@mail.gmail.com> Date: Mon, 13 Feb 2006 11:59:52 -0800 From: Justin Bastedo To: Miroslav Lachman <000.fbsd@quip.cz> In-Reply-To: <43F051C3.7090704@quip.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20060212213438.O35939-100000@krynn.brundoggy.com> <43F051C3.7090704@quip.cz> Cc: freebsd-database@freebsd.org 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 19:59:54 -0000 One thing to check, don't think it applies to the version you are using but has caused me a similar problem in the past. Make sure your php compiled mysql client and mysql server are using the same encryption schema on the password. http://dev.mysql.com/doc/refman/5.0/en/old-client.html Another thing is what does the die display? whats the mysql Error? that might help give a bit more information. On 2/13/06, Miroslav Lachman <000.fbsd@quip.cz> 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=3D'server2'; > > $user=3D'me'; > > $passwd=3D'mypassword'; > > > > $cn =3D mysql_connect("$host", "$user", "$passwd"); > > if(!$cn) > > { > > die(mysql_error()); > > } > > > > I am assuming the reason the /tmp/mysql.sock file doesn't exist on serv= er1 > > 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 > _______________________________________________ > freebsd-database@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-database > To unsubscribe, send any mail to "freebsd-database-unsubscribe@freebsd.or= g" > -- Justin Bastedo At Gmail Dot Com -------------------------------------------------- http://www.thebastedo.com