Name

LOAD DATA FROM MASTER

Synopsis

LOAD DATA FROM MASTER

This statement makes a copy of all the databases on the master server (except the mysql database) and then copies them to the slave servers. This statement will get a global read lock on all tables while it takes a snapshot of the databases. It will release the lock before copying them to the slaves. The MASTER_LOG_FILE and the MASTER_LOG_POS variables will be updated so that the slave knows where to begin logging. This statement currently works only with MyISAM tables, but will eventually work with InnoDB tables in future releases. The user for the connection must have RELOAD, SELECT, and SUPER privileges on the master server. The user must also have CREATE and DROP privileges on the slave server.

For large databases, increase the values of the net_read_timeout and net_write_timeout variables with the SET statement. To load a specific table from the master server, use the LOAD TABLE...FROM MASTER statement.

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.