Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Unable to import database from ssh command line

Discussion in 'Database Discussions' started by ameisez, Dec 11, 2017.

  1. ameisez

    ameisez Member

    Joined:
    Jun 18, 2009
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    51
    Hi,

    First off, I am not comfortable with command line interface. Just trying to survive the day.

    Im trying to follow along this article as referred to by a cPanel support member but I am unable to. No error message was shown and no import happens.

    a2hosting.com/kb/developer-corner/mysql/import-and-export-a-mysql-database#Method-2.3A-Use-the-emmysqlem-program

    Here is what I did so far.

    I transfer a database dump file (filename: mydumpfile.sql) from old server to new server.
    Created a cpanel account name theUser (with shell access) on new server
    Logged in to theUser cpanel account
    Create database name theUser_mynewdatabase
    Create database username theUser_theDBu
    Allow All permission to the new username

    Logged in to ssh as theUser
    Copy the dump file to user account root
    Checked if the dump file is at the account root before starting import

    Run command
    mysql -u theUser_theDBu -p theUser_mynewdatabase < mydumpfile.sql

    password prompt and I supply the password

    Nothing happens. Just went back to ssh command prompt window

    I Went to cpanel and checked the database. No added tables on the database.

    What Did I missed? What I did wrong?

    Thanks
     
    #1 ameisez, Dec 11, 2017
    Last edited by a moderator: Dec 11, 2017
  2. mtindor

    mtindor Well-Known Member

    Joined:
    Sep 14, 2004
    Messages:
    1,323
    Likes Received:
    49
    Trophy Points:
    178
    Location:
    inside a catfish
    cPanel Access Level:
    Root Administrator
    Are you positive that mydumpfile.sql has content in it. If you ran the command that you say you ran, and you received no errors, and you were sent back to the prompt afterwards, that's an indication to me that the database import did work. Now, if you go and look at theUser_mynewdatabase and find that it is empty, that suggests to me that the import SQL file that you used contained no data.

    Otherwise, if there were any errors during the process, you would have received some sort of message from MySQL stating what the issue is/was.

    Mike
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,734
    Likes Received:
    1,706
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    The previous post is correct. Check to verify the SQL file you are importing includes the required data. You can directly view the file with the "cat" command to check (but don't post the output here as it will contain sensitive data):

    Code:
    cat /path/to/file.sql
    Thank you.
     
Loading...

Share This Page