What Is a Database?
A database is an organized collection of data stored electronically so that software can reliably add, search, update and delete specific pieces of it on demand. A separate program called a database management system (DBMS), such as MySQL or PostgreSQL, handles the actual storage, structure and rules behind the scenes. Most dynamic websites, including WordPress, store their content in a database rather than in plain files.
What makes a database different from a plain file
You could technically store data in a plain text file or spreadsheet, and for very small amounts of information that works fine. A database adds structure and guarantees that files alone do not: a defined format for every record, the ability to search and filter huge amounts of data quickly, rules that keep data consistent even when many users or programs access it at once, and recovery options if something goes wrong mid-update. A hosting server's PHP application does not open a database file directly; it sends a request to the database management system and gets back exactly the rows it asked for.
Main types of databases
| Type | How data is organized | Common examples |
|---|---|---|
| Relational (SQL) | Tables of rows and columns, linked by shared keys | MySQL, MariaDB, PostgreSQL |
| Document (NoSQL) | Flexible documents, often JSON-like, grouped into collections | MongoDB |
| Key-value | Simple pairs of a unique key and a value | Redis |
| Graph | Nodes and the relationships connecting them | Neo4j |
Relational databases remain the most common choice for general-purpose websites and applications because their structure fits data that naturally has clear relationships, such as customers, orders and products.
How applications talk to a database
An application does not read a database's files directly. Instead it sends a request, called a query, written in a language the DBMS understands, most often SQL (Structured Query Language) for relational databases. The DBMS processes that query against its stored tables and returns only the matching data.
SELECT title, published_date
FROM posts
WHERE author = 'admin'
ORDER BY published_date DESC;
This separation is also why a web server and a database server can run as two different pieces of software, sometimes even on two different machines, communicating only through these queries.
Where databases fit into web hosting
- Most shared and managed hosting plans include MySQL or MariaDB, managed through a control panel such as cPanel or phpMyAdmin.
- WordPress, PrestaShop, WooCommerce and most other content management systems store their content, settings and users in a relational database.
- A static site built only from HTML files normally needs no database at all.
- Larger applications may use a managed database service hosted separately from the web server for easier scaling and backups.
Frequently asked questions
What is a database in simple terms?
A database is an organized, searchable collection of data stored by a computer, managed by software that lets other programs add, find, update or remove specific pieces of it reliably and quickly.
What is the difference between a database and a spreadsheet?
A spreadsheet is a single file one person usually edits at a time, with limited rules enforcing data consistency. A database is designed for many users or applications to read and write at once, with structure and rules that keep the data valid and recoverable even under heavy, simultaneous use.
What does DBMS stand for?
DBMS stands for database management system, the software that actually stores, organizes and retrieves the data in a database. MySQL, MariaDB and PostgreSQL are all examples of a DBMS.
What is the difference between SQL and NoSQL databases?
SQL databases store data in structured tables with a fixed set of columns and strong relationships between tables, while NoSQL databases store more flexible records, such as documents or key-value pairs, that do not need to share the same structure.
Which database does WordPress use?
WordPress stores posts, pages, users and settings in a MySQL or MariaDB database, which is why nearly every WordPress hosting plan includes one of these as part of the package.
Do all websites need a database?
No. A purely static site made of fixed HTML, CSS and image files can run with no database at all. Dynamic sites that let visitors log in, comment, search content or manage a store almost always need one.
Related topics
- What Is MySQL? Databases
- What Is PostgreSQL? Databases
- What Is WordPress? WordPress Hosting
- What Is a NoSQL Database? Databases
- What Is a Relational Database? Databases