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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

star_trekCommented:
use mysqldump
star_trekCommented:
you can do
mysql -h <dbname> -u<user-name> -p<passwd> --local-infile=1 {db-name} < {sql-file}
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
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

UmeshSenior Principal 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

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

Thanks!
star_trekCommented:
you can place any where, however it is better to place it in the current directory.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.