List:General Discussion« Previous MessageNext Message »
From:JC Date:March 9 2006 8:11pm
Subject:RE: php and mysql
View as plain text  
On Thu, 9 Mar 2006, Mary Adel wrote:

> Thanks for al your help and i di that and now i have another error
>
> Can't connect to local MySQL server through socket
> '/var/lib/mysql/mysql.sock' (2)
> my code is as follows:
>
> <?php
> print "hi";
> mysql_connect('localhost', 'root','') or die(mysql_error());
> echo "Connected to MySQL<br />";
> print "connected";
> ?>
> if u can help in this i ll appreciate that a lot
>
>
> On Thu, 2006-03-09 at 13:37 -0500, fbsd_user wrote:
>> You need a login id and password unless this is test DB added under
>> ID "root"
>> You have to use the same login id as the one you created the
>> db/table with.
>>
>> mysql_connect('localhost', 'Login id', 'pw') or die(mysql_error())
>>
>> mysql_connect('localhost', 'root') or die(mysql_error())
>>
>>
>> -----Original Message-----
>> From: Mary Adel [mailto:mary.adel@stripped]
>> Sent: Thursday, March 09, 2006 3:06 PM
>> To: mysql@stripped
>> Subject: php and mysql
>>
>>
>> I have a severe problem that php5 cannot connect to mysql and i
>> don't
>> know why
>> also i am using linux
>> here is my peice of code
>> :<?php
>> print "hi";
>> mysql_connect('localhost', '', '') or die(mysql_error());
>> echo "Connected to MySQL<br />";
>> print "connected";
>> ?>
>> if their is any configuration please tell me
>>
>> thanks,
>> mary
>>
>>
>> --
>> MySQL General Mailing List
>> For list archives: http://lists.mysql.com/mysql
>> To unsubscribe:
>> http://lists.mysql.com/mysql?unsub=1
>>
>>
>
>
>

-- 

hi mary,

take a look at 
http://www.stanton-finley.net/fedora_core_5_installation_notes.html#MySQL.

basically, you need to make sure that your mysql server accepts local 
connection.

if you login to your mysql server:
mysql -u root (if no password for root) or
mysql -u root -p (if there is pw for root)

and then:
select user,host,password from mysql.user;

if you don't see an entry for root & localhost, then you need to add it 
in.

hope that help.
JC
Thread
php and mysqlMary Adel9 Mar
  • RE: php and mysqlfbsd_user9 Mar
    • RE: php and mysqlMary Adel9 Mar
      • RE: php and mysqlJC9 Mar
  • Re: php and mysqlPeter Brawley9 Mar
RE: php and mysqlSST - Adelaide)9 Mar
  • RE: php and mysqlmysql9 Mar
  • RE: php and mysqlIng. Edwin Cruz9 Mar