# Restore (Galera Cluster) does not delete Databases after restore

**URL:** <https://forums.percona.com/t/restore-galera-cluster-does-not-delete-databases-after-restore/6187>\
**Category:** Percona XtraBackup\
**Created:** [February 11, 2018, 4:44pm UTC](https://forums.percona.com/t/restore-galera-cluster-does-not-delete-databases-after-restore/6187 "2018-02-11T16:44:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![che](https://avatars.discourse-cdn.com/v4/letter/c/d78d45/32.png) [@che](https://forums.percona.com/u/che)\
**Post date:** [February 11, 2018, 4:44pm UTC](https://forums.percona.com/t/restore-galera-cluster-does-not-delete-databases-after-restore/6187/1 "2018-02-11T16:44:18Z")

</div>

Hello All

We’re using XtraBackup to backup our Galera Cluster. We had some testings. We also tested the restore. We’re doing at 00:30 every day a full backup and then incremental ones. It was working perfectly with prepare and then the restore. But after the restore we see a lot (amount of incremental backups) databases on the restored cluster/server (#mysql50#Incremental-09022018\_xxxxx [xxxx = time]). All of those does not have any tables and are 0.0 bytes big. when I want to delete them it says me ‘Error Code: 1010. Error dropping database (can’t rmdir ‘./Incremental-09022018\_011001/’, errno: 17)’

What are does databases and how i can delete them? and why are they there?  
When i do a ‘dir -l’ on ‘/var/lib/mysql’ i see those databases too, and all belongs to mysql:mysql like the other (normal) databases

Thank you.

---

<div class="post-metadata">

**Author:** ![che](https://avatars.discourse-cdn.com/v4/letter/c/d78d45/32.png) [@che](https://forums.percona.com/u/che)\
**Post date:** [February 28, 2018, 4:53pm UTC](https://forums.percona.com/t/restore-galera-cluster-does-not-delete-databases-after-restore/6187/2 "2018-02-28T16:53:43Z")

</div>

No one? _bump_

---

<div class="post-metadata">

**Author:** ![lorraine.pocklington](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lorraine.pocklington/32/37_2.png) [@lorraine.pocklington](https://forums.percona.com/u/lorraine.pocklington)\
**Post date:** [March 1, 2018, 4:44am UTC](https://forums.percona.com/t/restore-galera-cluster-does-not-delete-databases-after-restore/6187/3 "2018-03-01T04:44:56Z")

</div>

Hi there, sorry for the delay, I just asked the team to take a look at your question…  
Are you putting the incremental backups into a subdirectory of the full backup directory?  
The problem with that is that MySQL treats every subdirectory as a separate database.  
If you see here [url][https://www.percona.com/doc/percona-xtrabackup/2.4/backup\_scenarios/incremental\_backup.html[/url]](https://www.percona.com/doc/percona-xtrabackup/2.4/backup_scenarios/incremental_backup.html%5B/url%5D) you will see the full backup is in /base and the incrementals at the same directory level /inc1 /inc2 etc

```auto
/data/backups/base /data/backups/inc1 /data/backups/inc2

```

If that’s not the case, let us know and we can take another view? We would probably need a bit more information from you though in that case about what your set up looks like.

---

<div class="post-metadata">

**Author:** ![che](https://avatars.discourse-cdn.com/v4/letter/c/d78d45/32.png) [@che](https://forums.percona.com/u/che)\
**Post date:** [March 6, 2018, 1:56am UTC](https://forums.percona.com/t/restore-galera-cluster-does-not-delete-databases-after-restore/6187/4 "2018-03-06T01:56:57Z")

</div>

Hello Lorraine

Sorry for my delay now 😉 No Problem.

Yes, i but every incremental backup into a sub of the full backup.  
How can i remove those “ghost” Databases?

Thank you.

---

<div class="post-metadata">

**Author:** ![lorraine.pocklington](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lorraine.pocklington/32/37_2.png) [@lorraine.pocklington](https://forums.percona.com/u/lorraine.pocklington)\
**Post date:** [March 6, 2018, 4:36am UTC](https://forums.percona.com/t/restore-galera-cluster-does-not-delete-databases-after-restore/6187/5 "2018-03-06T04:36:31Z")

</div>

Hello Che

OK I have checked this for you.

You should be able to just remove these directories with rm - they are not recognised by the data dictionary as databases, but they are being shown as databases because they are in the file system structure. Once the sub-directories are gone, they will no longer be listed by show databases command

If you want to make sure that this is the case - and it would be good practice to do this anyway I think, to verify the suggestion - you could mv one initially and make sure that you are happy that the database is not longer displayed and there is no adverse effect.

---

<div class="post-metadata">

**Author:** ![che](https://avatars.discourse-cdn.com/v4/letter/c/d78d45/32.png) [@che](https://forums.percona.com/u/che)\
**Post date:** [March 6, 2018, 8:23am UTC](https://forums.percona.com/t/restore-galera-cluster-does-not-delete-databases-after-restore/6187/6 "2018-03-06T08:23:33Z")

</div>

Thank you. It was working - just removed them with rm. To be safe for a week or so (because some times, issues are coming later ;)) i’ve just moved them away to a temporary folder inside a folder at the homedrive.

But, yes, just delete/move them is working.  
Thank you!

---

<div class="post-metadata">

**Author:** ![lorraine.pocklington](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lorraine.pocklington/32/37_2.png) [@lorraine.pocklington](https://forums.percona.com/u/lorraine.pocklington)\
**Post date:** [March 6, 2018, 8:29am UTC](https://forums.percona.com/t/restore-galera-cluster-does-not-delete-databases-after-restore/6187/7 "2018-03-06T08:29:02Z")

</div>

Thank you, Che,for letting me know, I will pass that back to the team that helped me with the answer.  
It is always best to check out rather than experiment and I totally agree with you - ‘safe’ is ALWAYS better than ‘sorry’ - especially in DBA work in my opinion! 😃
