On 6/13/09 12:09 PM, Paul DuBois wrote:
BTW, this page does not list errors declared within the mysys library,
yet the server might return some of then to a client.
The list of mysys errors is declared in include/mysys_err.h and the
messages in mysys/errors.c (there is also some bits in mysys/errors.c).
> Error: 1004 SQLSTATE: HY000 (ER_CANT_CREATE_FILE)
> Message: Can't create file '%s' (errno: %d)
> Likely cause:
> * Server trying to create file in which it has no write permission?
> * What else?
Currently, this error can only be thrown when copying a .frm file over
to a new location fails. More precisely, it can only be thrown during
the execution of a CREATE TABLE dst LIKE src statement when the server
tries to copy the source table .frm file to the destination table .frm file.
CREATE TABLE t1 LIKE t2 yields:
copy ./test/t1.frm to ./test/t2.frm
CREATE TEMPORARY TABLE t1 LIKE t2 yields:
copy ./test/t1.frm to /var/tmp/mysql/#sql104b_1_0.frm
The copy is performed by the function my_copy and ER_CANT_CREATE_FILE is
thrown if this function returns a failure and errno is not ENOENT (no
such file or directory).
my_copy can fail due to:
. failure to open/stat source file
. failure create destination file (if file exists, permissions, etc)
. failure close source/destination file
> * If this results from an attempt by user to create file in restricted
> area, specify another filename in directory where server can create files?
I think the best course of action for a resolution is to examine first
the supplied errno value using perror. If the error is related to
permissions, the only solution is to fix the permission where the new
.frm file is being created (database directory or directory where temp
tables are created). Still, other system related errors could occur..
advise to check open/creat man pages (ERRORS section).