If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Import database with command line problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-15-09, 09:12
warstormer warstormer is offline
Registered User
 
Join Date: Jan 2009
Posts: 5
Import database with command line problem

I'm trying to import a .sql backup of a database on my localhost with command line using:

mysql> -uroot -p databasename < backupname.sql

hitting return I get -> and a flashing cursor but nothing seems to happen.

could I be pointing to the .sql file incorrectly? Anything else I've missed?
Reply With Quote
  #2 (permalink)  
Old 01-15-09, 10:06
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
I dunno
its years since Ive used the command line to do a backup
... I would have expected the < to be a >, but thats just a guess

when I have to do backups I prefer to do them through the MySQL Adminstrator, or leave it to the network trolls to do their stuff
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 01-15-09, 10:35
warstormer warstormer is offline
Registered User
 
Join Date: Jan 2009
Posts: 5
Yeah I wish I didn't have to use command line but this is for a server transfer... I have the backup.sql file but MySQL Administrator wouldn't handle it because it said it was generated by mysqldump...
Reply With Quote
  #4 (permalink)  
Old 01-15-09, 11:12
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
you are trying to run that inside mysql when you actually want to run it in your shell or dos window if you are on windows.
Reply With Quote
  #5 (permalink)  
Old 01-15-09, 11:17
warstormer warstormer is offline
Registered User
 
Join Date: Jan 2009
Posts: 5
Ah, so it should be?:

C:\> mysql -u root -p databasename < backup.sql

where should the backup.sql file actually be located?
Reply With Quote
  #6 (permalink)  
Old 01-15-09, 11:36
warstormer warstormer is offline
Registered User
 
Join Date: Jan 2009
Posts: 5
Ok, so that pretty much worked but used this exact entry (I'm using xampp)..

C:\xampp\mysql\bin>mysql u -root databasename < ../backupname.sql
Reply With Quote
  #7 (permalink)  
Old 01-15-09, 16:49
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
fyi your backup file can be anywhere on your machine, you would just have to list the full path to the file. (i.e. c:\somewhere\else\is\where\thisfileis.sql) for example.
Reply With Quote
  #8 (permalink)  
Old 01-15-09, 17:40
warstormer warstormer is offline
Registered User
 
Join Date: Jan 2009
Posts: 5
Thanks, your replies really helped sort the problem out.... Everything seems to be working out now...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On