1 [[!meta title="How can I backup and restore MySQL data?"]]
2 You can back up your SQL data in two ways: via the command-line, or
3 using the phpMyAdmin graphical user interface. Note that phpMyAdmin
4 **cannot import large databases** (to get around this limitation,
5 you can import and export databases using the command-line).
10 #### Backing up and restoring with the command-line client
13 [perform a kerberised ssh to scripts.mit.edu after sshing to an Athena workstation](/faq/41/)
14 (lockername@scripts if your website is in a locker). Then, to
17 **mysqldump** *user+database* **\>** *filename.sql*
19 To import a database dump, make sure the database exists (you may
20 need to create it from [sql.mit.edu](http://sql.mit.edu/)) and run
23 **mysql** *user+database* **<** *filename.sql*
28 #### Backing up and restoring with phpMyAdmin
30 You can use phpMyAdmin to backup and restore data. However,
31 **importing will not work for large databases**.
33 To backup your data using phpMyAdmin:
35 1. Log in to [phpMyAdmin](http://scripts.mit.edu/~sql/phpMyAdmin/)
37 [SQL password](/faq/59/accessing-mysql-in-athena-with-mycnf).
38 2. Select the database or table you want to export (if you want to
39 export just one database or table), and click the link at the
40 top-right labeled **Export**.
41 3. If a list of databases or tables displays at the top, select
42 the databases or tables you want to export: either use “Select
43 All”, or Ctrl-click / Cmd-click to select multiple items. (There is
44 no need to backup `information_schema`, since this is a read-only
46 4. Ensure the export type is “SQL”. Check the “Save as file” box
47 near the bottom, and select “gzipped” if you want to compress your
49 5. Click **Go** and save the downloaded file somewhere safe.
51 To restore your data using phpMyAdmin:
53 1. Make sure the database that you’re restoring into exists by
54 creating it on the [sql.mit.edu web interface](http://sql.mit.edu/)
55 (not phpMyAdmin) if necessary.
56 2. Log in to [phpMyAdmin](http://scripts.mit.edu/~sql/phpMyAdmin/)
58 [SQL password](/faq/59/accessing-mysql-in-athena-with-mycnf).
59 3. If you want to import a single database, choose that database
61 4. Click **Import** at the top.
62 5. Select the backup you downloaded previously (or any
63 SQL-formatted database dump) and click **Go**.