SQL Statements for Controlling Slave Servers
1127
13.4.1.3.
SET sql_log_bin
Syntax
SET sql_log_bin = {0|1}
Disables or enables binary logging for the current session (
sql_log_bin
[494]
is a session variable)
if the client has the
SUPER
[578]
privilege. The statement fails with an error if the client does not have
that privilege.
13.4.2. SQL Statements for Controlling Slave Servers
This section discusses statements for managing slave replication servers.
Section 13.4.1, “SQL
Statements for Controlling Master Servers”
, discusses statements for managing master servers.
In addition to the statements described here,
SHOW SLAVE STATUS
is also used with replication
slaves. For information about this statement, see
Section 13.7.5.31, “
SHOW SLAVE STATUS
Syntax”
.
13.4.2.1.
CHANGE MASTER TO
Syntax
CHANGE MASTER TO
option
[,
option
] ...
option
:
MASTER_HOST = '
host_name
'
| MASTER_USER = '
user_name
'
| MASTER_PASSWORD = '
password
'
| MASTER_PORT =
port_num
| MASTER_CONNECT_RETRY =
interval
| MASTER_LOG_FILE = '
master_log_name
'
| MASTER_LOG_POS =
master_log_pos
| RELAY_LOG_FILE = '
relay_log_name
'
| RELAY_LOG_POS =
relay_log_pos
| MASTER_SSL = {0|1}
| MASTER_SSL_CA = '
ca_file_name
'
| MASTER_SSL_CAPATH = '
ca_directory_name
'
| MASTER_SSL_CERT = '
cert_file_name
'
| MASTER_SSL_KEY = '
key_file_name
'
| MASTER_SSL_CIPHER = '
cipher_list
'
CHANGE MASTER TO
changes the parameters that the slave server uses for connecting to the master
server, for reading the master binary log, and reading the slave relay log. It also updates the contents
of the
master.info
and
relay-log.info
files. To use
CHANGE MASTER TO
, the slave replication
threads must be stopped (use
STOP SLAVE
if necessary).
Options not specified retain their value, except as indicated in the following discussion. Thus, in most
cases, there is no need to specify options that do not change. For example, if the password to connect
to your MySQL master has changed, you just need to issue these statements to tell the slave about the
new password:
STOP SLAVE; -- if replication was running
CHANGE MASTER TO MASTER_PASSWORD='new3cret';
START SLAVE; -- if you want to restart replication
MASTER_HOST
,
MASTER_USER
,
MASTER_PASSWORD
, and
MASTER_PORT
provide information to the
slave about how to connect to its master:
•
MASTER_HOST
and
MASTER_PORT
are the host name (or IP address) of the master host and its TCP/
IP port.
Note
Replication cannot use Unix socket files. You must be able to connect to the
master MySQL server using TCP/IP.
If you specify the
MASTER_HOST
or
MASTER_PORT
option, the slave assumes that the master
server is different from before (even if the option value is the same as its current value.) In this
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...