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