• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 521
  • Last Modified:

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: http://www.experts-exchange.com/Database/MySQL/Q_24816755.html?sfQueryTermInfo=1+10+30+command+file+import+line+mysql

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!
0
rmm2001
Asked:
rmm2001
  • 2
  • 2
1 Solution
 
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: http://dev.mysql.com/doc/refman/5.1/en/programs.html

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

mysql -uusername -ppassword databasename < sqlfile.sql
0
 
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?

Thanks!
0
 
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?
0
 
rmm2001Author Commented:
Thanks!
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now