'在MariaDB上使用FederatedX时,远程系统出错:0'

时间:2016-05-27 10:40:51

标签: mariadb federated-table

我正在使用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

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

1 个答案:

答案 0 :(得分: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)