Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
docs: upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
planetscale-actions-bot committed Sep 21, 2023
1 parent ca333bf commit da2edce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
32 changes: 16 additions & 16 deletions docs/imports/import-tool-user-requirements.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
---
title: 'Import tool user permissions'
subtitle: 'List of the grants required to import a database into PlanetScale using the Import tool'
date: '2022-07-25'
date: '2023-09-21'
---

When importing a database using our [Import tool](/docs/imports/database-imports), 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:

| Scope | Databases | Grant | Description |
| ------ | ------------------------ | -------------------- | ---------------------------------------------------------------------------- |
| Global | n/a | `PROCESS` | Enable the user to see all processes with SHOW PROCESSLIST. |
| Global | n/a | `REPLICATION SLAVE` | Enable replicas to read binary log events from the source. |
| Global | n/a | `REPLICATION CLIENT` | Enable the user to ask where source or replica servers are. |
| Table | `<DATABASE_NAME>`, `_vt` | `SELECT` | Enable use of SELECT. |
| Table | `<DATABASE_NAME>`, `_vt` | `INSERT` | Enable use of INSERT. |
| Table | `<DATABASE_NAME>` | `LOCK TABLES` | Enable use of LOCK TABLES on tables for which you have the SELECT privilege. |
| Table | `<DATABASE_NAME>` | `SHOW VIEW` | Enable use of SHOW VIEW. |
| Table | `<DATABASE_NAME>`, `_vt` | `UPDATE` | Enable use of UPDATE. |
| Table | `<DATABASE_NAME>`, `_vt` | `DELETE` | Enable use of DELETE. |
| Table | `_vt` | `CREATE` | Enable database and table creation. |
| Table | `_vt` | `DROP` | Enable databases, tables, and views to be dropped. |
| Table | `_vt` | `ALTER` | Enable use of ALTER TABLE. |
| Scope | Databases | Grant | Description |
| ------ | -------------------------------- | -------------------- | ---------------------------------------------------------------------------- |
| Global | n/a | `PROCESS` | Enable the user to see all processes with SHOW PROCESSLIST. |
| Global | n/a | `REPLICATION SLAVE` | Enable replicas to read binary log events from the source. |
| Global | n/a | `REPLICATION CLIENT` | Enable the user to ask where source or replica servers are. |
| Table | `<DATABASE_NAME>`, `ps_import_*` | `SELECT` | Enable use of SELECT. |
| Table | `<DATABASE_NAME>`, `ps_import_*` | `INSERT` | Enable use of INSERT. |
| Table | `<DATABASE_NAME>` | `LOCK TABLES` | Enable use of LOCK TABLES on tables for which you have the SELECT privilege. |
| Table | `<DATABASE_NAME>` | `SHOW VIEW` | Enable use of SHOW VIEW. |
| Table | `<DATABASE_NAME>`, `ps_import_*` | `UPDATE` | Enable use of UPDATE. |
| Table | `<DATABASE_NAME>`, `ps_import_*` | `DELETE` | Enable use of DELETE. |
| Table | `ps_import_*` | `CREATE` | Enable database and table creation. |
| Table | `ps_import_*` | `DROP` | Enable databases, tables, and views to be dropped. |
| Table | `ps_import_*` | `ALTER` | Enable use of ALTER TABLE. |

{% callout %}
The descriptions in the table above were taken from the MySQL docs. For a full list of all possible grants and their
Expand All @@ -40,5 +40,5 @@ This script can be used to create a user with the necessary permissions. The use
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'@'%';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON `ps_import\_%`.* TO 'migration_user'@'%';
```
6 changes: 3 additions & 3 deletions docs/imports/mariadb-migration-guide.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'MariaDB migration guide'
subtitle: 'Learn how to import your database from a MariaDB server into a PlanetScale MySQL database.'
date: '2023-04-19'
date: '2023-09-21'
---

## Overview
Expand Down Expand Up @@ -73,10 +73,10 @@ Now you can configure the necessary permissions on the database you wish to migr
GRANT SELECT, INSERT, UPDATE, DELETE, SHOW VIEW, LOCK TABLES ON `<DATABASE_NAME>`.* TO 'migration_user'@'%';
```

Finally, you’ll need to configure permissions on a table called `_vt` that will be used to track replication between MariaDB and PlanetScale.
Finally, you’ll need to configure permissions on a database called `ps_imports_*` (the last portion of the name will vary) that will be used to track replication between MariaDB and PlanetScale.

```sql
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON `_vt`.* TO 'migration_user'@'%';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON `ps_import\_%`.* TO 'migration_user'@'%';
```

For a full explanation on what each of these grants do, [our article on configuring a migration account for MySQL databases](/docs/imports/import-tool-user-requirements) details each requirement.
Expand Down

0 comments on commit da2edce

Please sign in to comment.