MySQL 5.0.x FEDERATED 表创建的正确语法?

发布于 2024-08-10 21:50:22 字数 913 浏览 5 评论 0原文

因此,我尝试使用 文档。接下来,我创建了一个像这样的表:

CREATE TABLE `federated_table` (
  `table_uid` int(10) unsigned not null auto_increment,
  ...,
  PRIMARY KEY (`table_uid`)
) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://user:[email protected]:3306/';

每次执行此操作时,我都会收到错误:

ERROR 1432 (HY000): Can't create federated table. The data source connection string 'mysql://user:[email protected]:3306/' is not in the correct format

我查看了文档,并且我相信我正在遵循此中的文档。此连接字符串的正确语法是什么?

So I'm trying to create a federated table using the syntax from the docs. Following this, I've created a table like so:

CREATE TABLE `federated_table` (
  `table_uid` int(10) unsigned not null auto_increment,
  ...,
  PRIMARY KEY (`table_uid`)
) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://user:[email protected]:3306/';

Every time I do this, I get the error:

ERROR 1432 (HY000): Can't create federated table. The data source connection string 'mysql://user:[email protected]:3306/' is not in the correct format

I've looked at the docs, and I believe that I'm following the docs in this. What is the proper syntax for this connection string?

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

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

发布评论

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

评论(2

岁月如刀 2024-08-17 21:50:22

毕竟我没有遵循文档。我忽略了将远程数据库和表添加到连接字符串中。正确的连接字符串应该是:

mysql://user:[email protected]:3306/remote_db/table

I wasn't following the docs after all. I neglected to add the remote database and table into the connection string. The proper connection string would have been:

mysql://user:[email protected]:3306/remote_db/table
醉殇 2024-08-17 21:50:22

还要确保你的/etc/my.cnf有

[mysqld]
federated

然后重新启动mysql服务。默认情况下它可能未启用。

Also make sure your /etc/my.cnf has

[mysqld]
federated

Then restart the mysql service. It may not be enabled by default.

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