Moving a database from one server to another

I hope I'm posting this in the correct section.

I'm trying to move a database from one server to another. This is the code I'm using...

tar czf - vbdatabase.sql | ssh username@full.domain.com 'cat > /home/cpanelusername/vbdatabase.tar.gz

... but all I'm getting is a ">" and then nothing happens.

Thoughts? Suggestions?

(today is my first day working with ssh so, um, yeah)

Chimpie

Hi.

You're getting the > because you have an opening single quote ', which is never closed.

In any case, I don't think you can pipe tar to ssh in this manner.

Best is to tar and compress the stuff, then scp it.

tar cf - dir_of_my_files | gzip -c > dir_of_my_files.tar.gz
scp dir_of_my_files.tar.gz user@host:/some_dir

As to whether your database actually works on the other server depends on more factors (software being one of them)

HTH

1 Like

thanks for noticing the '

It's sending the information now. I'll let you know and the rest of the readers know what happens.

Since I'm learning, what is scp?

It's secure copy and uses the same protocols as ssh (secure shell). If one works, the other will.

I deleted my earlier post at first, because I wasn't sure that using ssh in that way would work, but undeleted it at least for the ' hint!

I use ssh a hundred times a day, but never to copy files, so if it works, let me know :slight_smile:

It works, but ran into a problem that's not your fault. Too long for an un-needed explanation.

Thanks again. You'll see me a few more times as I attempt to teach myself ssh/shell.

Chimpie