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)
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.
Go to the OS and run the following:
You will see several folders:
In mysql, when you do
I lay full blame for this error on the source code because just as mysql bypasses
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
Permissions error, reported as an (old) MySQL bug
Check out the permissions bit in the MySQL install docs
On MySQL Version 5.5 the
There is no
I forgot to mention the folder in my case is not the name of the schema but just another folder called simply
If you didn't back this up with the regular
I did import my old user config and permissions when I upgraded to 5.5. They were sent to this database by the server. Yet, it was not saved as they were in the past. So, if and when you are using my version, you will need to backup this file or else you will loose all your users and permissions. I guess that's what this built-in database is for in my case.
Sorry this is so big! I wanted to show you what it looked like and how to find it by name. hmm I have not tried it, however I wonder if you created another data file like this one in its present location and same file extension if it would load it on startup? That is if you really wanted to create a database this way.
I ran into the problem while creating temp tables for a stored procedure. I wanted to use the information_schema.tables view to search for my temp table to determine if I would attempt a create temp table statement or delete from the temp table itself. However, the information_schema.tables view never showed that it existed so my code written like below would not work correctly:
I discovered a work around that is satisfactory. I rewrote to above code like the following:
I found that this solution provided me the temporary storage within a session while working appropriately.