TOИIC
Search…
MySQL / MariaDB
Below you will find details on how to create a tonic user on both the source and destination databases with the minimum level of permissions needed for Tonic to function.

Source Database

The following is an example of how to create a new user, called tonic, and grant necessary permissions. For the source database we recommend using a backup or fast follower database instead of connecting directly to your production environment.
1
--create a user. '%' matches a user coming from any host.
2
CREATE USER 'tonic'@'%' IDENTIFIED BY 'tonic_password';
3
4
--give the user access to schema information
5
GRANT PROCESS ON *.* TO tonic;
6
7
--give the user access to tables in your preferred DBs
8
GRANT SELECT, SHOW VIEW ON preferred_db.* TO tonic;
9
Copied!
The following additional grants are optional to include triggers, routines, and/or events. If any of these GRANT options are used, the respective object types will be copied from the source to the destination database, otherwise they will be excluded.
1
--To include triggers
2
GRANT TRIGGER ON preferred_db.* TO tonic;
3
4
--To include routines on MySQL 5.7
5
GRANT SELECT ON mysql.proc TO tonic;
6
7
--To include routines on MySQL 8
8
GRANT SHOW ROUTINE ON preferred_db.* TO tonic;
9
10
--To include events
11
GRANT EVENT on preferred_db.* TO tonic;
Copied!

Destination Database

1
--create a new user.
2
CREATE USER 'tonic'@'%' IDENTIFIED BY 'tonic_password';
3
4
5
--This user must be granted access to everything. Amazon RDS handles this differently than vanilla MySQL
6
7
--On Amazon RDS
8
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'tonic'@'%' WITH GRANT OPTION;
9
10
--On vanilla MySQL
11
GRANT ALL PRIVILEGES ON * . * TO 'tonic'@'%';
Copied!