• Home
  • About
  • Archives
  • Colophon
  • Resume
  • Tags
  • Tumblr

zanshin.net

because not enough websites start with the letter “Z”

Feed on
Posts
Comments
Tumblr
« Mute Embarrassment
Facebook About Face »

Tar and mysqldump Are Your Friends

Dec 5th, 2007 by mark

The first step in my site migration project is to backup all my data, all my content, everything. Since my hosting platform is Linux based, this was surprisingly easy.

First I issued this command:

$ tar cvf archive.tar *

at the root of my account, /usr/www/users/mnichols, to create an archive off everything I have stored under my account at Pair.

Next I compressed this archive using gzip. Like so:

$ gzip archive.tar

The resulting file, archive.tar.gzip, was then copied to my local computer.

Some parts of this site, and parts of the other sites I have hosted over the years at Pair, have made use of MySQL databases; I’ve used various referrer and site monitoring tools that all required relational databases for support. Before leaving Pair I want to back up the contents and structure of these data stores.

Using MySQL on my laptop I can issue a command in this format:

$ mysqldump --add-drop-table -h <hostname> -u <username> -p <databasename> | bzip2 -c database_yyyymmdd.bak.sql.bz2

to not only dump the database, but to compress it as well. The resulting file will be stored in the directory on my local machine where I ran the command.

Once all 10 MySQL databases were dumped and compressed using this command I had a complete back up of my site: the presentation (HTML/CSS) files in the public_html directory and the underlying databases that feed the various sites their content.

Posted in nerdliness

Comments are closed.

  • Welcome!

    Mark H. Nichols is an enterprise architect, martial artist, nerd, and all around good guy. Currently he works in Kansas City, and lives in the suburbs with his fiancée, three cats, a couple pianos, and nearly a dozen computers. You can read more about Mark, and this site, or explore the archives.
  • Pages

    • About
    • Archives
    • Colophon
    • Resume
    • Tags
    • Tumblr
  • Popular

    • Shotski's Ring (part I)
    • Shotski's Ring (part II)
    • 10 Mac Apps
    • What is Zanshin?
  • Categories

    • diversions
    • elsewhere
    • family
    • health
    • life
    • links
    • meme
    • nerdliness
    • photography
    • random
    • relationships
    • social issues
    • Uncategorized
  • Archives

  • Vote

    Obama 08
    • Blogroll

      • Elfenbein Klaviermusik Notes
      • Shawn Blanc
      • Sibylle Kuder
  • del.icio.us

  • last.fm

    1. ELV1S 30 #1 Hits
    2. The Lamb Lies Down On Broadway
    3. Brave
    4. Chronicles
    5. Let It Be... Naked
    6. The Best of Kansas
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org

zanshin.net © 1996 - 2008 All Rights Reserved.

Policies | WordPress Themes | Web Hosting Blue Host