Websites and Tech

Database

Also called MySQL database, DB

The structured store holding a site's content, users, settings and orders in tables the code can query.

Quick facts: Database

Category
Websites and Tech
Also called
MySQL database, DB
Level
Beginner
Affects
Page speed, backups, data recovery, personal data compliance
Where to see it
phpMyAdmin, hosting control panel, WP-CLI, your backup plugin
In this article4
  1. How a database works
  2. Why the database matters
  3. Common mistakes with databases
  4. How to act on it

How a database works

A database keeps information in tables. Each table has named columns and rows: a posts table with a title, body and publish date; an orders table with a customer, a total and a status. Because the shape is fixed, software can ask precise questions of it — give me the published posts in this category, newest first — and get an answer without reading everything.

On a typical WordPress or WooCommerce site the database is MySQL or MariaDB, and it sits behind the code rather than beside your files. Your images and theme files live on disk; your text, settings, users and orders live in the database. That split matters more than it sounds, because a copy of one is not a copy of the other.

Why the database matters

Almost every page on a content-managed site is assembled on request by asking the database questions. When those questions are slow or too numerous, the server takes longer to answer and every visitor waits, whatever the page weighs. Plugins that add filters, related-post widgets or complex product options are a common source of that drag.

It is also the part you genuinely cannot recreate. A theme can be rebuilt and images can be re-uploaded, but the orders taken last quarter, the enquiries sitting in a form plugin and years of published content exist in exactly one place. Any backup plan that copies files without the database is not a backup at all.

Common mistakes with databases

The first is letting it fill with rubbish. Post revisions, expired transient data, spam entries and tables left behind by deleted plugins accumulate quietly for years, and nothing removes them automatically. The site keeps working, it just gets heavier and backups get slower.

The second is a careless find-and-replace when a domain or protocol changes. WordPress stores some settings in a serialised format that records the length of each string, so a plain text replacement corrupts them and widgets or theme options quietly stop loading. Use a tool that understands serialised data.

The third is holding personal data with no plan for it. Form plugins keep every submission indefinitely by default, which becomes a liability rather than an asset the moment someone asks what you hold about them.

How to act on it

Confirm your backups include the database, run on a schedule, are stored away from the server itself, and have actually been restored once so you know they work. An untested backup is a hope, not a safeguard.

Clear out revisions, orphaned tables and old transients when you audit the site, and remove data you no longer need rather than keeping it because storage is cheap. If pages are slow while the design is light, ask whoever handles your site maintenance to look at slow queries before spending anything on redesign.

Do and do not

Do

  • Include the database in every backup and test a restore
  • Clear revisions, spam and orphaned plugin tables periodically
  • Delete form submissions you no longer have a reason to keep

Do not

  • Run a plain find-and-replace on serialised WordPress data
  • Assume a file backup captured your posts and orders
  • Store the only backup copy on the same server

Questions people ask about this

Do I need to back up the database separately from my files?

Your backup must include both, but they are separate things. Files hold the theme, plugins and uploaded images; the database holds your posts, pages, settings, users and orders. Some backup tools default to files only, which looks reassuring until a restore brings back an empty site. Check what the tool actually captures.

Can a bloated database slow down my website?

Yes, though usually less than badly written queries do. Years of post revisions, spam and abandoned plugin tables make backups slower and searches heavier. The bigger cause of slowness is code asking the database many complicated questions on every page load, which cleaning alone will not fix.

Where is my website database stored?

On your hosting server, alongside but separate from your website files. Shared hosting control panels usually expose it through a tool such as phpMyAdmin, with a database name, user and password stored in the site's configuration file. Managed hosts often handle it for you and provide their own backup and access tools.

Related terms

Found this useful?

Share it, or ask an AI to summarise it

Back to the glossary

Knowing the term is the easy part

Applying it to your own site and budget is the work. Book a call and I will tell you what actually applies to you.