How can I connect to mysql server using PHP?

2006-06-27 Thread

Hello everyone:
 I wanna connect to mysql server using PHP. My operating system is Redhat 
Fedora Core 4, and the version of mysql is 4.1.3 beta. I've started the server 
using a statement like this:
#/usr/local/mysql/bin/mysqld -uroot -S/var/lib/mysql/mysql.sock
But when I call mysql_pconnect(localhost,root,) in my web page, the 
server return me an error, saying Can't connect to 
socket:/var/lib/mysql/mysql.sock(13). How can I do?


Fang 
   




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Re: I can't connect to mysql server with PHP

2006-05-23 Thread

Hi! gerald_clark,
But when I call mysql_pconnect(localhost:3306,root,root_password),it 
return the same error. How can I get the permission to open 
/var/mysql/lib/mysql.sock?
   Fang



fool.ben wrote:

Hi everybody!
I've install a mysql server on my computer. The operating system is Redhat 
fedora core 4. The version of the mysql server is 4.1.3 Beta. I wanna connect 
to the server using the following statement:
$db_connection=mysql_pconnect(localhost,root,);
The server returned the error 2002:
2002 Can't connect to local MySQL server through socket 
'/var/mysql/lib/mysql.sock(13)' 
  

The user running the php connection does not have permissions to open
/var/mysql/lib/mysql.sock.

I was suggested that the server may not running, or the sockect is wrong. But 
when I run the following statement, there was no error occured:
localhost#/usr/local/mysql/bin/mysql -uroot -S/var/mysql/lib/mysql.sock
  

Here you are root, so you have permissions.

Can anyone help me?
  

Fix your permissions or move your socket to a directory that is world
searchable.

 
 Fang
  



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]