HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How to create a folder within the MySQL datadir without MySQL treating it as a database?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
datadirwithoutthetreatingcreatewithindatabasemysqlfolderhow

Problem

For example, I needed to create a directory called 'backup' within the datadir (temporarily) to store a backup file, but I noticed that MySQL interprets this directory as a database within MySQL. Is this safe? Is it possible to create a directory within the datadir without MySQL thinking it's a database?"

Solution

No, it is not possible to create a folder in datadir without it being treated as a schema.

https://dev.mysql.com/doc/refman/8.0/en/data-directory.html says:

Each subdirectory of the data directory is a database directory and corresponds to a database managed by the server.

If you need to use the disk volume for other files besides MySQL data, you should relocate your datadir path to one level down below the mount point. Then make a sister folder so you can store other files.

Or add another large volume to your server on a different mount point.

Context

StackExchange Database Administrators Q#334164, answer score: 4

Revisions (0)

No revisions yet.