List:General Discussion« Previous MessageNext Message »
From:Daniel Kasak Date:January 14 2004 2:38am
Subject:Re: Importing a dumpfile
View as plain text  
Matthew Stuart wrote:

> Right having just got to grips with the mysqldump command, I would 
> like to be able to know how to import the database back in to MySQL 
> should anything happen to my PC.
> Does mysqlimport have to be done in the command line window like 
> mysqldump, and if so, how? It's just that I tried to import stating 
> terminated, enclosed, escaped, etc and by the time I had come to list 
> the db name to import in to and the path to the file I wish to import, 
> the window wouldn't let me type anymore. Why? Did it get as bored as I 
> did?
> What syntax do you people out there use?
> Mat
I just use the mysql client, eg to restore a full dump:

mysql < backup_file.sql -p      ( hit enter and type password )

or to restore a single database:

mysql -p       ( hit enter and type password )
create database my_new_database;
mysql my_new_database < backup_file.sql -p     ( hit enter and type 
password )

Or you can edit the backup file and insert a:

use name_of_database

at the top.

You may need to turn off foreign key constraint checking first: |SET 
FOREIGN_KEY_CHECKS=0 ( insert this into the dump file ).

Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak@stripped

Importing a dumpfileMatthew Stuart14 Jan
  • Re: Importing a dumpfileDaniel Kasak14 Jan
  • Re: Importing a dumpfileDouglas Sims14 Jan
  • Re: Importing a dumpfileRoger Baklund14 Jan
    • why: mysqldump and mysqlimport?EP14 Jan
      • Re: why: mysqldump and mysqlimport?Dan Nelson14 Jan
      • Re: why: mysqldump and mysqlimport?Tobias Asplund14 Jan
      • Re: why: mysqldump and mysqlimport?Daniel Kasak14 Jan