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 ?

  • do you have a backup? /etc/mysql has "only" configuration files, right, not your database? – Thilo Nov 1 '10 at 5:38
  • 3
    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

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 :-)

  • 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
  • Asshat, this has nothing to do with OP's question. Once /etc/mysql get deleted, all mysql-* packages install/remove will fail. – sdaffa23fdsf May 21 '16 at 12:11
  • @sdaffa23fdsf, the fact that the OP accepted the answer appears to indicate otherwise. And you may want to check your facts - you appear to be saying that the deletion of a directory means you can never recover from that. I have to challenge that since, if you put everything back the way it was, it will work fine. – user12022 May 21 '16 at 12:55

What about just reinstalling mysql then?

  • I have tried but not working..... – Subhransu Mishra 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 Mishra 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 Mishra Nov 1 '10 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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