CREATE SERVERserver_name
FOREIGN DATA WRAPPERwrapper_name
OPTIONS (option
[,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. FEDERATED
存储引擎的服务器定义。The CREATE SERVER
statement creates a new row in the servers
table in the mysql
database. CREATE SERVER
语句在mysql
数据库的servers
表中创建一个新行。This statement requires the 此语句需要SUPER
privilege.SUPER
权限。
The
should be a unique reference to the server. server_name
server_name
应该是对服务器的唯一引用。Server definitions are global within the scope of the server, it is not possible to qualify the server definition to a specific database. 服务器定义在服务器范围内是全局的,无法将服务器定义限定为特定数据库。
has a maximum length of 64 characters (names longer than 64 characters are silently truncated), and is case-insensitive. server_name
server_name
的最大长度为64个字符(超过64个字符的名称将被自动截断),并且不区分大小写。You may specify the name as a quoted string.您可以将名称指定为带引号的字符串。
The
is an identifier and may be quoted with single quotation marks.wrapper_name
wrapper_name
是一个标识符,可以用单引号引起来。
For each 对于每个
you must specify either a character literal or numeric literal. option
option
,必须指定字符文字或数字文字。Character literals are UTF-8, support a maximum length of 64 characters and default to a blank (empty) string. 字符文字为UTF-8,最大长度为64个字符,默认为空字符串。String literals are silently truncated to 64 characters. 字符串文字将自动截断为64个字符。Numeric literals must be a number between 0 and 9999, default value is 0.数字文字必须是介于0和9999之间的数字,默认值为0。
The OWNER
option is currently not applied, and has no effect on the ownership or operation of the server connection that is created.OWNER
选项当前未应用,并且对所创建的服务器连接的所有权或操作没有影响。
The CREATE SERVER
statement creates an entry in the mysql.servers
table that can later be used with the CREATE TABLE
statement when creating a FEDERATED
table. CREATE SERVER
语句在mysql.servers
表中创建一个条目,稍后在创建FEDERATED
时可以与CREATE TABLE
语句一起使用。The options that you specify are used to populate the columns in the 您指定的选项用于填充mysql.servers
table. mysql.servers
表中的列。The table columns are 表列为Server_name
, Host
, Db
, Username
, Password
, Port
and Socket
.Server_name
、Host
、Db
、Userame
、Password
、Port
和Socket
。
For example:例如:
CREATE SERVER s FOREIGN DATA WRAPPER mysql OPTIONS (USER 'Remote', HOST '198.51.100.106', DATABASE 'test');
Be sure to specify all options necessary to establish a connection to the server. 确保指定与服务器建立连接所需的所有选项。The user name, host name, and database name are mandatory. 用户名、主机名和数据库名是必需的。Other options might be required as well, such as password.还可能需要其他选项,例如密码。
The data stored in the table can be used when creating a connection to a 在创建到FEDERATED
table:FEDERATED
表的连接时,可以使用表中存储的数据:
CREATE TABLE t (s1 INT) ENGINE=FEDERATED CONNECTION='s';
For more information, see Section 16.8, “The FEDERATED Storage Engine”.有关更多信息,请参阅第16.8节,“FEDERATED存储引擎”。
CREATE SERVER
causes an implicit commit. CREATE SERVER
导致隐式提交。See Section 13.3.3, “Statements That Cause an Implicit Commit”.请参阅第13.3.3节,“导致隐式提交的语句”。
CREATE SERVER
is not written to the binary log, regardless of the logging format that is in use.CREATE SERVER
不会写入二进制日志,无论使用何种日志格式。