HomeMogDBMogDB StackUqbar
v5.0

Documentation:v5.0

Supported Versions:

Other Versions:

mysql_fdw

mysql_fdw is an open-source plug-in. MogDB is developed and adapted based on the open-source mysql_fdw Release 2.5.3. mysql_fdw is provided as an extension.


Install mysql_fdw

  1. Using mysql_fdw relies on MySQL so file.

    Visit the MySQL official website to download the MySQL installation package and unzip it. Place the unzipped libmysqlclient.so file under $GAUSSHOME/lib.

    For example:

    [omm@mogdb-kernel-002 ~]$ mkdir /opt/mysql/
    [omm@mogdb-kernel-002 ~]$ cd /opt/mysql/
    [omm@mogdb-kernel-002 mysql]$ tar -zxvf mysql-8.0.33-linux-glibc2.28-x86_64.tar.gz
    [omm@mogdb-kernel-002 mysql]$ cd mysql-8.0.33-linux-glibc2.28-x86_64/lib
    [omm@mogdb-kernel-002 lib]$ cp libmysqlclient.so $GAUSSHOME/lib
  2. Access Download page of the MogDB official website, download the mysql_fdw extension for the version you need.

  3. Unpack the package, for example:

    tar -xzvf mysql_fdw-1.1-5.0.0-01-Kylin-x86_64.tar.gz
  4. Go to the directory where the extension is located and execute the make install command.

    cd mysql_fdw/
    make install
  5. Connect to the database and execute the create extension mysql_fdw; to use it.

    MogDB=# create extension mysql_fdw;
    CREATE EXTENSION

Using mysql_fdw


Common Issues

  • When a foreign table is created on the MogDB, the table is not created on the MariaDB or MySQL server. You need to use the MariaDB or MySQL server client to connect to the MariaDB or MySQL server to create a table.
  • The MariaDB or MySQL server user used for creating USER MAPPING must have the permission to remotely connect to the MariaDB or MySQL server and perform operations on tables. Before using a foreign table, you can use the MariaDB or MySQL server client on the machine where the MogDB server is located and use the corresponding user name and password to check whether the MariaDB or MySQL server can be successfully connected and operations can be performed.
  • The Can't initialize character set SQL_ASCII (path: compiled_in) error occurs when the DML operation is performed on a foreign table. MariaDB does not support the SQL_ASCII encoding format. Currently, this problem can be resolved only by modifying the encoding format of the MogDB database. Change the database encoding format to update pg_database set encoding = pg_char_to_encoding('UTF-8') where datname = 'postgres';. Set datname based on the actual requirements. After the encoding format is changed, start a gsql session again so that mysql_fdw can use the updated parameters. You can also use -locale=LOCALE when running gs_initdb to set the default encoding format to non-SQL_ASCII.

Precautions

  • SELECT JOIN between two MySQL foreign tables cannot be pushed down to the MariaDB or MySQL server for execution. Instead, SELECT JOIN is divided into two SQL statements and transferred to the MariaDB or MySQL server for execution. Then the processing result is summarized in the MogDB.
  • The IMPORT FOREIGN SCHEMA syntax is not supported.
  • CREATE TRIGGER cannot be executed for foreign tables.
Copyright © 2011-2024 www.enmotech.com All rights reserved.