Import MySQL tables from .myd

This is an easy procedure to import any MyISAM table that you would have in .myd, .myi and .frm format, into a local database. I assume you have MySQL server and a MySQL client on your local machine.

  • First, identify the name of the table (that’s the name before the “.myd” extension).
  • Connect to your local database and create a dummy database (let’s call it “import”)
  • Create a table inside that database with the exact same name as the one you need to import. Let’s say it’s called user.myd, so call the table “user”
  • Disconnect from your database and shut down your MySQL server (Ubuntu: sudo /etc/init.d/mysql stop)
  • Copy the backup files (user.*) into your MySQL data directory (Ubuntu: /var/lib/mysql/import/)
  • Restart your MySQL server (Ubuntu: sudo /etc/init.d/mysql start)
  • Enjoy the imported table.

Related Posts

Vim regexp: transforming multiple SQL inserts into a big one

If you ever face a very slow MySQL process based on a very...

Dokeos and MySQL strict SQL mode

We’ve had reports about Dokeos creating problems when used with MySQL in strict...