Mysql creates a database with a new database location

A few months ago, I asked a question about how to change the location of a database at runtime . I have not yet received a solution for this problem.

I need to create over 32,000 databases in MySQL. By default, the data location in the MySQL data folder, after creating 32,000 databases in this place, I want to change the data directory to another location. I plan to do this with Java code.

But before that, someone will tell me if this is possible?

I really need to implement this as a requirement. Please help me with this.

I apologize if I do not know what is in this description, but let me know if you need more information.

+1
source share
2 answers

That sounds complicated. I don't understand why 32000 is mysql refusing to create more databases than this? What is your mistake? It seems arbitrary - maybe this is a configuration variable that can be changed?

A few possibilities. You can start several mysql servers , each of which has a different data directory. I don’t think this will help, but you can take a look at the NDB storage engine, it can handle table spaces that can allow you to store data in several places.

0
source

You can create several partitions and join them using LVM (this is on Linux) and set the partition to the DATADIR path. You can also use soft links that databases move to other folders / partitions.

Unfortunately, MySQL supports only one DATADIR, but it seemed to me that InnoDB tables could be places for marking the path. Could you check this out?

0
source

All Articles