Bug #17079 Some startup failure messages are wrong and misleading
Submitted: 2 Feb 2006 18:49 Modified: 28 Feb 2007 22:25
Reporter: Paul Hoffman Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Errors Severity:S2 (Serious)
Version:4.1 OS:FreeBSD (FreeBSD)
Assigned to: CPU Architecture:Any

[2 Feb 2006 18:49] Paul Hoffman
Description:
If mysql can see the needed startup files but cannot write to them, it claims that it cannot find the file. It should instead say "I found the file but it has bad permissions or ownership".

If the files in /var/db/mysql/mysql are owned by root and you are starting as user mysql, the log says:

060201 11:43:06 [ERROR] /usr/local/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
060201 11:43:06 [ERROR] /usr/local/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
060201 11:43:06 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
060201 11:43:06  mysqld ended

How to repeat:
Change the ownership on the files in /var/db/mysql/mysql to root and try to start.

Suggested fix:
Change the error message in two ways:
- Say "I found the file but it has bad permissions or ownership".
- Give the full path to the file that you are failing on. Someone who has just installed MySQL will have no idea where './mysql' is, and you know the path at the point of reporting the error.
[2 Feb 2006 22:55] Hartmut Holzgraefe
The error code 13 gives the right hint "OS error code  13:  Permission denied"
but i agree that this is far from obvious
[27 Jul 2007 12:32] Niklas Saers
This trivial error (giving the wrong error message is an error) has not been corrected yet in the 5.x branch. I spent an awful long time scratching my head before noticing the error code. It should be unnecessary for more people to go in the wrong direction when their permissions are to blame