Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I accidentally remove the document /var/lib/mysql and when I tried to connect to the databases, the following information came up:

mysql> show databases;
ERROR 1018 (HY000): Can't read dir of '.' (errno: 13)

What can I do with this? Any help will be grateful!

share|improve this question

If you deleted /var/lib/mysql and all of its sub-directories then you most likely deleted all of your data. I am not sure if you can recover it at this point.

If you just want to get mysql working again, then just use apt-get to delete mysqld and install it again to have /var/lib/mysql created again.

share|improve this answer
Actually, I just want to get mysql to work again. But how can I delete the mysqld with the apt-get? And how to recreate it? – daniel Mar 18 '13 at 4:00
Run to remove: sudo apt-get remove mysql-server Run to install again: sudo apt-get install mysql-server – notkevin Mar 18 '13 at 4:06
I did these two step but I can not find the document /var/lib/mysql. What should I do? – daniel Mar 18 '13 at 4:12
I found this solution. I think it may work.… – daniel Mar 18 '13 at 4:23

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.