Follow Along as I Stumble on the Path to Learning RoR

Importing a MySQL Database in Windows

I switched computers and had to migrate my dev database.  I was able to export my old database, but had trouble importing it using phpmyadmin (actually, I couldn’t get phpmyadmin to work) and MySQL Workbench.  So I had to go into the Windows command prompt to do it.  Here’s what I did after generating a dump (ie your_database_name.sql) which contained the SQL and data to rebuild the DB.  To make this work, the database needs to be created (ie rake db:create), but the tables must not exist yet (or you’ll get a SQL error telling you that the table already exists).

(1) saved the your_database_name.sql to: users/your_user_name on the PC

(2) started the command prompt (start menu >search for programs -> cmd)

(3) typed mysql -u USERNAME -p DATABASE < FILENAME.sql

Thanks to ghacks.net for teaching me this.  They also have the sql for exporting a *.sql dump if you need that.

Advertisements

Comments are closed.