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

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
0
baybook
Asked:
baybook
  • 4
2 Solutions
 
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
 
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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
UmeshCommented:
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
 
star_trekCommented:
you can place any where, however it is better to place it in the current directory.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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