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!

Unable to import database from ssh command line

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

  1. ameisez

    ameisez Member

    Jun 18, 2009
    Likes Received:
    Trophy Points:

    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.

    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?

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

    mtindor Well-Known Member

    Sep 14, 2004
    Likes Received:
    Trophy Points:
    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.

    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator

    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):

    cat /path/to/file.sql
    Thank you.
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice