MyBB Community Forums

Full Version: Restore DB through SSH
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Alright, well I decided to start using a VPS rather than shared hosting which I've always done... It's time to start learning server management and everything the correct way.

Anyways, I've managed to get MyBB installed but now I need to restore my old database and I don't have phpMyAdmin on my VPS so I'd like to know if anyone can point me in the right direction of just doing it through SSH. I've read a couple of tutorials but they're a little bit confusing.
What OS?

Usually you can use.
mysql -u username -p -h localhost DATA-BASE-NAME < db_backup.sql 

Edit: In CentOS
@LucasC: that should work for any mysql install I believe Smile
It's Ubuntu 12.04, I'm going to try that now.

DATA-BASE-Name is the current database on the new forum and db_backup.sql is the database backup I have on my computer, correct?
You'll have to upload the .sql backup file to the VPS first and that is what db_backup.sql is.
(2014-01-01, 06:46 PM)Euan T Wrote: [ -> ]You'll have to upload the .sql backup file to the VPS first and that is what db_backup.sql is.

Is there anywhere specific I'll need to upload that backup to, or will any folder be fine? I'll just need to use the correct path to it when using what Lucas posted, correct?
Any folder is okay. You only have to let it read out once, after its done you can remove the file again.

Personally, to keep things sorted, I'd put it in tmp folder.

So if you put it in tmp the command would be:

mysql -u username -p -h localhost DATA-BASE-NAME < tmp/db_backup.sql
Yeah, I ended up putting it in a temporary folder, then remove it after.

Thanks for the help guys. My theme got all screwed up during the restore but that's okay, it gives me an excuse to work on a better one. As far as statistics go, all posts and what not are a okay. I appreciate the help. Smile