SQL Server 到 MySql 的转换 - 架构与数据库问题

发布于 2024-09-25 17:07:16 字数 712 浏览 0 评论 0原文

总之,

我们正在评估 MySql 作为共享托管环境中小型客户的 SQL Server 的低成本替代方案。我仍然对如何迁移一些细节(例如表/标量值函数、sql 作业等)感到困惑,但我将在另一个线程中发布具体细节。然而,我确实有一个关于 MySql 中的数据库与模式的基本问题。

目前,我们的 SQL Server 实例有多个数据库,每个数据库都有多个模式。例如:

数据库(架构...)
====================
Client1Database(dbo、web)
Client2Database(dbo、web、schema3)
Client3Database (dbo, schema2)

在我的示例 MySql 实例中,似乎顶级对象是架构,而不是数据库。但“模式”旁边有数据库图标,在我们的例子中,“模式”被列为 .NET 应用程序中连接字符串的一部分。

所以我想我只是有一些关于如何感知 MySql 中的模式/数据库的澄清问题...

  1. 如果数据库由多个模式或单个模式“数据库”组成,MySql 实例中的顶级对象是否可以被视为模式”。
  2. 在上面的场景中,我会为每个客户端创建一个单独的实例,将各个客户端数据库扁平化为单个模式并将三个客户端保留在同一个实例中,还是我无法使用的其他方法?一种方法相对于另一种方法是否有优势、安全性、清晰度或其他方面?

预先感谢您的回复。

All,

We are evaluating MySql as a lower cost alternative to SQL server for our smaller clients in a shared hosting environment. I am still foggy on how we would migrate some of the particulars such as table/scalar value functions, sql jobs, etc, but I will post specifics in another thread. I do, however, have a fundamental question about databases vs. schemas in MySql.

Currently, our SQL server instance has multiple databases with multiple schemas in each. For example:

Database (schemas...)
====================
Client1Database (dbo, web)
Client2Database (dbo, web, schema3)
Client3Database (dbo, schema2)

In my sample MySql instance, it appears as though the top level objects are schemas, not databases. But the "schemas" have database icons next to them and, in our case, a "schema" is listed as part of the connection string in our .NET apps.

So I guess I just have a few clarification questions as to how to perceive the schemas/databases in MySql...

  1. Can the top level objects in a MySql instance be considered schemas if a database consists of multiple schemas, or a single schema "database".
  2. In the scenario above, would I create a separate instance for each client, flatten the individual client databases to a single schema and keep the three clients in the same instance, or some other method that is escaping me? Is there a benefit, security, clarity, or otherwise to one approach over another?

Thanks in advance for your replies.

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

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

发布评论

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

评论(1

回心转意 2024-10-02 17:07:16

首先也是最重要的,我建议您或任何人避免使用 MySQL,有很多免费的 RDBMS 可用,我最喜欢的是 PostgreSQL,在我看来它更好。另外,您的要求非常小,使用 SQL Server Express 应该不是问题,尽管我知道共享托管可能会限制您的选择。你(希望)已经弄清楚了这一点,但无论如何我都会尝试回答你的问题......

  1. 基本上MySQL没有模式,只有数据库(在标准中称为目录)。几年前,他们决定添加关键字 SCHEMA 作为 DATABASE 的别名。有计划添加模式的概念,但我不指望它会很快实现。
  2. 它主要取决于您在当前设置中如何使用数据库与模式。在大多数情况下,我认为最好将这些数据库保留在单个实例中以简化管理任务。

PS:如果能更新一下您最终如何解决这个问题,那就太好了。

First and foremost, I would advice you or anyone to avoid using MySQL, there's a lot of free RDBMS available, my favorite being PostgreSQL which in my view is way better. Also, your requirement being quite small, it shouldn't be a problem using SQL Server Express, although I understand that shared hosting can be limiting your options there. You (hopefully) already have figured this out, but I'll try to answer your questions anyway...

  1. Basically MySQL doesn't have schemas, only databases (which are called catalogs in the standard). Some years ago they decided to add the keyword SCHEMA as an alias for DATABASE. There's plans laying around to add the concept of schemas, but I wouldn't count on it being implemented anytime soon.
  2. It mostly depend on how you're using databases vs schemas in your current setup. In most cases, I would think it's better to keep those databases into a single instance to simplify administration tasks.

P.S.: It would be great to have an update on how you resolved this problem in the end.

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