sandywp / plugins / wp-dbmanager
WP-DBManager
Manages your WordPress database.
Ready in seconds.
v4.0.0 60,000+ installs WP 6.8+ PHP 8.2+

What you get inside
8 screens-
Database, the server it runs on and the size of every table
-
Backup DB, which checks the paths and the folder before it offers to run
-
Manage Backup DB, every backup with its checksum, date and size
-
Optimize DB, which reclaims the space MySQL still holds after deletions
-
Repair DB, for tables the server has marked as crashed
-
Empty/Drop Tables, one row per table and what emptying it would remove
-
Run SQL Query, for the statement no screen has a button for
-
Database Settings: the paths, the schedule, and where a backup is mailed
About this plugin
WP-DBManager looks after the database behind your site: it backs it up, restores it, optimizes and repairs it, empties or drops tables and runs queries you write, all from wp-admin rather than from a shell or phpMyAdmin. Backups, optimization and repair can be left to run on a schedule, and the backup can be emailed to you when it finishes.
Donations
I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks, I will really appreciate it. If not feel free to use it without any obligations.
Usage
Securing The Backup Folder
A database backup contains everything, including your users table. Anyone who can guess a backup file name can download the lot, so the folder must not be served over HTTP.
The reliable option, on any server: set Path To Backup under WP-Admin -> Database -> Settings to a folder outside your web root, for example /var/www/example.com/backup-db when WordPress lives in /var/www/example.com/public_html. Nothing served, nothing to configure.
If the folder has to stay inside the web root:
- Apache — move
htaccess.txtfromFolder: wp-content/plugins/wp-dbmanagertoFolder: wp-content/backup-db/.htaccess - IIS — move
Web.config.txtfromFolder: wp-content/plugins/wp-dbmanagertoFolder: wp-content/backup-db/Web.config - nginx — nginx does not read
.htaccessfiles, so the file above does nothing. Add this to your server block and reload nginx:
location ^~ /wp-content/backup-db/ { deny all; }
Move index.php from Folder: wp-content/plugins/wp-dbmanager to Folder: wp-content/backup-db/index.php as well, so the folder cannot be listed.
The Backup DB page requests a file from the folder and reports what the server actually returns, so you can confirm the folder is closed rather than assume it.
WP-CLI
wp dbmanager tables
wp dbmanager backups
wp dbmanager backup --yes
wp dbmanager backup --no-gzip --yes
wp dbmanager restore <file> --yes
wp dbmanager delete <file>... --yes
wp dbmanager email <file> [email protected] --yes
wp dbmanager optimize --all --yes
wp dbmanager repair wp_options --yes
wp dbmanager empty <table>... --yes
wp dbmanager drop <table>... --yes
Everything that changes anything asks first, so a script has to pass --yes. That includes backup, which deletes the oldest backups to stay inside Maximum Backup Files, and email, because a dump holds your users table and a sent message cannot be recalled. tables and backups only read, and take a --format of table, csv, json, yaml, count or ids; their sizes are in bytes rather than the KiB and MiB the screens print, because a shell is better at arithmetic than at parsing 1.2 MiB.
optimize and `repair` take table names or `--all`. `empty` and `drop` take names only: emptying or dropping every table in a database is not maintenance, and the screen at least shows you the list before you tick it.
There is no run subcommand. WP-CLI already ships wp db query, which reaches the same database through the same client, so the Run SQL Query screen has no command counterpart. That screen is unchanged and still works.
wp dbmanager checks no capability. WP-CLI has no logged-in user unless you ask for one with `--user`, and whoever can run it can already read the credentials in `wp-config.php`, so a check would refuse every scheduled backup script while protecting nothing. The `install_plugins` gate on the admin screens is unchanged.
Questions
- My database is not backed up / My backup file is 0Kb
- Go to
WP-Admin -> Database -> Backup DB. The top of that page checks the backup folder, both binary paths, and whetherpassthru(),system()andexec()are available, and tells you which one is the problem. - The usual answer is that the host does not allow
mysqldumpto be run at all, or that the path underWP-Admin -> Database -> Settingsis wrong. Your host can tell you the correct path. - If you added extra flags to the mysqldump or mysql path, remove them. From 3.0.0 the path is passed as a single argument, so anything after the binary name is treated as part of the file name.
- Go to
- My gzipped backup file is about 20 bytes
- That is an empty gzip stream:
mysqldumpfailed and produced nothing, andgzipcompressed the nothing. - Before 3.0.0 the plugin could not tell.
mysqldump | gzipreports gzip’s exit status rather than mysqldump’s, and the file it leaves behind is not empty, so the check for a zero byte backup never fired. The file was renamed with a checksum and, if you had backup e-mails on, sent to you. - From 3.0.0 the dump is read back before it is accepted, and one with nothing in it is deleted and reported as a failure. Check any recent
.sql.gzbackups you are relying on — a real one is far larger than 20 bytes, andgunzip -c yourbackup.sql.gz | headshould show SQL.
- That is an empty gzip stream:
- I clicked Optimize (or Repair) and it says “No Tables Selected”
- From 3.0.0 these screens no longer tick every table for you. Tick the tables you want — or the box in the header row to take the lot — then pick
OptimizefromBulk actionsand pressApply. - The old screens pre-selected everything, so a single click acted on the whole database whether or not that was what you meant. Selecting first is the WordPress convention and is a good deal harder to do by accident.
- The same applies to
Empty/Drop Tables, which additionally can no longer empty some tables and drop others in one submit — pick one action, apply it, then pick the other.
- From 3.0.0 these screens no longer tick every table for you. Tick the tables you want — or the box in the header row to take the lot — then pick
- The Database pages say “Sorry, you are not allowed to access this page”
- Your bookmark points at the old address. In 3.0.0 the screens moved from
admin.php?page=wp-dbmanager/database-backup.phptoadmin.php?page=wp-dbmanager-backup, and likewise for the others. - Reach them from the
Databasemenu in the sidebar and re-bookmark. Nothing has been removed. - The old addresses embedded the plugin’s folder name, which meant the plugin only worked when installed as
wp-dbmanager. It no longer cares what the folder is called.
- Your bookmark points at the old address. In 3.0.0 the screens moved from
- What is the difference between WP-DBManager and WP-DB-Backup?
- WP-DBManager uses the
mysqldumpapplication to generate the backup and themysqlapplication to restore it, via the shell. - WP-DB-Backup uses PHP to generate the backup. In some cases WP-DB-Backup will work better for you because it requires fewer permissions — not every host allows
mysqldump/mysqlto be run directly. - WP-DBManager also gives you automatic optimizing and repairing of the database on top of backing it up.
- WP-DBManager uses the
- My backup folder is reported as visible to the public
- Anyone who guesses a backup file name can download your entire database, including your users table, so this is worth fixing rather than hiding.
- The most reliable fix on any server is to move the folder outside your web root — set
Path To BackupunderWP-Admin -> Database -> Settingsto something like/var/www/example.com/backup-db. Nothing is served, so there is nothing to protect. - If it has to stay inside the web root, see Securing The Backup Folder above. On nginx the bundled
.htaccessdoes nothing at all; you need alocationblock. - The
Backup DBpage requests a file from the folder and reports what your server actually returned, so it is telling you what a visitor would get rather than guessing. If you have verified it yourself and want the notice gone anyway, setHide Admin NoticestoYesunderSettings.
sandywp / also on the shelf
Try another plugin
All-in-One WP Migration and Backup
4.5 · 5M+ installs
Trusted by 60M+ sites: The gold standard for WordPress migration and backup. Migrate, backup, and restore your WordPress site…
UpdraftPlus: WP Backup & Migration Plugin
4.8 · 3M+ installs
Backup, restore or migrate your WordPress website to another host or domain. Schedule backups or run manually. Migrate in minutes.
Jetpack – WP Security, Backup, Speed, & Growth
3.7 · 3M+ installs
Improve your WP security with powerful one-click tools like backup, WAF, and malware scan. Includes free tools like stats, CDN…
Spin up a real WordPress site in seconds.
Test plugins, build a demo, hand a client a link — then squash it and start again. No local setup, no Docker.