We've moved!

This site is no longer being maintained. We will leave all the posts and information as it is but we've made a new home over at http://beacon9.ca.

Restoring MySQL database from SSH

SSH MySQL

Wow! I have had a RIDICULOUS last two days...

I can't go into much detail but, we had a serious issue with a couple of MySQL databases... which meant that we had to restore from backups!

It's been quite stressful for me because there is a lot at stake. I wasn't involved in the design or build of these scripts so I've literally been thrown in the deep end this time and had to learn a LOT very quickly.

Side Note to Coders: Comment your code and write documentation! A little documentation would have gone a really long way this week.

Having said all that.. after two days of stress things are back to normal.

Before I get on with my life and forget what I did I wanted to document some useful SSH commands that have saved my butt recently.

TAR and Un-TAR
TAR is brilliant... tar.gz is even more brilliant (basically putting lots of files into one and compressing them).

To TGZ a directory: tar -czPf [file-name.tgz] [full-path-to folder]

To UnTAR a directory: tar xvfz [directory name]

MySql
To Restore DB from a backupmysql -u[username] -p [db name] < [full path to backup.sql]

NOTE: I dropped the tables in the DB first.

Hope this helps someone!