Bug #17078 mysql_install_db with --user does not report failure when it should
Submitted: 2 Feb 2006 18:43 Modified: 8 Jan 2008 23:22
Reporter: Paul Hoffman Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1 OS:FreeBSD (FreeBSD)
Assigned to: Jonathan Perkin CPU Architecture:Any

[2 Feb 2006 18:43] Paul Hoffman
Description:
'mysql_install_db --user=mysql' does not report an error when the files it would create already exist but are owned by root. It also doesn't change the ownership.

How to repeat:
As root, run 'mysql_install_db' without a --user argument. /var/db/mysql/mysql is created with all files owned by root. Then, as root, run it again as 'mysql_install_db --user=mysql'. No error is reported, but all the files are still owned by root.

Suggested fix:
Report the error and explain "you really don't want to keep these owned by root".
[8 Jan 2008 22:58] Omer Barnir
workaround: either chown the 'data' directory to the mysql user, or remove it and run the mysql_install_db with --user=<mysql_user> again
[8 Jan 2008 23:22] Paul Hoffman
The comment below is true but irrelevant. The bug report was to get the software itself to give better warnings.

>>workaround: either chown the 'data' directory to the mysql user, or remove it
>>and run the mysql_install_db with --user=<mysql_user> again