Free

Free coded apps to suit all. No sign up, no email, usable offline, updates when I can, feedback welcome. Send feedback

Tips

Deleting a database safely in Server by Zaweba

Server by Zaweba makes deleting a database deliberate: a confirmation with a red button, Enter meaning Cancel, and site folders that are never deleted.

Deleting a database safely in Server by Zaweba

Deleting a database is the one job in a local server that can't be taken back, so Server by Zaweba makes it slow on purpose. Delete on the Databases page asks for confirmation, the confirm button is red, and pressing Enter means Cancel rather than yes. When you remove a site, the app offers to delete its database too, but the site's folder is always kept.

Why Enter means Cancel

Most dialogs treat Enter as the default yes. That habit is exactly how people delete the wrong thing: a dialog appears while you are typing, you press Enter, and it is gone. Here the safe answer is the default, and deleting takes a deliberate click on the red button. It costs you a second when you mean it and saves you when you don't.

Before you delete

Export it first. Export SQL on the Databases page writes a dump using mariadb-dump, including routines and triggers, in a single transaction and with binary data written as hex so it survives the round trip. The file is small enough to keep for most local projects, and Import SQL can load it back later, streamed so even large files are fine.

Also check you have the right one. The Databases page lists each database with its tables and size, and each site's card in the sites list shows the database that belongs to it, so you can match them up before choosing Delete.

Removing a site

Remove on a site's card in the sites list takes the site out of Server by Zaweba's list of sites. It also offers to delete the site's database as well, which is handy when you are clearing out an old project, and easy to decline when the database is shared or you still need it.

The site's folder is never deleted. Your PHP files, images and anything else in it stay exactly where they were. That is a deliberate choice, because the folder may be your only copy of the code, or a project folder you pointed the site at from elsewhere on your PC. If you later want it back, run the new-site wizard and choose that existing folder.

The next time the hosts file is updated, with Tools, Update hosts or the Update the hosts file button, removed sites are tidied out of the app's block, so their name.test lines don't linger.

Cleaning up after a test

A common pattern is a throwaway site for trying a plugin or a framework. Make it with the wizard with a database, try what you wanted, then remove it with its database. The folder remains, so delete that yourself in File Explorer if you really don't want it. The hosts file tidy-up deals with the old address.

If you deleted the wrong one

Without an export, a deleted database is gone. That is the reason for the confirmation, and why an export before any clear-out is a good habit. With an export, make a new database with New database and user, then Import SQL from your dump, and point the site's settings at the new name and password.

Server by Zaweba checks database names before they reach SQL, so a typing slip in a name can't turn into a command that touches something else. Between the checks, the red button and Enter meaning Cancel, deleting only ever happens when you really meant it.