Bug #34067 Backup: restore failure if directory is not empty
Submitted: 25 Jan 2008 18:52 Modified: 24 Sep 2009 8:26
Reporter: Peter Gulutzan Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:6.0.5-alpha-debug OS:Linux (SUSE 10 / 64-bit)
Assigned to: Assigned Account CPU Architecture:Any

[25 Jan 2008 18:52] Peter Gulutzan
Description:
I backup a database to 'n15'.
I select into file 'n16'. This goes to database directory.
I try to restore from 'n15'.
I see Error 1010 "Error dropping database".

How to repeat:
create database w;
use w
backup database w to 'n15';
select 5 into outfile 'n16';
restore from 'n15';
[26 Jan 2008 12:23] MySQL Verification Team
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 6.0.5-alpha-debug Source distribution

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

mysql> create database w;
Query OK, 1 row affected (0.00 sec)

mysql> use w
Database changed
mysql> backup database w to 'n15';
+-----------+
| backup_id |
+-----------+
| 13        | 
+-----------+
1 row in set (0.60 sec)

mysql> select 5 into outfile 'n16';
Query OK, 1 row affected (0.00 sec)

mysql> restore from 'n15';
ERROR 1010 (HY000): Error dropping database (can't rmdir './w/', errno: 17)
mysql>
[26 Jan 2008 12:27] MySQL Verification Team
Thank you for the bug report. Verified as described.
[24 Sep 2009 8:26] Sanjay Manwani
Closing as a duplicate of bug 42572.
You now need to use the OVERWRITE option in RESTORE  since the database exists.

The file ("n16" in this case) will go into a newly created directory and the database will get restored. 

A warning will be displayed about the move of the file to the new directory created.