How do I import a file?

HOW d i import a dump file into mySql. I was trying to do piece by piece but I was getting errors.

  Here is the first line of the dump file.      
                                     
-- MySQL Administrator dump 1.4
--
-- ------------------------------------------------------
-- Server version      4.1.16-nt

I think I should do this on the command line, but I not know how.

Thanks
baybookAsked:
Who is Participating?
 
star_trekCommented:
you can place any where, however it is better to place it in the current directory.
0
 
star_trekCommented:
use mysqldump
0
 
star_trekCommented:
you can do
mysql -h <dbname> -u<user-name> -p<passwd> --local-infile=1 {db-name} < {sql-file}
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
star_trekCommented:
{sql-file} can be
LOAD DATA LOCAL INFILE <file-name> INTO TABLE <table-name>;
//you can also mention fields terminated by \t or , default is \t
0
 
UmeshMySQL Principle Technical Support EngineerCommented:
Hi!

If the dump is generated by mysqldump utitlity ..

From command prompt..

shell>mysql -uusername -ppassword db_name < dumpfile.sql

If you are already running mysql, you can execute an SQL script file using the source or \. command:

mysql> source dump.sql
mysql> \. dump.sql

0
 
baybookAuthor Commented:
in which directory do I place the .sql file that I want to import?

Thanks!
0
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.