I ran across this once, when it happened to me ls -la gave all the
right permissions for mysql.
These are the notes from my solutions log:
Problem: Mysql cannot find databases or create new ones
Error:
> sudo mysqladmin -u root create db_production
mysqladmin: CREATE DATABASE failed; error: 'Can't create database
'db_production' (errno: 2)'
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec)
but:
> sudo find / -name db_production
/home/mysql_data/db_production
and:
mysql> CREATE DATABASE db_production;
ERROR 1006 (HY000): Can't create database 'db_production' (errno:
2)
Root Cause: Mysql's path is set incorrectly. It is looking somewhere
other than the dir where the dbs live
Solution: In /etc/mysql/my.cnf, set datadir = /home/mysql_data, which
is the location where the database files actually live on my machine
(as the find command above shows)