<?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>PHP Architect blog &#187; MySQL</title>
	<atom:link href="http://www.php-architect.com/blog/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.php-architect.com/blog</link>
	<description>me, myself, and my code</description>
	<lastBuildDate>Wed, 14 Sep 2011 12:50:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Backup or Export, Compress and upload mysql database to remote host</title>
		<link>http://www.php-architect.com/blog/2011/01/04/backup-or-export-compress-and-upload-mysql-database-to-remote-host/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=backup-or-export-compress-and-upload-mysql-database-to-remote-host</link>
		<comments>http://www.php-architect.com/blog/2011/01/04/backup-or-export-compress-and-upload-mysql-database-to-remote-host/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 04:09:52 +0000</pubDate>
		<dc:creator>aibrahim</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<guid isPermaLink="false">http://www.php-architect.com/blog/?p=11847</guid>
		<description><![CDATA[<a href="http://www.php-architect.com/blog/2011/01/04/backup-or-export-compress-and-upload-mysql-database-to-remote-host/" title="Backup or Export, Compress and upload mysql database to remote host"></a>This is a handy command that i use to backup or export, compress and upload a mysql database to my remote host, very handy when you wanna upload your development database to the remote host after some changes. /usr/mysql/bin/mysqldump --opt &#8230;<p class="read-more"><a href="http://www.php-architect.com/blog/2011/01/04/backup-or-export-compress-and-upload-mysql-database-to-remote-host/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.php-architect.com/blog/2011/01/04/backup-or-export-compress-and-upload-mysql-database-to-remote-host/" title="Backup or Export, Compress and upload mysql database to remote host"></a><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.php-architect.com/blog/2011/01/04/backup-or-export-compress-and-upload-mysql-database-to-remote-host/&amp;layout=standard&amp;show_faces=1&amp;width=450&amp;action=like&amp;colorscheme=light&amp;font=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px"></iframe><p>This is a handy command that i use to backup or export, compress and upload a mysql database to my remote host, very handy when you wanna upload your development database to the remote host after some changes.</p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mysqldump <span style="color: #660033;">--opt</span> <span style="color: #660033;">-uUsername</span> <span style="color: #660033;">-pPassword</span> Databasename  <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">gzip</span> <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-q</span> user<span style="color: #000000; font-weight: bold;">@</span>remote-host.com <span style="color: #ff0000;">'cat &gt; ~/Databasename.sql.gz'</span></pre></div></div>
<p><span style="text-decoration: underline;">Replace the following :</span></p>
<ul>
<li><strong> /usr/mysql/bin/mysqldump : </strong>The path for mysqldump on your localmachine</li>
<li><strong> Username : </strong>Username for local mysql database.</li>
<li><strong> Password : </strong>Password for local mysql database.</li>
<li><strong> Databasename : </strong>Name of the database to export.</li>
<li><strong> user@remote-host.com : </strong>the user and the IP or the address of the remote host.</li>
</ul>
<p>the above command will upload the compressed database to your home directory on the remote host, to change the directoy, replace <strong>~/ </strong>with the path you want.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.php-architect.com/blog/2011/01/04/backup-or-export-compress-and-upload-mysql-database-to-remote-host/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Build MySQL insert Query from Array that contains fields and values</title>
		<link>http://www.php-architect.com/blog/2009/02/22/build-mysql-insert-query-from-array-that-contains-fields-and-values/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=build-mysql-insert-query-from-array-that-contains-fields-and-values</link>
		<comments>http://www.php-architect.com/blog/2009/02/22/build-mysql-insert-query-from-array-that-contains-fields-and-values/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 12:30:50 +0000</pubDate>
		<dc:creator>aibrahim</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[query]]></category>
		<guid isPermaLink="false">http://www.php-architect.com/blog/?p=261</guid>
		<description><![CDATA[<a href="http://www.php-architect.com/blog/2009/02/22/build-mysql-insert-query-from-array-that-contains-fields-and-values/" title="Build MySQL insert Query from Array that contains fields and values"></a>The following function takes table name, and array where its keys are the table fields and it&#8217;s values are the values to insert in each field, it constructs the MySQL Query based on the input and executes it to insert &#8230;<p class="read-more"><a href="http://www.php-architect.com/blog/2009/02/22/build-mysql-insert-query-from-array-that-contains-fields-and-values/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.php-architect.com/blog/2009/02/22/build-mysql-insert-query-from-array-that-contains-fields-and-values/" title="Build MySQL insert Query from Array that contains fields and values"></a><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.php-architect.com/blog/2009/02/22/build-mysql-insert-query-from-array-that-contains-fields-and-values/&amp;layout=standard&amp;show_faces=1&amp;width=450&amp;action=like&amp;colorscheme=light&amp;font=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px"></iframe><p>The following function takes table name, and array where its keys are the table fields and it&#8217;s values are the values to insert in each field, it constructs the MySQL Query based on the input and executes it to insert the data.</p>
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> insertRow<span style="color: #009900;">&#40;</span><span style="color: #000088;">$table_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$input_array</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span>SERVER<span style="color: #339933;">,</span> USER<span style="color: #339933;">,</span> PASS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span>DATABASE<span style="color: #339933;">,</span> <span style="color: #000088;">$link</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$SQL</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;INSERT INTO <span style="color: #006699; font-weight: bold;">$table_name</span> &quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$fields</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;(&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$values</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;(&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$input_array</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$fields</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;`<span style="color: #006699; font-weight: bold;">$k</span>` ,&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$values</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;'<span style="color: #006699; font-weight: bold;">$v</span>' ,&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$fields</span> <span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;#&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$values</span> <span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;#&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$fields</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,#&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fields</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$fields</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$values</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,#&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$values</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$values</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$values</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$fields</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;)&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$values</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;)&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$SQL</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$fields</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; VALUES &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$values</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$SQL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">mysql_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$link</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.php-architect.com/blog/2009/02/22/build-mysql-insert-query-from-array-that-contains-fields-and-values/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fix the MySQL PHP issue in Leopard (mysql.sock file)</title>
		<link>http://www.php-architect.com/blog/2008/01/07/fix-the-mysql-php-issue-in-leopard-mysqlsock-file/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fix-the-mysql-php-issue-in-leopard-mysqlsock-file</link>
		<comments>http://www.php-architect.com/blog/2008/01/07/fix-the-mysql-php-issue-in-leopard-mysqlsock-file/#comments</comments>
		<pubDate>Mon, 07 Jan 2008 13:39:25 +0000</pubDate>
		<dc:creator>aibrahim</dc:creator>
				<category><![CDATA[Mac OS]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[arabic]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[leopard]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[php5]]></category>
		<guid isPermaLink="false">http://www.abdelaliem.com/blog/?p=20</guid>
		<description><![CDATA[<a href="http://www.php-architect.com/blog/2008/01/07/fix-the-mysql-php-issue-in-leopard-mysqlsock-file/" title="Fix the MySQL PHP issue in Leopard (mysql.sock file)"></a>This is a known issue in Leopard, basically the system is looking for the mysql.sock file in the wrong place. Just need to create a symlink and you should be in business: sudo mkdir /var/mysql/ sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock]]></description>
			<content:encoded><![CDATA[<a href="http://www.php-architect.com/blog/2008/01/07/fix-the-mysql-php-issue-in-leopard-mysqlsock-file/" title="Fix the MySQL PHP issue in Leopard (mysql.sock file)"></a><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.php-architect.com/blog/2008/01/07/fix-the-mysql-php-issue-in-leopard-mysqlsock-file/&amp;layout=standard&amp;show_faces=1&amp;width=450&amp;action=like&amp;colorscheme=light&amp;font=" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px"></iframe><p><span class="postbody">This is a known issue in Leopard, basically the system is looking for the mysql.sock file in the wrong place. Just need to create a symlink and you should be in business:</p>
<p>sudo mkdir /var/mysql/<br />
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock </span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.php-architect.com/blog/2008/01/07/fix-the-mysql-php-issue-in-leopard-mysqlsock-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

