CREATE SERVER server_name
FOREIGN DATA WRAPPER wrapper_name
OPTIONS (option [, option] ...)
option: {
HOST character-literal
| DATABASE character-literal
| USER character-literal
| PASSWORD character-literal
| SOCKET character-literal
| OWNER character-literal
| PORT numeric-literal
}
This statement creates the definition of a server for use with the FEDERATED storage engine. The CREATE SERVER statement creates a new row in the servers table in the mysql database. This statement requires the SUPER privilege.
这条语句创建了用于FEDERATED存储引擎的服务器定义。CREATE SERVER语句在mysql数据库的servers表中创建一个新行。该语句需要SUPER权限。
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 64 characters (names longer than 64 characters are silently truncated), and is case-insensitive. You may specify the name as a quoted string.server_name
server_name应该是对服务器的唯一引用。服务器定义在服务器范围内是全局的,不可能将服务器定义限定为特定的数据库。Server_name最大长度为64个字符(超过64个字符的名称将被以静默方式截断),并且不区分大小写。您可以将名称指定为带引号的字符串。
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. Character literals are UTF-8, 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
对于每个选项,您必须指定字符字面量或数字字面量。字符字面值为UTF-8,支持最大长度64个字符,默认为空字符串。字符串字面值被无声地截断为64个字符。数字字面值必须是介于0到9999之间的数字,默认值为0。
Note
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. The options that you specify are used to populate the columns in the mysql.servers table. The table columns are Server_name, Host, Db, Username, Password, Port and Socket.
CREATE SERVER语句在mysql中创建一个条目。稍后在创建FEDERATED表时,可以与CREATE table语句一起使用。您指定的选项用于填充mysql中的列。服务器表。表列包括Server_name、Host、Db、Username、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”.
CREATE SERVER causes an implicit commit. See Section 13.3.3, “Statements That Cause an Implicit Commit”.
:CREATE SERVER导致隐式提交。
CREATE SERVER is not written to the binary log, regardless of the logging format that is in use.
无论使用哪种日志格式,都不会将CREATE SERVER写入二进制日志。
MySQL的CREATE SERVER语句用于创建FEDERATED存储引擎的服务器定义,它在mysql数据库的servers表中添加新行。该操作需要SUPER权限。服务器名称应具有唯一性,最大长度为64个字符,不区分大小写。此语句的选项包括字符或数字字面量,如主机名、数据库名、用户名、密码等,这些信息用于填充servers表的相应列。创建服务器定义后,可以结合CREATE TABLE语句来创建FEDERATED表。注意,CREATE SERVER操作会导致隐式提交,并且不会写入二进制日志。
281

被折叠的 条评论
为什么被折叠?



