Import tool user permissions

List of the grants required to import a database into PlanetScale using the Import tool

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:

ScopeDatabasesGrantDescription
Globaln/aPROCESSEnable the user to see all processes with SHOW PROCESSLIST.
Globaln/aREPLICATION SLAVEEnable replicas to read binary log events from the source.
Globaln/aREPLICATION CLIENTEnable the user to ask where source or replica servers are.
Table<DATABASE_NAME>, _vtSELECTEnable use of SELECT.
Table<DATABASE_NAME>, _vtINSERTEnable use of INSERT.
Table<DATABASE_NAME>LOCK TABLESEnable use of LOCK TABLES on tables for which you have the SELECT privilege.
Table<DATABASE_NAME>SHOW VIEWEnable use of SHOW VIEW.
Table<DATABASE_NAME>, _vtUPDATEEnable use of UPDATE.
Table<DATABASE_NAME>, _vtDELETEEnable use of DELETE.
Table_vtCREATEEnable database and table creation.
Table_vtDROPEnable databases, tables, and views to be dropped.
Table_vtALTEREnable use of ALTER TABLE.
Note

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.

Script to create user

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 migration_user account.
  • <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 `_vt`.* TO 'migration_user'@'%';

Need help?

Get help from the PlanetScale Support team, or join our GitHub discussion board to see how others are using PlanetScale.

Was this page useful?
Last updated on
Help us improve this page