mysqlviewfederatedfederated-tablefederated-storage-engine

Is is possible to create a FEDERATED on VIEW for mysql


How can I create a FEDERATED on VIEW which placed on remote server? I'm using MySQL.


Solution

  • Yes, you can create a FEDERATED table on a VIEW.

    Here's a simple example:

    create table t_table (
    id int not null auto_increment primary key
    ) engine = innodb;
    
    create or replace view v_view as select * from t_table;
    
    create table f_fed_table (
    id int not null
    ) ENGINE=FEDERATED CONNECTION='mysql://user:password@127.0.0.1:3306/test/v_view';