Import MySQL File with Command Line

Hi guys -

I know little to nothing about MySQL (all of what I know is dedicated to Microsoft...). I have a MySQL export file though that someone made me that's 91mb that won't open in workbench. (I downloaded the free windows client and database).

Workbench just freezes..crashes and then wants me to input a bug request. But I know the problem is because the file is too big since that's what would happen in MS SQL if I tried to open a 91mb sql file.

It's just a bunch of create/insert sql commands to create and load a database. I can open it in WordPad just fine.

I went here:

and I tried that but I have no clue where to type in those commands to make it work. I tried command prompt (Start > Run > cmd). And then I tried the MySQL command client. And then the shell inside Workbench and none of those imported the file.

In command prompt I just got "mysql is unsupported" and then there were syntax errors in the MySQL tools.

So .. how do I infact import this file?

Any help (stupid simple line by line since this is alien technology) would be super appreciated!

Thanks so much!
Who is Participating?
Dave BaldwinFixer of ProblemsCommented:
You need at least this part to get access:

mysql -uusername -ppassword

After that you have to select a database and your login must have permissions on that database.  It is not the same model as MS SQL.

To use this:

mysql -uusername -ppassword databasename < sqlfile.sql

all those requirements must be met also.

What error messages are you getting?
Dave BaldwinFixer of ProblemsCommented:
I hope you didn't edit it in Word or Wordpad.  That would probably corrupt the file.  "mysql is unsupported" implies that MySQL is not installed on your computer.

MySQL programs:

If the 'mysql' command line program is running, the easiest command to import a MySQL formatted file is:

mysql -uusername -ppassword databasename < sqlfile.sql
rmm2001Author Commented:
hmm no - i redownloaded it just incased i accidentally did. I still get the same info. The help link you posted is very large and chatty - do I need to really understand all of it or is there an easy way to get this file in?

WIth MS SQL, there is also a command line utility that I use, bu tthat seems to pop up right out of command prompt (I just type in osql and it appears). When I try typing "mysql" in windows command prompt I just get errors. Does that mean I didn't install something right? Could that be my issue do you think?

rmm2001Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.