tl;dr If you’re seeing this and the table does exist- check (and fix) permissions!
I was searching my backups for a database file which contained the entries for an old ranty blog I used to have before I cancelled the domain.
Lo and behold I had a named, dated
.tgz file. Unusually, it contained a backup of the MySQL directory structure; rather than a
mysqldump‘d set of SQL queries to reconstruct the databases and tables. No matter, I copied the database directory into
Browsing via the command-line interface indicated the database was present (
SHOW DATABASES) and usable (
USE db). So I tried to
SELECT post_title FROM ranty_posts LIMIT 5. But no can do:
Can’t find file: ‘./db/ranty_posts.frm’ (errno: 13)
The problem is permissions, the file is there, slightly-misleading error message notwithstanding. Fortunately, it’s an easy fix- give
mysqld the ability to read the files, eg:
# chown mysql:mysql /var/lib/mysql/db/ -R
Which will change the user and group ownership to
Database and table names changed to protect the innocent