-1

There are many threads talking about managing database of WordPress via phpMyAdmin. But surprisingly, not many threads show where these files exactly are in the server.

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

Could anyone tell me where are the files related to database, and their path and filename in the server?

1
  • Upped this question because of issues transferring providers where the source does not permit export of backup files, but of the sql db. The destination is a CPanel outfit, where a copy of the WP files is no issue - just the sql DBs. Research into the inner workings is likely incomplete, however. Commented Nov 16, 2023 at 9:41

1 Answer 1

2

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.

9
  • Attention, I'm not asking how the database is stored, I'm asking where. That's relevant to me. For example, Bluehost proposes a partial backup, which consists in downloading and restoring a Home Directory Backup. I don't know if this home directory contains the database. If it contains the database, that means restoring an old partial backup can overwrite the current up-to-date database, which is not what I want.
    – SoftTimur
    Commented Sep 11, 2020 at 21:13
  • It would be extremely unusual for a databases files to be in the home folder, but even if they were, it would make no sense to include them in a backup. And even if you did manage to get the files intact, that doesn't mean they would work if you put them back in the same place. A lot of the time the status of a database file is in flux, they aren't like normal files. It may be that your database software has chosen to delay writing changes to the file for performance reasons, or lots of other reasons. They really are of no value to you, not even for backup purposes
    – Tom J Nowell
    Commented Sep 11, 2020 at 22:15
  • The only time they could be considered useful for a backup is if the entire system was backed up as a snapshot. IIf you want to back up your database, getting the raw files is not going to be useful for you. Do a standard database back up instead. As for where they are, Bluehost can tell you there. There is no standardised location, it's vendor specific, and config specific
    – Tom J Nowell
    Commented Sep 11, 2020 at 22:17
  • TLDR: back up your database to SQL files using the standard tools
    – Tom J Nowell
    Commented Sep 11, 2020 at 22:22
  • 1
    Context is important! I've made some edits to try and make the answer more concise, but it's difficult given your problem and your question don't match. But to address your concern rather than your question, it's extremely unlikely. If your web host has configured MySQL to store its internal data store inside your users home directory then that server is seriously misconfigured in a very deliberate way. It's extremely improbable. If you want to know more about the common locations database software store their internal data, I'd suggest serverfault, and mentioning the environment software
    – Tom J Nowell
    Commented Sep 11, 2020 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.