Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am in a problem. I have accidentally deleted etc/mysql by writing sudo rm -r /etc/mysql .How can i restore it or if not then what to do next .when I am typing mysql command its saying :

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) what to do next ?

share|improve this question

migrated from stackoverflow.com Nov 1 '10 at 11:43

This question came from our site for professional and enthusiast programmers.

do you have a backup? /etc/mysql has "only" configuration files, right, not your database? –  Thilo Nov 1 '10 at 5:38
that is about as non accidentally an issue I've ever seen. "I accidentally died when I pointed a gun at my head and pulled the trigger - how do I fix it?"... This is a natural selection. –  Marm0t Nov 1 '10 at 6:04

3 Answers 3

up vote 3 down vote accepted

Go to your most recent backups and restore all the files. And. if you don't have a recent backup, why the blazes not?

Assuming you can get the information back using what will undoubtedly be some good answers here, institute a backup policy!. Disk space is ridiculously cheap.

Marked CW since it doesn't answer your specific problem but it is useful, mark my words. Anyone who reads this answer and doesn't back up their stuff in a timely manner, take heed, you will get burnt (and, if it's your digital photo collection of wife and kids from the last ten years, your wife will have every right to castrate you while you sleep).

If this happens to you again, you deserve all the angst you'll get and I will openly mock and deride you :-)

share|improve this answer
there are 2 types of admins: those who have lost data, and those who have not ... yet. But it is not funny when it happens to you. –  natxo asenjo Nov 1 '10 at 12:33

What about just reinstalling mysql then?

share|improve this answer
I have tried but not working..... –  Subhransu Nov 1 '10 at 6:00
@yosanu: well - if you have reinstalled /etc - you have to get the fresh and ready to work mysql. –  zerkms Nov 1 '10 at 6:02
@zerkms how to do that. –  Subhransu Nov 1 '10 at 6:06
@yosanu: I'm sorry, but I think you need to learn linux basics? –  zerkms Nov 1 '10 at 6:11
@zerkms KO fine.....bebye –  Subhransu Nov 1 '10 at 6:13

Try removing everything... and then creating a database from the control panel again, it should bring back the directory.

share|improve this answer

Your Answer


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.