MySQL: Difference between revisions

568 bytes added ,  22 May 2017
→‎Create a user for replication: add Get master's binary log coordinate
→‎Create a user for replication: add Get master's binary log coordinate
Line 23: Line 23:
mysql> CREATE USER 'repl'@'%.mydomain.com' IDENTIFIED BY 'mypassword';
mysql> CREATE USER 'repl'@'%.mydomain.com' IDENTIFIED BY 'mypassword';
mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%.mydomain.com';
mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%.mydomain.com';
</syntaxhighlight>
=== Get master's binary log coordinate ===
On the master stop commit operations on InnoDB table and read the coordinates.
<syntaxhighlight lang="mysql">
mysql> FLUSH TABLES WITH READ LOCK;
mysql> SHOW MASTER STATUS;
+------------------+----------+--------------+------------------+
| File            | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000003 | 73      | test        | manual,mysql    |
+------------------+----------+--------------+------------------+
</syntaxhighlight>
</syntaxhighlight>