UK web hosting · 24/7 live chat Open a ticket Client login

Guide

What is a MySQL database, and why does your website need one?

By Limitless Hosting. Published 8 November 2026. Last updated 8 November 2026.

A MySQL database is an organised store of information that a dynamic website reads and writes, such as pages, posts, users, orders and settings. WordPress and most shops keep their content there rather than in files. Every hosting plan with us includes unlimited MySQL databases, and you create them in the control panel.

See the plans

The idea

How a database-driven page is built

  1. Visitor requests a pageThey click a link
  2. Site code runsPHP receives the request
  3. Database queriedMySQL returns the content
  4. Page assembledTheme combines content with design
  5. Page deliveredThe browser shows the result

The basics

What a database does for a website

A simple website is a folder of files: one file per page. That works for a handful of pages that never change. As soon as a site needs to hold hundreds of products, accept comments, let people log in or let you edit pages from a screen, files become clumsy. A database is the answer. It stores information in tidy tables of rows and columns, and software can ask for exactly the piece it needs.

MySQL is one of the most widely used database systems in the world. The letters SQL stand for Structured Query Language, the way software talks to databases. When you load a WordPress blog post, the code asks MySQL for that post's title, text, author and date, then pours them into the theme to produce the page.

You will rarely look inside the database directly. Your site's software handles it. But knowing it exists explains many everyday things: why a backup needs a database export as well as files, why moving a site involves two parts and why a slow site is sometimes a slow database.

What lives where

Files and database compared

ItemStored as filesStored in the database
Theme design and codeYesNo, only theme settings
PluginsYes, the codeTheir settings and data
Posts and pagesNoYes
Images and uploadsYes, in the uploads folderOnly references to them
Users and passwordsNoYes, passwords stored as hashes
Orders and form entriesNoYes
Site title and settingsMostly noYes

Unlimited MySQL databases included

Run WordPress, a shop and test sites side by side on any plan.

See the plans

WordPress

How WordPress uses MySQL

A WordPress install creates a set of tables inside one database. These hold posts, pages, comments, users, settings and the options plugins save. The connection details, which are the database name, username, password and host, are written into a file called wp-config.php in your site folder. That file is why you must be careful with it: it contains the key to your data.

Each time a page loads, WordPress runs many small queries. Page caching reduces the load by saving finished pages, and Redis object caching, included on our plans, keeps frequently used query results in memory so they do not need to be fetched again. See our guide on speeding up a WordPress site.

When you use the one-click WordPress installer, the database is created and connected for you. You only need to know about it when you move, restore or troubleshoot a site.

Creating one

How to create a database by hand

Open the database tool

In your hosting control panel, find the MySQL database section.

Create the database

Give it a short, clear name. Control panels often add a prefix to keep names unique.

Create a database user

Make a new user with a long, random password. Do not reuse your hosting login password.

Connect user and database

Add the user to the database and grant the privileges the application needs, usually all.

Note the details

Record the database name, user, password and host (often localhost) in a password manager.

Enter them in the application

Put the details into the installer or into the configuration file of the application.

Keeping it clear

One database per site or shared?

One database per site

  • Easier to back up and restore
  • A problem in one site stays contained
  • Simple to delete when a site is retired
  • Clean to hand to a client or developer
  • Recommended for almost everyone

Sharing one database

  • Possible with different table prefixes
  • Harder to move a single site out
  • A mistake can affect several sites
  • Confusing to document
  • Rarely worth it, since databases are unlimited

Safety

Keeping a database safe

The database is where your valuable information sits, so protect it. Use a long random password for each database user, give each application its own user, and never publish the contents of wp-config.php or any similar file. Keep WordPress, plugins and themes updated, because most database break-ins come through outdated code rather than through the database software itself.

Our hosting adds a firewall, malware scanning and account isolation, which helps, but your own habits matter just as much. See how to secure a WordPress website and our hosting security page.

If your site collects personal data, the database holds it, and UK data protection rules apply to how you store and delete it. That is general guidance, not legal advice. The ICO website explains your duties.

Backups

Backing up and restoring a database

  • Export before big changes. Use the database tool in the control panel to download a copy as an .sql file.
  • Pair it with the files. A site backup needs both, taken close together in time.
  • Keep a copy away from the server. Weekly remote backups are included, and your own copy adds protection.
  • Name files with the date. It saves guessing which is the latest.
  • Test a restore. Import the file into a spare database and check the site works. See how to back up a website.

Troubleshooting

Common database problems

Error establishing a database connection

The details in wp-config.php are wrong, or the database user lost access. Check name, user, password and host.

Slow admin area

A bloated database or missing object cache. Remove old revisions and spam and try Redis.

Import fails on a large file

Upload limits can block large imports. Ask us on live chat for help with a big restore.

Access denied for user

The user is not linked to the database, or the password changed. Reassign privileges.

Garbled characters after a move

A character set mismatch. Import using UTF-8 and check the settings.

Not sure what broke

Send live chat the exact error message and what you changed last.

Beyond MySQL

Is MySQL the only option?

No. Other systems, such as MariaDB, behave very similarly and many hosts run one in place of the other without most users noticing. Other types of database exist for specialist uses, but for ordinary websites and WordPress, MySQL or a compatible system is the standard choice. You do not need to choose; the application tells you what it needs.

If you build with Node.js or Python, you may use other databases too. Our Node.js hosting and Python hosting pages explain what is available alongside MySQL.

Growth

Watching database size over time

Databases grow quietly. Comments, spam, post revisions, logs and the leftovers of deleted plugins all add rows. A small site rarely has a problem, but a busy blog or shop can reach hundreds of megabytes, and that counts towards your plan storage. Check the size in the database tool every few months, and clear out what you do not need.

Take a backup before any clean-up, and be wary of tools that promise to optimise everything in one click. Do one change at a time, then check the site. If the database seems huge for the size of your site, ask our live chat to look with you; the cause is usually a single plugin storing logs.

FAQ

Common questions

Do I need a database for my website?

Not for a simple set of static pages. You need one for WordPress, shops and anything that stores content, users or orders.

How many MySQL databases can I have?

Unlimited on every plan. Disk space is the practical limit.

Is a database included in my disk space?

Yes. The size of your databases counts towards your plan's storage.

What is the difference between MySQL and phpMyAdmin?

MySQL is the database system. phpMyAdmin is a web tool for looking at and managing a MySQL database.

Can I move a database to a new host?

Yes, by exporting it and importing it on the new account. Free migration is included on Small and higher plans billed yearly.

Run database-driven sites without limits

Unlimited MySQL databases, Redis object caching and weekly remote backups on every plan.

See the plans .co.uk and .uk domains £9.99

From 84p a month, billed yearly
15-day money back
Get started