ERROR 1018 (HY000): Can’t read dir of ‘./dbname/’ (errno: 13)

by on May 28, 2009 · 7 comments· LAST UPDATED May 28, 2010

in

When I run the following command at mysql> I get an error which read as follows:

mysql> use dbname;
mysql> show tables;
ERROR 1018 (HY000): Can't read dir of './dbname/' (errno: 13)

How do I fix this problem under Debian Linux?

To fix this problem you need to set correct permission on /var/lib/mysql/dbname/ directory. Use the command as follows:
cd /var/lib/mysql/
ls -l
chown mysql:mysql dbname/ -R

Replace dbname with actual database directory name. Now you can connect to your mysql server:
mysql -u user -p dbname -e 'show tables;'

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 7 comments… read them below or add one }

1 Zoffix Znet April 1, 2012 at 1:13 pm

Thanks that worked. I was coping the files from an old drive, and even though I used `-p` flag to `cp`, the ownership was weird (wasn’t mysql:mysql)… Not sure what was up with that :)

Reply

2 Pavan G Jakati July 24, 2012 at 5:42 am

Thank a ton for your valuable effort and heko

Reply

3 Mohamed August 31, 2012 at 10:37 am

Great, it fixed my problem

Reply

4 Mohamed August 31, 2012 at 10:37 am

Thanks, you’re helpful

Reply

5 kipkajules October 30, 2012 at 6:36 pm

thanks so much for your entry here! Everywhere else I read suggested this was a number of files open issue, but your answer was correct! I had chown’d it to mysql:root before, but that apparently wasn’t enough.

Reply

6 ionut June 10, 2013 at 10:17 am

Really thank you for info! It worked very well

Reply

7 Robin January 24, 2014 at 10:06 am

Sorry to say but it didn’t work for me.
I am running
OS : Ubuntu 12.04
mysql version : 3.4.5
This problem is on my local system, mysql user name is “root” and password is ” (i.e blank).

Beers in Advance :)
Cheers !!

Reply

Leave a Comment

Tagged as: , , , , , , , , ,

Previous Faq:

Next Faq: