0

我正在使用 MariaDB 10.1 64x 并遇到 FederatedX 引擎错误。首先,我创建一个服务器:

CREATE SERVER AAA_fed
Foreign data Wrapper mysql_1
OPTIONS (
    User 'user1',
    password 'password',
    host 'x.x.x.x',
    Port 3306,
    database 'AAA'
    );

然后使用与服务器的连接创建联合表。

CREATE TABLE table1 
ENGINE = FEDERATED 
CONNECTION='AAA_fed';

表创建成功,但从中选择数据时,它响应错误:

错误代码:1296。收到错误 10000 '远程系统错误:0:'来自 FEDERATED

有谁知道这个问题的解决方案?我一直在寻找,但找不到答案。谢谢你。

4

2 回答 2

0

WRAPPER应该是公认的连接协议。

例子:

MariaDB [(none)]> SELECT VERSION();
+--------------------------+
| VERSION()                |
+--------------------------+
| 10.1.14-MariaDB-1~xenial | -- 64 bit
+--------------------------+
1 row in set (0.00 sec)

MariaDB [(none)]> DROP DATABASE IF EXISTS `BBB`;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> DROP DATABASE IF EXISTS `AAA`;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS `AAA`;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS `BBB`;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> CREATE TABLE IF NOT EXISTS `AAA`.`table1` (
    ->   `id` int(20) NOT NULL,
    ->   `name` varchar(64) NOT NULL default ''
    -> ) ENGINE='InnoDB';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> DROP SERVER IF EXISTS `AAA_fed`;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> CREATE SERVER IF NOT EXISTS `AAA_fed`
    -> FOREIGN DATA WRAPPER `mysql_1` -- <-- Unsupported
    -> OPTIONS (
    ->   HOST 'x.x.x.x',
    ->   DATABASE 'AAA',
    ->   USER 'user1',
    ->   PASSWORD 'password',
    ->   PORT 3306,
    ->   SOCKET '/path/to/mysqld.sock',
    ->   OWNER 'user1'
    -> );
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> CREATE TABLE IF NOT EXISTS `BBB`.`table1`
    -> ENGINE=FEDERATED CONNECTION='AAA_fed';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> SELECT `id`, `name` FROM `BBB`.`table1`;
ERROR 1296 (HY000): Got error 10000 'Error on remote system: 0: ' from FEDERATED

MariaDB [(none)]> DROP TABLE IF EXISTS `BBB`.`table1`;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> DROP SERVER IF EXISTS `AAA_fed`;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> CREATE SERVER IF NOT EXISTS `AAA_fed`
    -> FOREIGN DATA WRAPPER `mysql` -- <-- Supported
    -> OPTIONS (
    ->   HOST 'x.x.x.x',
    ->   DATABASE 'AAA',
    ->   USER 'user1',
    ->   PASSWORD 'password',
    ->   PORT 3306,
    ->   SOCKET '/path/to/mysqld.sock',
    ->   OWNER 'user1'
    -> );
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> CREATE TABLE IF NOT EXISTS `BBB`.`table1`
    -> ENGINE=FEDERATED CONNECTION='AAA_fed';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> SELECT `id`, `name` FROM `BBB`.`table1`;
Empty set (0.00 sec)
于 2016-05-27T14:35:21.630 回答
0

此错误还有一个原因。当您创建一个联合表时会发生这种情况,该表指向同一服务器中的一个表。

于 2021-09-30T11:05:03.823 回答