I'm trying to select data from information_schema
but I'm getting the following error. How can I fix this?
mysql> SELECT * FROM information_schema.tables ;
ERROR 1018 (HY000): Can't read dir of '.' (errno: 13)
MySQLUbuntu
I'm trying to select data from information_schema
but I'm getting the following error. How can I fix this?
mysql> SELECT * FROM information_schema.tables ;
ERROR 1018 (HY000): Can't read dir of '.' (errno: 13)
Best Answer
I find that error particularly disturbing because MySQL introduced INFORMATION_SCHEMA with the introduction of MySQL 5.0. @gbn's answer shows that this bug
MySQL's definition of a database is simply a subfolder under datadir.
Now, here is why I find the error particularly disturbing: The INFORMATION_SCHEMA database is not supposed to be a manifested folder under datadir.
For example
Go to the OS and run the following:
You will see several folders:
In mysql, when you do
SHOW DATABASES;
, you should not see.
and..
. The source code would have made sure of that. Now, where is INFORMATION_SCHEMA? Guess what? All tables in the INFORMATION_SCHEMA are temp tables and use the memory storage engine. Also note that you do not a see a folder called INFORMATION_SCHEMA. Now, check out the definition of INFORMATON_SCHEMA.TABLES:I lay full blame for this error on the source code because just as mysql bypasses
.
and..
as special case folders that are not to be considered databases, INFORMATION_SCHEMA is supposed to be considered a s special case folder as well, a special case folder that does not have a manifested file under the datadir.I would highly recommend just upgrading MySQL to the latest version because, as @gbn found, there was a bug report but it is marked as closed. This could only happen
@gbn gets a +1 from me for finding the bug report which helped me look a little deeper