Installing a mysql DB via SSH

Status
Not open for further replies.

Cormac

New Member
Hi guys,
I have a SSH session open on my VPS. I have cd'd into the httpdocs folder in which I have placed a file called db.sql. I have created a DB via my control panel with the necessary username and password.

I'm running this command:
mysql -u DBusername -p DBpassword DBname < db.sql

But I'm getting an error stating "command not found". What am I doing wrong?
 

mneylon

Administrator
Staff member
Is the command "mysql" in your path?
ie. if you start typing mysql and hit the tab key, does it autocomplete?
 

Cormac

New Member
No, the command mysql isn't in the path.
After looking into SSH further it seems that I have to be in the mysql directory in order to run the command (makes sense now of course!) but I can't actually find the mysql directory.

if you start typing mysql and hit the tab key, does it autocomplete?
No.
 

shortword

Administrator
Thats the problem then, mysql isn't included in the chrooted environment.

If you pop on as root it'll work just fine.

Paul
 

Cormac

New Member
When you say root do you mean the root account of the server or a root account relating to the specific domain? I have logged in as the root of the server but then I am clueless as to do next. I'm not sure how I navigate to the msql directory from there.
 

shortword

Administrator
You don't need to navigate anywhere :)

Simply run the command from your first post and it should be fine.

Paul
 

Cormac

New Member
Mmm, when I login and run the command mysql -u DBuser -p DBpass DBname < blog.sql

I get the error -bash: blog.sql: No such file or directory

That's why I thought I might need to be in the httpdocs root or a similar dir to run the command successfully.

(thanks for the help btw)
 

shortword

Administrator
Well, I was going to mention that :)

You can give the full path to the file if you like. I _think_ the vhosts are in /var/www/vhosts/ but I can't recall.

Paul
 
Status
Not open for further replies.
Top