MySQL / MariaDB
MySQL (and its close cousin MariaDB) is a relational database used to store structured data: WordPress posts, store users, orders, theme options, and more. On hosting, the database is almost always separate from HTML/PHP files — the app connects with a host, database name, user, and password.
Without a database, a dynamic CMS will not run even if theme files look fine. That is why “files only” backups cannot fully restore a shop or blog.
A Simple Analogy
Files in the document root are brochure racks. The database is a labeled filing cabinet: data can change without reprinting the whole rack. Dropping the cabinet leaves empty shelves that look “broken.”
Terms You Will See
| Term | Short meaning |
|---|---|
| Database | The data container |
| DB user | Account allowed to access the DB (not your cPanel user) |
| Host | Often localhost on shared hosting |
| phpMyAdmin | Browser UI for tables (article) |
| Table prefix | e.g. wp_ on WordPress |
In cPanel: MySQL Databases creates DBs/users and assigns privileges.
Safe Habits
- Never commit DB passwords to Git or public repos
- Prefer one database per app for cleaner isolation
- Back up databases separately from files (backups)
- Grant each DB user only the databases it needs
- After migrations, align
wp-config.phpor env vars with the new credentials
Performance and Resources
Slow queries hold PHP and can contribute to Error 508 / EP. Missing indexes, heavy plugins, and cron jobs pounding large tables are common suspects. Watch database size: shared plans often cap DB count or storage.
What to Watch For
- Do not leave phpMyAdmin open to the world without protection
- MySQL/MariaDB versions differ across hosts — test plugins before migrating
- Large imports may time out in the UI; keep SSH/CLI as a fallback
- Table prefixes help when multiple apps share one DB (still not ideal)
FAQ
MySQL vs MariaDB — which should I pick?
On shared hosting the provider chooses. Both work for WordPress and common apps. Match whatever your host supports.
Why does WordPress ask for a database?
Content, users, and settings live in DB tables — not static files alone.
Can I connect from my laptop?
Sometimes via remote MySQL (host must allow your IP). Many shared plans only allow localhost from inside the server.
Database full or connection errors?
Check quotas, credentials, user privileges, and whether the DB service is up. App error logs usually give the first clue.
Disclaimer: Hosting Wiki articles are prepared for educational and reference purposes. Hosting technology keeps evolving, so some technical details may change over time.