create-a-user-for-replication.html 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. Once GTID-based binlog replication is enabled, we recommend creating a dedicated
  2. user for Materialize with sufficient privileges to manage replication.
  3. 1. As a _superuser_, use `mysql` (or your preferred SQL client) to connect to
  4. your database.
  5. 1. Create a dedicated user for Materialize, if you don't already have one:
  6. ```mysql
  7. CREATE USER 'materialize'@'%' IDENTIFIED BY '<password>';
  8. ALTER USER 'materialize'@'%' REQUIRE SSL;
  9. ```
  10. IAM authentication with AWS RDS for MySQL is also supported. See the [Amazon RDS User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html) for instructions on enabling IAM database authentication, creating IAM policies, and creating a database account.
  11. 1. Grant the user permission to manage replication:
  12. ```mysql
  13. GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT, LOCK TABLES ON *.* TO 'materialize'@'%';
  14. ```
  15. Once connected to your database, Materialize will take an initial snapshot of
  16. the tables in your MySQL server. `SELECT` privileges are required for this
  17. initial snapshot.
  18. 1. Apply the changes:
  19. ```mysql
  20. FLUSH PRIVILEGES;
  21. ```