Bug #4154 Unable to drop tables - possible directory permission bug
Submitted: 15 Jun 2004 22:48 Modified: 16 Jun 2004 18:17
Reporter: Dwight Shih Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.20-standard OS:MacOS (Mac OS X 10.2.8 (6R73))
Assigned to: CPU Architecture:Any

[15 Jun 2004 22:48] Dwight Shih
Description:
I am unable to drop database tables without modifying directory permissions. This is a fresh 
binary install (without installer). I've checked the MD5 checksum (openssl md5 ...), chowned to 
mysql and chgrped to mysql.

Here are the system details:

local/mysql 52 $ pwd
/usr/local/mysql
local/mysql 53 $ uname -v
Darwin Kernel Version 6.8: Wed Sep 10 15:20:55 PDT 2003; root:xnu/xnu-344.49.obj~2/
RELEASE_PPC 
local/mysql 54 $ ./bin/mysqld --version
./bin/mysqld  Ver 4.0.20-standard for apple-darwin6.8 on powerpc (Official MySQL-standard 
binary)
local/mysql 55 $ ps -auxww | grep mysqld
mysql    463   0.0  0.1     1828    588 std  S     4:04PM   0:00.07 sh ./bin/mysqld_safe
mysql    487   0.0  1.8    26304  11964 std  S     4:04PM   0:03.99 /usr/local/mysql/bin/mysqld
local/mysql 56 $ cat `which mysqld_safe`
#!/bin/sh
cd /usr/local/mysql/
nohup ./bin/mysqld_safe "$@" > /tmp/mysql$$.out 2>&1 &

How to repeat:
local/mysql 57 $ mysqladmin -u root -p create foo
Enter password: 
local/mysql 58 $ ls -ld data/foo
drwx------  2 mysql  mysql  68 Jun 15 16:23 data/foo/
local/mysql 59 $ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9 to server version: 4.0.20-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use foo;
Database changed
mysql> create table bar ( id integer not null primary key, name varchar(32) );
Query OK, 0 rows affected (0.01 sec)

mysql> drop table bar;
ERROR 1051: Unknown table 'bar'
mysql> drop table foo.bar;
ERROR 1051: Unknown table 'bar'
mysql> exit
Bye
local/mysql 60 $ sudo chmod 770 data/foo
Password:
local/mysql 61 $ ls -ld data/foo
drwxrwx---  5 mysql  mysql  170 Jun 15 16:24 data/foo/
local/mysql 62 $ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10 to server version: 4.0.20-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> drop table foo.bar;
Query OK, 0 rows affected (0.01 sec)

mysql> exit
Bye
local/mysql 63 $
[16 Jun 2004 12:02] Hartmut Holzgraefe
I tested the 4.0.20-standard binaries on Mac OS X 10.3.4
without problems. Even if i remove all group rights from
the data directory all still works fine.
[16 Jun 2004 12:18] Dwight Shih
Perhaps it has something to do with my installation. Do you have any suggestions of where to 
poke?
[16 Jun 2004 12:22] Hartmut Holzgraefe
All the information you pasted seems to be ok,
my only idea is that it might be a permission
bug in Mac OS X 10.2.8 that is fixed in 10.3.4 ...
[16 Jun 2004 14:04] Dwight Shih
It has to do with the script that I use to run mysqld_safe

local/mysql 15 $ ls -ld /usr/local/bin/mysqld_safe 
-rwsr-sr-x  1 mysql  mysql  86 Jun 12  2003 /usr/local/bin/mysqld_safe*
local/mysql 16 $ cat !$
cat /usr/local/bin/mysqld_safe
#!/bin/sh
cd /usr/local/mysql/
nohup ./bin/mysqld_safe "$@" > /tmp/mysql$$.out 2>&1 &

If I explicitly ( cd /usr/local/mysql ; ./bin/mysqld_safe ) as myself, then it works.

If I run /usr/local/bin/mysqld_safe as the mysql user, then it works.

But if I run /usr/local/bin/mysqld_safe as myself, then it fails
(I've tried the /usr/local/bin/mysqld_safe script with both 4755 and 6755 permissions).

Thanks for you help.
[16 Jun 2004 18:17] Hartmut Holzgraefe
Ok, thats it then. With our default permission settings
you always have to start the mysqld server as the same
user. That's what mysqld_safe's --user option is for ...