Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2009
    Posts
    5

    Unanswered: 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?

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    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 on the Tiger 800 or the Norton

  3. #3
    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...

  4. #4
    Join Date
    Mar 2004
    Posts
    480
    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.

  5. #5
    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?

  6. #6
    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

  7. #7
    Join Date
    Mar 2004
    Posts
    480
    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.

  8. #8
    Join Date
    Jan 2009
    Posts
    5
    Thanks, your replies really helped sort the problem out.... Everything seems to be working out now...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •