<?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>Blog by Andreas Glaser &#187; SQL</title>
	<atom:link href="http://www.andreas-glaser.com/category/development/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.andreas-glaser.com</link>
	<description>Development, Technology and such...</description>
	<lastBuildDate>Wed, 18 May 2011 23:16:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Import Mysql Dump with correct character encoding</title>
		<link>http://www.andreas-glaser.com/2010/08/09/import-mysql-dump-with-correct-character-encoding/</link>
		<comments>http://www.andreas-glaser.com/2010/08/09/import-mysql-dump-with-correct-character-encoding/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 11:58:05 +0000</pubDate>
		<dc:creator>Andreas Glaser</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Commandline]]></category>
		<category><![CDATA[Mysql]]></category>

		<guid isPermaLink="false">http://www.andreas-glaser.com/?p=593</guid>
		<description><![CDATA[It happened to me quite a few times now, that I imported a mysql dump file and afterwards noticed that the character encoding was broken. To help you guys preventing this from happening use following import command. ?View Code BASH1 mysql -u root -p --default_character_set utf8 NAME_OF_YOUR_DATABASE &#38;lt; mysql_dump_file.sql The important argument is &#8220;&#8211;default_character_set utf8&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>It happened to me quite a few times now, that I imported a mysql dump file and afterwards noticed that the character encoding was broken.<br />
To help you guys preventing this from happening use following import command.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p593code2'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5932"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p593code2"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-u</span> root <span style="color: #660033;">-p</span> --default_character_set utf8 NAME_OF_YOUR_DATABASE <span style="color: #000000; font-weight: bold;">&amp;</span>lt; mysql_dump_file.sql</pre></td></tr></table></div>

<p>The important argument is &#8220;<strong>&#8211;default_character_set utf8</strong>&#8221; to preserve the encoding.</p>
<p>Enjoy</p>
<fb:like href='http://www.andreas-glaser.com/2010/08/09/import-mysql-dump-with-correct-character-encoding/' send='' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like>]]></content:encoded>
			<wfw:commentRss>http://www.andreas-glaser.com/2010/08/09/import-mysql-dump-with-correct-character-encoding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(Python) Mysqldump Backup 1.1</title>
		<link>http://www.andreas-glaser.com/2010/04/12/python-mysqldump-backup-1-1/</link>
		<comments>http://www.andreas-glaser.com/2010/04/12/python-mysqldump-backup-1-1/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 08:00:02 +0000</pubDate>
		<dc:creator>Andreas Glaser</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Operating system]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.andreas-glaser.com/?p=326</guid>
		<description><![CDATA[Backups are crucial! Since that is fact I wrote a little script in Python to easily backup mysql databases on a linux server. How do i configure it? After you downloaded the script to your Linux server you will need a few Linux packages. Execute the following commands as root: apt-get update apt-get install python [...]]]></description>
			<content:encoded><![CDATA[<p>Backups are crucial!<br />
Since that is fact I wrote a little script in Python to easily backup mysql databases on a linux server.</p>
Note: There is a file embedded within this post, please visit this post to download the file.
<p><strong><br />
How do i configure it?<br />
</strong>After you downloaded the script to your Linux server you will need a few Linux packages. Execute the following commands as root:</p>
<blockquote><p><em>apt-get update<br />
apt-get install python mysqldump bzip2</em></p></blockquote>
<p><strong>What does it do?</strong><br />
This script dumps a certain database (or all databases) into a single mysql file, which is zipped (bzip2) afterwards.</p>
<p>Now edit the script with your preferred editor.</p>
<blockquote><p><em>vim mysqldump-backup.py</em></p></blockquote>
<p><strong>Customize the following lines:</strong></p>
<blockquote><p># 2. Config<br />
mysqlUser = &#8220;root&#8221;<br />
mysqlPwd = &#8220;YOUR_PASSWORD&#8221;<br />
mysqlDatabase = &#8220;&#8211;all-databases&#8221;<br />
dumpDir = &#8220;/tmp/&#8221;<br />
dumpFile = &#8220;mysqldump-&#8221; + strftime(&#8220;%Y-%m-%d-%H-%M-%S&#8221;, gmtime()) + &#8220;.sql&#8221;</p></blockquote>
<p>The last step is to make the script executable:</p>
<blockquote><p><em>chmod u +x mysqldump-backup-1.1.py</em></p></blockquote>
<p>Thats it!</p>
<p>You can now run the script:</p>
<blockquote><p><em>/path/to/the/script/mysqldump-backup-1.1.py</em></p></blockquote>
<p><strong>To run it daily (crontab):</strong></p>
<blockquote><p><em>crontab -e</em></p></blockquote>
<p>Add at the bottom:</p>
<blockquote><p>0 3 * * * <em>/path/to/the/script/mysqldump-backup.py</em></p></blockquote>
<p>Now your databases will be backupped daily at 03:00 am</p>
<p><strong>Download</strong></p>
Note: There is a file embedded within this post, please visit this post to download the file.
<p><strong>Changelog</strong><br />
1.1</p>
<ul>
<li>Removed trailing semicolons</li>
<li>Renamed variables</li>
</ul>
<p>1.0 </p>
<ul>
<li>Initial release</li>
</ul>
<p>Have fun!<br />
Andreas Glaser aka JaZz</p>
<fb:like href='http://www.andreas-glaser.com/2010/04/12/python-mysqldump-backup-1-1/' send='' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like>]]></content:encoded>
			<wfw:commentRss>http://www.andreas-glaser.com/2010/04/12/python-mysqldump-backup-1-1/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>SQL / Mysql &#8211; How to find and count duplicates</title>
		<link>http://www.andreas-glaser.com/2008/10/22/sql-mysql-how-to-find-and-count-duplicates/</link>
		<comments>http://www.andreas-glaser.com/2008/10/22/sql-mysql-how-to-find-and-count-duplicates/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 09:18:37 +0000</pubDate>
		<dc:creator>Andreas Glaser</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Duplicates]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[Sourcecode]]></category>

		<guid isPermaLink="false">http://www.andreas-glaser.com/?p=246</guid>
		<description><![CDATA[Some developers facing the problem of duplicates in sql/mysql tables. To find and count them use the following statement. ?View Code SQL1 2 3 4 SELECT ID, count&#40;*&#41; as Amount FROM name_of_the_table GROUP BY ID HAVING  Amount &#38;gt; 1 Just replace the used table &#8220;name_of_the_table&#8221; and the column &#8220;ID&#8221; which is inspected for duplicates. The [...]]]></description>
			<content:encoded><![CDATA[<p>Some developers facing the problem of duplicates in sql/mysql tables. To find and count them use the following statement.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p246code4'); return false;">View Code</a> SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2464"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p246code4"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> ID<span style="color: #66cc66;">,</span> count<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">*</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">as</span> Amount
<span style="color: #993333; font-weight: bold;">FROM</span> name_of_the_table
<span style="color: #993333; font-weight: bold;">GROUP</span> <span style="color: #993333; font-weight: bold;">BY</span> ID
<span style="color: #993333; font-weight: bold;">HAVING</span>  Amount &amp;gt; <span style="color: #cc66cc;">1</span></pre></td></tr></table></div>

<p>Just replace the used table <strong>&#8220;name_of_the_table&#8221;</strong> and the column <strong>&#8220;ID&#8221;</strong> which is inspected for duplicates. The output shows you the record which is multiple times in the table and the amount of it.</p>
<p><em><strong>So long,<br />
Andreas Glaser (aka JaZz)</strong></em></p>
<fb:like href='http://www.andreas-glaser.com/2008/10/22/sql-mysql-how-to-find-and-count-duplicates/' send='' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like>]]></content:encoded>
			<wfw:commentRss>http://www.andreas-glaser.com/2008/10/22/sql-mysql-how-to-find-and-count-duplicates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

