SQL Statements for Controlling Slave Servers
1130
• It acquires a global read lock on the master while taking the snapshot, which prevents updates on
the master during the load operation.
If you are loading large tables, you might have to increase the values of
net_read_timeout
[478]
and
net_write_timeout
[479]
on both the master and slave servers. See
Section 5.1.4, “Server
System Variables”
.
Note that
LOAD DATA FROM MASTER
does not copy any tables from the
mysql
database. This makes
it easy to have different users and privileges on the master and the slave.
To use
LOAD DATA FROM MASTER
, the replication account that is used to connect to the master must
have the
RELOAD
[577]
and
SUPER
[578]
privileges on the master and the
SELECT
[578]
privilege for all
master tables you want to load. All master tables for which the user does not have the
SELECT
[578]
privilege are ignored by
LOAD DATA FROM MASTER
. This is because the master hides them from
the user:
LOAD DATA FROM MASTER
calls
SHOW DATABASES
to know the master databases to
load, but
SHOW DATABASES
returns only databases for which the user has some privilege. See
Section 13.7.5.11, “
SHOW DATABASES
Syntax”
. On the slave side, the user that issues
LOAD DATA
FROM MASTER
must have privileges for dropping and creating the databases and tables that are
copied.
13.4.2.3.
LOAD TABLE tbl_name FROM MASTER
Syntax
LOAD TABLE
tbl_name
FROM MASTER
This feature is deprecated and should be avoided. It is subject to removal in a future version of
MySQL.
Since the current implementation of
LOAD DATA FROM MASTER
and
LOAD TABLE FROM MASTER
is
very limited, these statements are deprecated as of MySQL 4.1 and removed in MySQL 5.5.
The recommended alternative solution to using
LOAD DATA FROM MASTER
or
LOAD TABLE FROM
MASTER
is using
mysqldump
or
mysqlhotcopy
. The latter requires Perl and two Perl modules (
DBI
and
DBD:mysql
) and works for
MyISAM
and
ARCHIVE
tables only. With
mysqldump
, you can create
SQL dumps on the master and pipe (or copy) these to a
mysql
client on the slave. This has the
advantage of working for all storage engines, but can be quite slow, since it works using
SELECT
.
Transfers a copy of the table from the master to the slave. This statement is implemented mainly
debugging
LOAD DATA FROM MASTER
operations. To use
LOAD TABLE
, the account used for
connecting to the master server must have the
RELOAD
[577]
and
SUPER
[578]
privileges on the master
and the
SELECT
[578]
privilege for the master table to load. On the slave side, the user that issues
LOAD TABLE FROM MASTER
must have privileges for dropping and creating the table.
The conditions for
LOAD DATA FROM MASTER
apply here as well. For example,
LOAD TABLE FROM
MASTER
works only for
MyISAM
tables. The timeout notes for
LOAD DATA FROM MASTER
apply as
well.
13.4.2.4.
MASTER_POS_WAIT()
Syntax
SELECT MASTER_POS_WAIT('
master_log_file
',
master_log_pos
[,
timeout
])
This is actually a function, not a statement. It is used to ensure that the slave has read and executed
events up to a given position in the master's binary log. See
Section 12.14, “Miscellaneous Functions”
,
for a full description.
The following table shows the maximum permissible length for the string-valued options.
Option
Maximum Length
MASTER_HOST
60
MASTER_USER
16
MASTER_PASSWORD
32
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...