perl+CGI+mysql !!!!!!!

hi expert,

I am totally new to perl CGI coding. And stop by below issue:

1> i have a script names conn.pl, which can connect to mysql and get the information of table user(id,name)
2> i copied above code into one CGI web page named user.cgi
3> when i view user.cgi in web browser, it toldme 'Can't connect to Mysql server through socket ....'
4> i erase the mysql related code, the page can be displayed correctly with input box and botton as well

I searched on internet, all answer said i did not start my mqsqld service, but actaully it has been started. So here i assume there is some limition between my apache server and mysql server.

Can anybody help me a little. Thanks very much.

There're no depends between mysqld and httpd.

Try to connect to the database using just a mysql client.
mysql -u user -h host -p

It doesnt help much .. can you post code ? it should work .. as far as i know there is no limitation between apache and mysql. Restart the mysql server
see this
Solve: Can�t connect to local MySQL server through socket /tmp/mysql.sock | MySQL | Tech-Recipes

Hi All,

Thanks for you reply.

The real scenario is:
1> i can connect to mysql by client.
2> i can use DBI code to connect mysql database and get information, for example, in my code i can extract table data and write into one file
3> but when i copied avobe code into a cgi-script and try to call the page in web browser, it does not work then

Hope you are clear now. Thanks very much.