Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Database import problem
PostPosted: Sat May 18, 2013 8:48 am 
Offline
Senior Newbie

Joined: Fri Dec 16, 2011 8:05 am
Posts: 5
When I issue the following command:

mysql -u user -ppassword database_name < /path_to_database.sql

I get:

sh: database_name: not found
->

and it stops processing. I have created database_name and it exists.

Can somebody help? I'm running on ubuntu 10.04


Top
   
PostPosted: Sat May 18, 2013 10:48 am 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
vishalrao,
Does the user you're using have privileges for the database you're trying to access?


MSJ


Top
   
PostPosted: Sat May 18, 2013 12:16 pm 
Offline
Senior Newbie

Joined: Fri Dec 16, 2011 8:05 am
Posts: 5
Yes the user has sufficient privileges.


Top
   
PostPosted: Sun May 19, 2013 5:01 pm 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
vishalrao wrote:
sh: database_name: not found


This is odd. It indicates that the shell is treating database_name as a command it's trying to run. Does your password end with a semicolon? If so (and if the password is unquoted), the shell is interpreting your command line as two separate commands:
Code:
mysql -u user -ppassword
database_name < /path_to_database.sql


I'd suggest running mysql -u user -p database_name < /path_to_database.sql and then typing in your password when prompted. This is generally safer anyway as other users on the machine can see the arguments you used on the command line, thus exposing your password to them.


Top
   
PostPosted: Sun May 19, 2013 11:33 pm 
Offline
Senior Newbie

Joined: Fri Dec 16, 2011 8:05 am
Posts: 5
Thanks Vance. You are right. I'm new to this. I was running the above command at the "mysql" prompt and hence it was giving problems. I ran the command at "shell" prompt and it worked fine.

Thanks a lot!


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group