tags:

views:

17

answers:

1

Hi, I finished a web page in my computer and it was saved in my pen drive. Now I uploaded the files .html and .php to the server, and I exported the database of my pen drive and imported it on the web address using phpmyadmin. Seems like I'm having the following problem:

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/t1g01/doador.php on line 40

The files in my pen drive are working fine. But not in the server. Can anyone help me please? When I explore the tables in the http://address.com/phpmyadmin/ there are normal, with data.

I read something in another topic about restarting the mysql by typing /etc/init.d/mysql restart or ln -s /var/lib/mysql/mysql.sock /tmp/ . If that's solve my problem, where am I supposed to type this ? I'm new at this server stuff.

Sorry for any mistake in English, and thanks in advance for the attention.

+1  A: 

MySQL has a page for common errors and troubleshooting help: http://dev.mysql.com/doc/refman/5.1/en/common-errors.html

I also contributed a wiki page about connection troubleshooting: http://forge.mysql.com/wiki/Error2003-CantConnectToMySQLServer

You should also check whether your MySQL instance is using /tmp/mysql.sock or some other location for the mysql.sock file. It's not uncommon for PHP and MySQL to have different ideas about where that file lives.

So check php.ini and mysql.cnf on your server.

Bill Karwin