Bug #2761 ALTER TABLE fails Errcode: 13
Submitted: 12 Feb 2004 16:37 Modified: 13 Feb 2004 10:26
Reporter: [ name withheld ] Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.17 OS:FreeBSD (FreeBSD 4.9-RELEASE)
Assigned to: CPU Architecture:Any

[12 Feb 2004 16:37] [ name withheld ]
Description:
mysql> create table test ( a char(1));
Query OK, 0 rows affected (0.06 sec)

mysql> alter table test add b char(1);
ERROR 7: Error on rename of './test/test.MYI' to './test/#sql2-16949-409.MYI' (Errcode: 13)

Every reference I've found online says that this is a file permission problem, however I have sufficiently ruled this out:

mysql:/root# ll -a /usr/local/var/mysql/test
total 41
drwxrwxrwx  1 mysql  mysql  16384 Feb 12 16:30 ./
drwxrwxrwx  1 mysql  mysql  16384 Dec 31  1969 ../
-rwxrwxrwx  1 mysql  mysql      0 Feb 12 16:27 test.MYD*
-rwxrwxrwx  1 mysql  mysql   1024 Feb 12 16:30 test.MYI*
-rwxrwxrwx  1 mysql  mysql   8548 Feb 12 16:30 test.frm*

I am running the database files off a Network Appliance box mounted via SMB. I can execute the following commands from the command line, logged in as user mysql successfully:

mysql% rm \#sql2-16949-409.MYI
mysql% touch #sql2-16949-409.MYI
mysql% rm \#sql2-16949-409.MYI
mysql% touch aaaaa
mysql% mv aaaaa #sql2-16949-409.MYI
mysql% ls -l
total 9
-rwxrwxrwx  1 mysql  mysql     0 Feb 12 16:33 #sql2-16949-409.MYI
-rwxrwxrwx  1 mysql  mysql     0 Feb 12 16:27 test.MYD
-rwxrwxrwx  1 mysql  mysql  1024 Feb 12 16:30 test.MYI
-rwxrwxrwx  1 mysql  mysql  8548 Feb 12 16:30 test.frm

I have tried executing a FLUSH TABLES; prior to the alter, this makes no difference. Even a server restart seems to fail.

How to repeat:
see above

Suggested fix:
unsure
[13 Feb 2004 5:57] Alexander Keremidarski
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem is not the result of a bug.
For a list of more appropriate places to ask for help using MySQL
products, please visit http://www.mysql.com/support/

Thank you for your interest in MySQL.

Additional info:

Hint: Permission problem happens with creating temporary table i.e. creating new filw within a directory. Check database directory permissions
[13 Feb 2004 10:26] Sergei Golubchik
It could be that sbmfs bears a typical windows property, that an opened file cannot be renamed or deleted. As your MySQL binary is compiled for FreeBSD it does not contain windows-specific code to cope with such a limitation, and assumes that open files can be freely renamed. Thus the error.