Surya
Surya

Reputation: 3498

1432 - Can't create federated table. The data source connection string %s is not in the correct format

I am having issue in federating data from remote server into my local machine. My Remote table is MyISAM , when i tried to execute

CREATE TABLE `wtc_test (
    `wtc_companyworkday_id` bigint(20) DEFAULT NULL,
) ENGINE=FEDERATED  DEFAULT CHARSET=latin1
CONNECTION='mysql://pentah:0p@[email protected]**.*.*:3306/replica/wtc_test';

I got Following error :-

[Err] 1432 - Can't create federated table. The data source connection string 'mysql://pentah:0p@[email protected]*.*:3306/replica/wtc_test' is not in the correct format

The reason i see is, my password contains '@' character, can some one help me .

Upvotes: 6

Views: 6980

Answers (2)

Abhishek Ginani
Abhishek Ginani

Reputation: 4751

AS per the MySQL documentation, When using a CONNECTION string, you cannot use an '@' character in the password. You can get round this limitation by using "create server" statement.

For Example:

CREATE SERVER fedlink
FOREIGN DATA WRAPPER mysql
OPTIONS (USER 'USERNAME', HOST 'Host_IP', DATABASE 'DB_NAME', 
PORT '3306',Password 'PASSWORD');

Once Server Link is created, To create table that uses this connection:

CREATE TABLE test_table (
id     INT(20) NOT NULL AUTO_INCREMENT,
name   VARCHAR(32) NOT NULL DEFAULT '',
other  INT(20) NOT NULL DEFAULT '0',
PRIMARY KEY  (id),
INDEX name (name),
INDEX other_key (other)
)
ENGINE=FEDERATED
DEFAULT CHARSET=latin1
CONNECTION='fedlink/test_table';

Follow the links below for more information on this: https://dev.mysql.com/doc/refman/5.6/en/federated-usagenotes.html https://dev.mysql.com/doc/refman/5.1/en/federated-create.html

Upvotes: 5

fancyPants
fancyPants

Reputation: 51898

The wildcard in MySQL usernames/hosts is %, not *. Apart from that, what you specify there is the destination, not the source like when you create a user or grant privileges. So you better specify a hostname or the static IP of your MySQL database server.

And have a try with " around your password, as single quotes would terminate the connection string.

CONNECTION='mysql://pentah:"0p@l"@yourHost:3306/replica/wtc_test';

But if I were you, I would simply change the password. A password is not safe by using the most exotic symbols, it's the length that matters. Have a look at this.

Upvotes: 2

Related Questions