MySQL
MySQL is an open-source relational database management system that stores and retrieves structured data using SQL (Structured Query Language). Every WordPress site runs on MySQL — or its drop-in...
MySQL
MySQL is an open-source relational database management system that stores and retrieves structured data using SQL (Structured Query Language). Every WordPress site runs on MySQL — or its drop-in replacement, MariaDB — as the engine that holds your posts, pages, comments, users, plugin settings, and theme options.
Answer capsule: MySQL is the database layer of WordPress. When you publish a post, WordPress writes it to a MySQL database. When a visitor loads that page, WordPress queries the database and retrieves it. Without MySQL, WordPress has no persistent storage — it cannot function.
What does MySQL store in a WordPress site?
Every piece of content and configuration on your WordPress site lives in a MySQL database, typically named with a wp_ table prefix. The default installation creates 12 tables including wp_posts, wp_options, and wp_users. Plugins add their own tables on activation — on a site with 30 active plugins, we commonly see 60–80 tables total.
When will you encounter MySQL as a site owner?
Most WordPress users interact with MySQL indirectly, through tools. You encounter it directly in three situations:
- Setting up WordPress: The installer asks for a database name, username, password, and host — all MySQL credentials.
- Migrating a site: Moving WordPress to a new host means exporting the MySQL database as a
.sqlfile and importing it on the destination server. - Debugging database errors: The “Error establishing a database connection” message means WordPress cannot reach MySQL — usually a wrong credential or a crashed MySQL service.
We see this error on client sites most often after a host-side MySQL restart that doesn’t auto-reconnect; a quick cache flush or wp-config.php credential check resolves it 90% of the time.
MySQL vs MariaDB: does it matter for WordPress?
MariaDB is a community fork of MySQL, created in 2009 after Oracle acquired MySQL. As of 2026, most shared hosts — including SiteGround and Hostinger — run MariaDB by default. WordPress treats both identically; the WordPress minimum requirements page lists “MySQL 8.0 or MariaDB 10.5 or greater” as the current standard. For practical WordPress use, the distinction is invisible.
A basic example
When you save a post, WordPress runs an INSERT query like this behind the scenes:
INSERT INTO wp_posts (post_title, post_content, post_status)
VALUES ('My Page Title', 'Page content here', 'publish');
You never write this query yourself — WordPress handles it. But understanding that it happens explains why database performance directly affects page load time. A slow MySQL server means slow queries, which means slow pages regardless of your CDN or caching plugin.
Related terms
- WordPress database — the full set of tables WordPress creates and manages
- wp-config.php — the file that holds your MySQL connection credentials
- phpMyAdmin — the browser-based GUI for browsing and editing MySQL databases
- Error establishing a database connection — the most common MySQL-related WordPress error
- MariaDB — the MySQL-compatible database most modern hosts run by default
Additional reading: