Announcement

Collapse
No announcement yet.

Command line to import dump.sql from my desktop?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Command line to import dump.sql from my desktop?

    Hi,

    I have managed to do a dump to my local machine (desktop) from another host, but don't know the command line to import from my desktop, is it possible to import via SSH from my desktop?

    mysql -uUSERNAME -p newdbname < /path/to/dump.sql mysql -uUSERNAME -p newdbname < /path/to/mydesktop/dump.sql??

    Cheers,
    Kez

  • #2
    If you have MySQL installed on your Windows machine, you can open command (in 9*/me) or cmd (in NT/XP) and change dir (cd) to the directory where mysql is located in.

    Since it is on your desktop, its a bit easier to move the file to the mysql directory, do that.

    you are in like somedir\mysql\bin\ in which mysql.exe is located. and the .sql then after you moved it to there.

    mysql.exe -u root -p databasenameforimport file.sql

    and it will prompt for pass, (most windows machines unconfigured use the enter key as passsword :P)

    Make a new mysql database first and ofcourse, set a user/pass to it, and update the above line from root to the new username and when it prompts, enter the password.

    The import will work its way, untill you get your dos prompt back again.


    on linux,
    the import is the same done,
    just the command or cmd is a bash shell or whatever you want to use.

    Comment


    • #3
      Thanks for your reply,

      The problem is that I'm using two servers. One is a shared mysql server and the other is for my webspace. Both run by the same webhost (fasthosts.co.uk) - this is their policy.

      I have downloaded the dump.sql to my desktop but don't know the proper command line to load the dump onto my shared database server.

      I could ftp the file to my webspace but I don't know if I can load the dump from here either (tech were vague) - and I don't know the command line for this either


      Kez

      Comment


      • #4
        I thought you downloaded it and wanted to import it on your test version on your localhost.

        You can upload the .sql to your web server and use shell (ssh/telnet) to login to that box and import it. If you can't, then the hosting provider should.

        Comment


        • #5
          Originally posted by xiphoid
          You can upload the .sql to your web server and use shell (ssh/telnet) to login to that box and import it. If you can't, then the hosting provider should.
          So I should:

          1) ftp the dump.sql to my webspace
          2) SSH into my database and import from my webspace

          Do you know what the command line for this would be?

          Thanks for your help xiphoid.

          Kez

          Comment


          • #6
            It's the same command you posted in the first post, just replace the path to the database dump with the real one.
            Chen Avinadav
            Better to remain silent and be thought a fool than to speak out and remove all doubt.

            גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

            Comment


            • #7
              sorry for being a dufus but...

              The database server and my webspace are on separate machines and I'm unable to ftp files to the shared database server so I guess I have to login to my database server and import from my webspace?

              As I say I'm unsure what to put after this:

              mysql -uUSERNAME -p newdbname < [what do I put here?]

              Comment

              Loading...
              Working...
              X