Proper syntax for MySQL 5.0.x FEDERATED table creation?

1.1k views Asked by At

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?

2

There are 2 answers

0
Aurelia Peters On BEST ANSWER

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
0
111 On

Also make sure your /etc/my.cnf has

[mysqld]
federated

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