Where are database files of a WordPress website?

But surprisingly, not many threads show where these files exactly are in the server.

WordPress doesn’t have files it manages, it instead relies on MySQL/MariaDB for database storage and execution. So you will not find the database stored as a file within a WordPress installation.

If you need to handle database data in a file format, you should dump/export it into SQL files. These files are the commands needed to recreate the database, its tables, and their contents. The actual files of the database are of no practical use.

So Where Is The Data?

They would be in a system folder as specified by the MariaDB/MySQL configuration. This varies depending on the distribution and hosting provider. These files are not intended to be used modified or accessed by users directly.

There is a thread here: Database location in WordPress, but I’m not sure my website is using XAMPP.

XAMPP is a local dev environment that provides Apache + PHP + MySQL.

What About Backups?

You shouldn’t try to back up these files and restore them. Doing it properly would mean shutting down the database server, and taking a snapshot of the entire environment. Instead rely on SQL files.