Restore a single table from a full mysqldump file

Note: This article assumes that you have installed and configured MySQL® on your server.


  • A MySQL® server
  • Access to a MySQL® privileged user such as root.
  • A MySQL® dump file of the database that includes the table that you want to import.


  1. Login into your MySQL® server.
    Note: This step can change depending on your OS and user type.
    mysql -u root -p
  2. Create a temporary database.
    CREATE DATABASE tempdatabase;
  3. Exit the MySQL® server.
  4. Go to the MySQL® dump file directory and execute the following command:
    mysql -u root -p tempdatabase < mysqldump.sql
  5. Login into your MySQL® server to ensure that your database was imported properly and the table exists. (Optional)
    Login into your MySQL® server.
    mysql -u root -p
    Switch to the temporary database and show the tables:
    USE tempdatabase;
  6. Export the desire table to a MySQL® dump.
    mysqldump -u root -p tempdatabase mytable > mytabledump.sql
  7. Import the table to the database.
    mysql -u root -p mydatabase < mytabledump.sql
  8. Delete the temporary database.
    Login into your MySQL® server.
    mysql -u root -p
    Delete the database:
    DROP DATABASE tempdatabase;