When importing a database using our Import tool, you will need to connect to your existing database with a user that has the proper permissions to set up the necessary configurations to start importing data.
Below is the minimum set of permissions needed and what each allows the user to do:
|Global||n/a||Enable the user to see all processes with SHOW PROCESSLIST.|
|Global||n/a||Enable replicas to read binary log events from the source.|
|Global||n/a||Enable the user to ask where source or replica servers are.|
|Table||Enable use of SELECT.|
|Table||Enable use of INSERT.|
|Table||Enable use of LOCK TABLES on tables for which you have the SELECT privilege.|
|Table||Enable use of SHOW VIEW.|
|Table||Enable use of UPDATE.|
|Table||Enable use of DELETE.|
|Table||Enable database and table creation.|
|Table||Enable databases, tables, and views to be dropped.|
|Table||Enable use of ALTER TABLE.|
The descriptions in the table above were taken from the MySQL docs. For a full list of all possible grants and their impact, please refer to the GRANT Statement page of the MySQL docs, and locate the section titled Privileges Supported by MySQL.
This script can be used to create a user with the necessary permissions. The username will be
migration_user. You will need to update the following variables:
<SUPER_STRONG_PASSWORD>— The password for the
<DATABASE_NAME>— The name of the database you will import into PlanetScale.
CREATE USER 'migration_user'@'%' IDENTIFIED BY '<SUPER_STRONG_PASSWORD>';GRANT PROCESS, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'migration_user'@'%';GRANT SELECT, INSERT, UPDATE, DELETE, SHOW VIEW, LOCK TABLES ON `<DATABASE_NAME>`.* TO 'migration_user'@'%';GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON `ps_import\_%`.* TO 'migration_user'@'%';