CREATE SERVER

You can use this MySQL statement with the FEDERATED storage engine to set the connection parameters.

Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

CREATE SERVER server
FOREIGN DATA WRAPPER wrapper
OPTIONS (  
  { HOST host, |
    DATABASE database, |
    USER user, |
    PASSWORD password, |
    SOCKET socket, |
    OWNER character, |
    PORT port }
 )

Explanation

Use this SQL statement with the FEDERATED storage engine to set the connection parameters. The values given are stored in the mysql database, in the server table, in a new row. The server name given cannot exceed 63 characters; it's not case sensitive. The only wrapper permitted at this time is mysql. Options are given in a comma separated list. You're not required to specify all options listed above. If an option is not given, the default will be an empty string. To change options after a server has been created, use the ALTER SERVER statement. For option values, character or numeric literals (UTF8; maximum length of 64 characters) must be given. This statement was introduced in version 5.1.15 of MySQL and requires SUPER privileges.

The host may be a host name or an IP address. The user and password given are the the user name and password required for accessing the server. Provide either the name of the socket or the port to use for connecting to the server. The owner is the file system user name to use for accessing the server.

Examples

CREATE SERVER server1
FOREIGN DATA WRAPPER mysql
OPTIONS (USER 'ulfthewolf', HOST 'kinggustaf.com', DATABASE 'db1', PORT 3306, OWNER 'root');

CREATE TABLE table1 (col1 INT) 
ENGINE = FEDERATED CONNECTION='server1';