<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SHOCM &#187; Restore</title>
	<atom:link href="http://www.shocm.com/tag/restore/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shocm.com</link>
	<description>Open Source, Cloud, Scotch, Baseball, Family, and Programming since the 1900&#039;s</description>
	<lastBuildDate>Fri, 27 Apr 2012 15:24:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Backing Up and Restoring Your MySQL Database</title>
		<link>http://www.shocm.com/2004/06/backing-up-and-restoring-your-mysql-database/</link>
		<comments>http://www.shocm.com/2004/06/backing-up-and-restoring-your-mysql-database/#comments</comments>
		<pubDate>Thu, 10 Jun 2004 21:25:53 +0000</pubDate>
		<dc:creator>Shocm</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[F/OSS]]></category>
		<category><![CDATA[Geek Stuff]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[QuickTip]]></category>
		<category><![CDATA[Restore]]></category>

		<guid isPermaLink="false">http://www.vanjohnson.com/?p=11</guid>
		<description><![CDATA[<p>Do you need to change your web host or switch your database server? This is probably the only time when you really think of backing up your MySQL data. If you&#8217;ve got a website with a database or your custom database running for your applications, it is imperative that you make regular backups of the [...]]]></description>
			<content:encoded><![CDATA[<p>Do you need to change your web host or switch your database server? This is probably the only time when you really think of backing up your MySQL data. If you&#8217;ve got a website with a database or your custom database running for your applications, it is imperative that you make regular backups of the database. In this article, I will outline two easy ways of backing up and restoring databases in MySQL.<br />
The easiest way to backup your database would be to telnet to the your database server machine and use the mysqldump command to dump your whole database to a backup file. If you do not have telnet or shell access to your server, don&#8217;t worry about it; I shall outline a method of doing so using the PHPMyAdmin web interface, which you can setup on any web server which executes PHP scripts.</p>
<p><strong><br />
Playing with mysqldump</strong></p>
<p>If you have either a shell or telnet access to your database server, you can backup the database using mysqldump. By default, the output of the command will dump the contents of the database in SQL statements to your console. This output can then be piped or redirected to any location you want. If you plan to backup your database, you can pipe the output to a sql file, which will contain the SQL statements to recreate and populate the database tables when you wish to restore your database. There are more adventurous ways to use the output of mysqldump.</p>
<p>A Simple Database Backup:</p>
<p>You can use mysqldump to create a simple backup of your database using the following syntax.</p>
<p>mysqldump -u [username] -p [password] [databasename]> [backupfile.sql]</p>
<p>[username] &#8211; this is your database username<br />
[password] &#8211; this is the password for your database<br />
[databasename] &#8211; the name of your database<br />
[backupfile.sql] &#8211; the file to which the backup should be written.</p>
<p>The resultant dump file will contain all the SQL statements needed to create the table and populate the table in a new database server. To backup your database &#8216;Customers&#8217; with the username &#8216;sadmin&#8217; and password &#8216;pass21&#8242; to a file custback.sql, you would issue the command:</p>
<p>mysqldump -u sadmin -p pass21 Customers> custback.sql</p>
<p><span id="more-11"></span><br />
You can also ask mysqldump to add a drop table command before every create command by using the option &#8211;add-drop-table. This option is useful if you would like to create a backup file which can rewrite an existing database without having to delete the older database manually first.</p>
<p>mysqldump &#8211;add-drop-table -u sadmin -p pass21 Customers> custback.sql</p>
<p>Backing up only specified tables</p>
<p>If you&#8217;d like restrict the backup to only certain tables of your database, you can also specify the tables you want to backup. Let&#8217;s say that you want to backup only customer_master &#038; customer_details from the Customers database, you do that by issuing</p>
<p>mysqldump &#8211;add-drop-table -u sadmin -p pass21 Customers customer_master customer_details> custback.sql</p>
<p>So the syntax for the command to issue is:</p>
<p>mysqldump -u [username] -p [password] [databasename] [table1 table2 ....]</p>
<p>[tables] &#8211; This is a list of tables to backup. Each table is separated by a space.</p>
<p>If you are a database administrator who has to look after multiple databases, you&#8217;ll need to back up more than one database at a time. Here&#8217;s how you can backup multiple databases in one shot.</p>
<p>If you want to specify the databases to backup, you can use the &#8211;databases parameter followed by the list of databases you would like to backup. Each database name has to be separated by at least one space when you type in the command. So if you have to backup 3 databases, let say Customers, Orders and Comments, you can issue the following command to back them up. Make sure the username you specify has permissions to access the databases you would like to backup.</p>
<p>mysqldump -u root -p pass21 &#8211;databases Customers Orders Comments> multibackup.sql</p>
<p>This is okay if you have a small set of databases you want to backup. Now how about backing up all the databases in the server? That&#8217;s an easy one, just use the &#8211;all-databases parameter to backup all the databases in the server in one step.</p>
<p>mysqldump &#8211;all-databases> alldatabases.sql</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shocm.com/2004/06/backing-up-and-restoring-your-mysql-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup files with tar</title>
		<link>http://www.shocm.com/2003/10/backup-files-with-tar/</link>
		<comments>http://www.shocm.com/2003/10/backup-files-with-tar/#comments</comments>
		<pubDate>Fri, 10 Oct 2003 21:30:57 +0000</pubDate>
		<dc:creator>Shocm</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[Restore]]></category>

		<guid isPermaLink="false">http://www.vanjohnson.com/?p=12</guid>
		<description><![CDATA[<p>[NOTE]<br /> I don&#8217;t remember where I got this article from but it is full of some good information<br /> [/NOTE]</p> <p>TAR is the Unix Tape ARchive utility. It can be used to either store data on a streaming tape device like a DAT drive, or store files in what is commonly called a tarball [...]]]></description>
			<content:encoded><![CDATA[<p>[NOTE]<br />
I don&#8217;t remember where I got this article from but it is full of some good information<br />
[/NOTE]</p>
<p>TAR is the Unix Tape ARchive utility. It can be used to either store data on a streaming tape device like a DAT drive, or store files in what is commonly called a tarball file- somewhat like a pkzip file, only compression is optional.</p>
<p><strong>[The basics]</strong></p>
<p>In these examples, I will use the following file structure: a top level directory called DIR1 containing the files picture.jpg, document.doc and database.db.</p>
<p>DIR1/<br />
DIR1/picture.jpg<br />
DIR1/document.doc<br />
DIR1/database.db</p>
<p><strong>[Creating a tarball]</strong></p>
<p>If we were in the directory DIR1 and wanted to backup all the files to a tarball called backup.tar, we could issue this command:</p>
<p>$ tar cvf backup.tar .<br />
./<br />
picture.jpg<br />
doucment.doc<br />
database.db<br />
tar: backup.tar is the archive; not dumped</p>
<p>Note:<br />
c=create (an archive)<br />
v=verbose (just because)<br />
f=filename (the name of our tarball)<br />
.=current directory (what&#8217;s going to be backed up)</p>
<p>Also worth mentioning is that by default tar is recursive- meaning it will back up all files and subdirectories recursively unless you otherwise specify with the n flag (non-recursive)</p>
<p><strong>[Displaying the Contents of a Tarball]</strong></p>
<p>The current directory will now contain a file called backup.tar. To display the contents of the tarball file, we could issue this command:</p>
<p>$ tar tvf backup.tar<br />
drwxr-xr-x root/gci 0 Jun 29 10:10 ./<br />
-rw-r&#8211;r&#8211; root/gci 1 Jun 29 10:10 picture.jpg<br />
-rw-r&#8211;r&#8211; root/gci 1 Jun 29 10:10 document.doc<br />
-rw-r&#8211;r&#8211; root/gci 1 Jun 29 10:10 databse.db<br />
<span id="more-12"></span></p>
<p>Note:<br />
t=table of contents (list)<br />
v=verbose (display all info)<br />
f=filename (backup.tar)</p>
<p>[Extracting Data from a Tarball]<br />
To extract the entire contents of the tarball to the current directory, we can type:<br />
$ tar xvf backup.tar<br />
./<br />
picture.jpg<br />
doucment.doc<br />
database.db</p>
<p>Note:<br />
x=extract<br />
v=verbose<br />
f=filename (backup.tar)</p>
<p>To extract only the picture.jpg file from the archive, type the following command:</p>
<p>$ tar xvf backup.tar picture.jpg</p>
<p>Alternatively, you can use wild cards in either the creation or extraction of a tarball. To extract all jpg files from our archive, we can use a command like this:</p>
<p>$ tar xvf backup.tar *.jpg<br />
<strong><br />
[Using Compression]</strong></p>
<p>If you would also like to add compression to your tarballs, you can combine the gzip utility with tar on the command line by adding the z switch to the command. Usually when this is done, we change the suffix of our tarball filename from .tar to either .tgz or .tar.gz. This will let whoever sees the file know that it is a gzipped tarball.</p>
<p>$ tar zcvf tarball.tgz .</p>
<p>Note:<br />
z=gzip compression<br />
c=create<br />
v=verbose<br />
f=filename (backup.tgz)<br />
.=current directory (what to backup)</p>
<p><strong>[Permissions with tar]</strong></p>
<p>If you would like to preserve the permissions of the files you backup, use the p option with the tar command. This will save the uid, gid as well as the specific permission attributes of the files (read, write, execute etc.)</p>
<p>$ tar pzcvf tarball.tgz .</p>
<p>You should also use the p option with the tar extraction command:</p>
<p>$ tar pxvf tarball.tgz .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shocm.com/2003/10/backup-files-with-tar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

