1. The Rock

    The Rock Banned Banned

    Oct 25, 2010
    59
    How to IMPORT MySQL database using SSH in Kloxo On VPS ?? :facepalm:
     
  2. .:Raymond:.

    .:Raymond:. New Member Member

    Jan 13, 2011
    1,183
    Code:
    mysql -u username -p database_name < dumpfile.sql
    Use that
     
  3. Cory

    Cory New Member Member

    Apr 3, 2011
    362
    Awesome useful tool, I have coded a ssh script once before because I could never remember the correct syntax.

    Code:
    echo "MySQL Username"
    read username
    echo "MySQL Database"
    read database
    echo "MySQL File"
    read file
    mysql -u $username -p $database < $file
    
    Copy and Paste, save as: mysqlimport.sh - chmod +x 755 and sh mysqlimport.sh and follow the onscreen prompts, I should update my easy ssh tools.
     
    Last edited: Jun 18, 2011
  4. The Rock

    The Rock Banned Banned

    Oct 25, 2010
    59

    i try that but its not working...
     
  5. Cory

    Cory New Member Member

    Apr 3, 2011
    362
    You have to be in the same directory as the file.
     
  6. Dj Mad

    Dj Mad Banned Banned

    May 3, 2009
    1,500
    it should be

    mysql -uusername -pdatabase_name < dumpfile.sql
     
  7. Lifetalk

    Lifetalk Well-Known Member Member

    Jul 20, 2008
    4,336
    And the error is?
     
  8. The Rock

    The Rock Banned Banned

    Oct 25, 2010
    59
    No such files directories
    i give with this also home/admin/my directories.
     
    Last edited: Jun 18, 2011
  9. Lifetalk

    Lifetalk Well-Known Member Member

    Jul 20, 2008
    4,336
    That syntax is wrong. There's a space between -u and the username. There is, however, no space between -p and the password (or the password can be left blank and entered at the prompt that follows).


    @OP
    cd to the directory where the .sql file is hosted, then run the command
     
  10. Cory

    Cory New Member Member

    Apr 3, 2011
    362
    I don't think it matters, I've used the first syntax and the ones without spaces and they all tend to work.
     

Share This Page