MySQL: Difference between revisions
add setting up a replication (master-slave) |
|||
Line 8: | Line 8: | ||
Activate the binary log on the master. <code>innodb_flush_log_at_trx_commit</code> and <code>sync_binlog</code> added for greatest possibility durability and consistency in a replication setup using <span class="package">InnoDB</span> with transactions. | Activate the binary log on the master. <code>innodb_flush_log_at_trx_commit</code> and <code>sync_binlog</code> added for greatest possibility durability and consistency in a replication setup using <span class="package">InnoDB</span> with transactions. | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="cfg"> | ||
[mysqld] | [mysqld] | ||
log-bin=mysql-bin | log-bin=mysql-bin | ||
Line 14: | Line 14: | ||
innodb_flush_log_at_trx_commit=1 | innodb_flush_log_at_trx_commit=1 | ||
sync_binlog=1 | sync_binlog=1 | ||
</syntaxhighlight> | |||
=== Create a user for replication === | |||
Grant <span class="package">REPLICATION_SLAVE</span> privilege to the new user. | |||
<syntaxhighlight lang="mysql"> | |||
mysql> CREATE USER 'repl'@'%.mydomain.com' IDENTIFIED BY 'mypassword'; | |||
mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%.mydomain.com'; | |||
</syntaxhighlight> | </syntaxhighlight> | ||