Unable to import database from ssh command line

ameisez

Member
Jun 18, 2009
5
0
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
 
Last edited by a moderator:

mtindor

Well-Known Member
Sep 14, 2004
1,415
78
178
inside a catfish
cPanel Access Level
Root Administrator
Run command
mysql -u theUser_theDBu -p theUser_mynewdatabase < mydumpfile.sql


What Did I missed? What I did wrong?

Thanks
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
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
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.