RE: [PHP] Can't connect php to mysql on linux

From: Date: Thu, 01 Mar 2001 17:34:04 +0000
Subject: RE: [PHP] Can't connect php to mysql on linux
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-42197@lists.php.net to get a copy of this message
Also, consider getting PHP 4 on your system. PHP 3 is old hat. > -----Original Message----- > From: php3@developersdesk.com [mailto:php3@developersdesk.com] > Sent: Saturday, February 24, 2001 11:33 AM > To: George Alexander; php-general@lists.php.net > Subject: Re: [PHP] Can't connect php to mysql on linux > > > Addressed to: "George Alexander" <george_ax@rediffmail.com> > php-general@lists.php.net > > ** Reply to note from "George Alexander" > <george_ax@rediffmail.com> 24 Feb 2001 05:40:59 -0000 > > > > Hi, > > > > I working on Redhat Linux 6.1 and I've installed > > MySQL-3.23.33-1.i386.rpm and MySQL-client-3.23.33-1.i386.rpm. > > MySql is working fine. I've even created a database also using > > MySqlAdmin. > > Regarding Php I've installed php-3.0.18-1.6.x.i386.rpm and as for > > Apache : apache-1.3.14-2.6.2.i386.rpm. > > I've even installed php-mysql-3.0.16-1.i386.rpm and > > mod-php3-3.0.12-2.i386.rpm. > > > > My problem is I can't connect PHP to Mysql Db using the > > mysyql_connect("localhost","root","mypassword") command. > > > mypassword is the same password you used for mysqladmin, and the command > line interpreter for the root user, right? > > > Try this command and see what it returns. If the error message doesn't > give you a good idea what is wrong, please post again, including the > error message you receive. > > > mysql_connect( "localhost", "root", "mypassword" ) or > die( "Unable to connect<BR>" . mysql_error()); > > > I suggest you always use this code, along with: > > mysql_select_db( "database" ) or > die( "Unable to select<BR>" . mysql_error()); > > in every program you write. It is almost impossible to troubleshoot > problems if you don't know what went wrong. > > > > > Rick Widmer > Internet Marketing Specialists > http://www.developersdesk.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#42197) next »