Mysql 使用新的数据库位置创建数据库

发布于 2024-08-09 03:59:26 字数 238 浏览 0 评论 0 原文

几个月前,我问过

我需要在 MySQL 中创建超过 32,000 个数据库。 MySQL数据文件夹的默认数据位置,在该位置创建32,000个数据库后,我想将数据目录更改为其他位置。我计划通过 Java 代码来做到这一点。

但在此之前有人能告诉我这是否可能吗?

我真的需要将其作为一项要求来实现。请帮我解决这个问题。

如果我在本描述中的任何地方不清楚,我很抱歉,但如果你们都需要更多信息,请告诉我。

Few months ago I have asked a question regarding how to change database location at runtime - I didn't get any solution for this problem yet.

I am needing to create more than 32,000 databases in MySQL. The default data location of MySQL data folder, after creating 32,000 database on that location, I want to change the data directory to other location. I am planning to do this through Java code.

But before that can anyone tell me if this is possible?

I am really needing to implement this as an requirement. Please help me out with this.

I am sorry If I am unclear anywhere in this description, but let me know if you all need any more information.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

山田美奈子 2024-08-16 03:59:26

听起来很难。我不明白为什么 32000 - mysql 拒绝创建比这更多的数据库?你得到什么错误?似乎是任意的 - 也许这是一个可以更改的配置变量?

几种可能性。你可以运行多个mysql服务器,每个服务器具有不同的数据目录。我认为这没有帮助,但您可能会研究 NDB 存储引擎,它可以处理 表空间 可能会让您将数据存储在多个位置。

That sounds difficult. I don't understand why 32000 - is mysql refusing to create more databases than that? What error do you get? Seems arbitrary - maybe this is a config variable that can be changed?

A few possibilities. You could run more than one mysql server, each with a different data directory. I don't think it would help, but you might look into the NDB storage engine, it can handle tablespaces which just might let you store data in multiple locations.

鯉魚旗 2024-08-16 03:59:26

您可以创建多个分区并使用 LVM(这是在 Linux 中)将它们连接起来,并将分区挂载到 DATADIR 路径。您还可以使用软链接将数据库移动到其他文件夹/分区。

不幸的是MySQL只支持一个DATADIR,但在我看来InnoDB表可以放置在单独的路径中。你能检查一下吗?

You can create several partitions and join them using LVM (this is in Linux) and mount the partition to the DATADIR path. Also you can use soft links the the databases moved to other folders/partitions.

Unfortunately MySQL supports only one DATADIR but it seemed to me that InnoDB tables can be places to separate path. Could you check this?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文