CREATE SERVERserver_nameFOREIGN DATA WRAPPERwrapper_nameOPTIONS (option...)option: { HOSTcharacter-literal| DATABASEcharacter-literal| USERcharacter-literal| PASSWORDcharacter-literal| SOCKETcharacter-literal| OWNERcharacter-literal| PORTnumeric-literal}
This statement creates the definition of a server for use with
the FEDERATED storage engine. The
CREATE SERVER statement creates a new row
within the servers table within the
mysql database. This statement requires the
SUPER privilege.
The
should be a unique reference to the server. Server definitions
are global within the scope of the server, it is not possible to
qualify the server definition to a specific database.
server_name has a
maximum length of 63 characters (names longer than 63 characters
are silently truncated), and is case insensitive. You may
specify the name using single quotes.
server_name
The
should be wrapper_namemysql, and may be quoted with
single quotes. Other values for
are
not currently supported.
wrapper_name
For each
you must specify either a character literal or numeric literal.
Character literals are UTF8, support a maximum length of 64
characters and default to a blank (empty) string. String
literals are silently truncated to 64 characters. Numeric
literals must be a number between 0 and 9999, default value is
0.
option
The CREATE SERVER statement creates an entry
in the mysql.server table that can later be
used with the CREATE TABLE statement when
creating a FEDERATED table. The options that
you specify will be used to populate the columns in the
mysql.server table. The table columns are
Server_name, Host,
Db, Username,
Password, Port and
Socket.
For example:
CREATE SERVER s FOREIGN DATA WRAPPER mysql OPTIONS (USER 'Remote', HOST '192.168.1.106', DATABASE 'test');
The data stored in the table can be used when creating a
connection to a FEDERATED table:
CREATE TABLE t (s1 INT) ENGINE=FEDERATED CONNECTION='s';
For more information, see
Section 14.9, “The FEDERATED Storage Engine”.
CREATE SERVER does not cause an automatic
commit.

User Comments
Add your own comment.