Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I got this error on my php script with db:

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

and on phpmyadmin:

#2002 Cannot log in to the MySQL server

What is the problem, how can i fix this? I have installed lamp-server..

share|improve this question
If the answer below does not fix it, it would be advisable to show your php code. – medigeek Dec 28 '11 at 12:50
related question -> askubuntu.com/questions/69380/… – hhlp Dec 28 '11 at 13:12
When i use myql -u root -p i get message that it cant connect. – mirzadelic Dec 28 '11 at 17:25

1 Answer

up vote 2 down vote accepted

It seems that the mysql server is not running.

In a normal mysql installation, you can check if the server is running with the following command: service mysql status

For starting it, just run service mysql start.

share|improve this answer
It is running, i checked. Any other solution ? Can i reinstall only mysql, but i have installed lamp server, so it work make any difference to other modules ? And please give me commands to reinstall mysql – mirzadelic Dec 28 '11 at 17:49
Could you check what happens after restarting the server? (service mysql restart) – el.atomo Dec 28 '11 at 18:11
I checked that, but i fixed this with uninstaling mysql-server and mysql-common, then i installed mysql-server and phpmyadmin, and it works, now.. Thanks. – mirzadelic Dec 28 '11 at 22:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.