Outdated Version

You are viewing an older version of this section. View current production version.

Exporting Data From MemSQL min read


This topic describes how to export data from MemSQL databases using mysqldump, which you can use because MemSQL supports the same query-level inputs and outputs as MySQL. mysqldump creates a .sql file containing the queries necessary to recreate a database. You can run the output of mysqldump against an instance of MemSQL or MySQL, so you can use this strategy to move data between the two.

Find the mysqldump reference page here.

Backing up a Single Database

$ mysqldump -h 127.0.0.1 -u root -P 3306 foo > foo.sql

If you have a database named “foo”, you can create a backup with the following command:

Backing up All Databases

If you want to back up every database in an instance of MemSQL, use the following command:

$ mysqldump -h 127.0.0.1 -u root -P 3306 --all-databases > full_backup.sql
Info

Mysqldump uses LOCK TABLES to help ensure that it reads a consistent view of the database as it queries across tables.

This means you cannot run write queries against the database while the backup is being performed.