Skip to main content
PlanetScale uses one user for everything it does on your source database: reading your schema, copying rows, replicating changes, and, after you switch primary traffic, replicating writes back to your source database. When you create the external keyspace, PlanetScale checks that this user has the grants below and won’t create the keyspace if any are missing. Below is the minimum set of permissions needed and what each allows the user to do: PlanetScale creates a database named ps_import_<ID> on your source database to track replication. The last portion of the name varies per external keyspace, which is why the grants use a wildcard.
  • Create the user with the host '%'. Grants for other hosts are not recognized.
  • Grant the privileges in the table above directly to the user, at the global or database level. The check does not recognize table-level grants or grants through a role.
  • ALL PRIVILEGES on a scope covers every grant for that scope.
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 MySQL script can be used to create a user with the necessary permissions inside of your database. You will need appropriate database permissions to run the script. The username will be migration_user. Make sure 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.
If your database is on Amazon RDS or Aurora, also let the user read your binlog retention setting:

Need help?

Get help from the PlanetScale Support team, or join our Discord community to see how others are using PlanetScale.