Bug #62443 "DROP DATABASE test" fails with error 17

Submitted: 15 Sep 2011 13:40 Modified: 9 May 2014 10:46
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.5.15 OS:Linux
Assigned to: CPU Architecture:Any

[15 Sep 2011 13:40] Daniël van Eeden
Description:
After a new install a "DROP DATABASE test;" returns error 17.

$ perror 17
OS error code  17:  File exists

The problem is that there is a .empty file in the test directory.

This is likely caused by this part of 
# We need to create empty directories (data/test) the installation.  
# This does not work with current CPack due to http://www.cmake.org/Bug/view.php?id=8767
# Avoid completely empty directories and install dummy file instead.
SET(DUMMY_FILE ${CMAKE_CURRENT_BINARY_DIR}/.empty )
FILE(WRITE ${DUMMY_FILE} "")
INSTALL(FILES ${DUMMY_FILE} DESTINATION data/test COMPONENT DataFiles)

How to repeat:
Install MySQL

Version:
5.5.11, 5.5.13, 5.5.15, 5.6.3, 5.6.4

Suggested fix:
Solution 1:
Remove .empty in mysql_rm_db (sql/sql_db.cc)

Solution 2:
Use db.opt as DUMMY_FILE instead of .empty
AND remove .empty on upgrade.

This could be combined with things like Bug #29439 (charset settings missing for test db)
[15 Sep 2011 13:41] Daniël van Eeden
The code is from sql/CMakeLists.txt
[15 Sep 2011 16:18] MySQL Verification Team
Thank you foe the bug report.

[miguel@ilde ~]$ dbs/5.5/bin/mysql -uroot 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.17-debug Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> drop database test;
ERROR 1010 (HY000): Error dropping database (can't rmdir './test/', errno: 17)
mysql>
[16 Sep 2011 6:19] Shane Bester
This is already reported internally as:
Bug 12845091 - .EMPTY FILE IN /DATA/TEST PREVENTS USERS FROM DROPPING TEST DB ON 5.5 AND 5.6
[9 May 2014 10:46] Tor Didriksen
Fixed in 5.5.26

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.053 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.