Documentation

Importing data into your database

This document explains how to import data into your database.

The steps in this document may be too slow for large databases. If you want to import a large database, contact us at support@planetscale.com.

Prerequisites

Before you import data into your database, you must first create a database. If you want your database to use multiple shards, apply your sharding scheme before importing data.

Overview

To import data into your database, complete the following steps:

  1. Export your database to a file.
  2. Connect to your database.
  3. Reload the database file from your MySQL client.

Step 1: Export your database to a file

Using your MySQL client, export your source database to a file. For example, you can use the mysqldump command to export your database to a file in .sql format:

shell> mysqldump --source-database > exported-database.sql

Step 2: Connect to your database.

Step 3: Reload the database file from your MySQL client.

Using your MySQL client, import your database file. For example, you can use the mysql command with the database file as an input:

shell> mysql < exported-database.sql