<?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>Developer Code book &#187; MySql</title> <atom:link href="http://wordpressapi.com/category/mysql/feed/" rel="self" type="application/rss+xml" /><link>http://wordpressapi.com</link> <description>Wordpressapi.com is focused on Wordpress API, wordpress news, wordpress themes, wordpress plugins, wordpress tips, wordpress tutorials, wordpress design wordpress templates, wordpress breaking news and web-development. We deliver useful information about wordpress,  wordpress latest trends and wordpress techniques, wordpress useful ideas, wordpress innovative approaches and wordpress tools. Social Media news blog covering cool new websites and social networks: Facebook, Google, Twitter, MySpace and YouTube.  The latest web technology news, via RSS daily.</description> <lastBuildDate>Thu, 09 Sep 2010 10:36:02 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0.1</generator> <item><title>How to use mongodb with php</title><link>http://wordpressapi.com/2010/09/09/mongodb-php/</link> <comments>http://wordpressapi.com/2010/09/09/mongodb-php/#comments</comments> <pubDate>Thu, 09 Sep 2010 10:36:02 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[MySql]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Server]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[mongo]]></category><guid
isPermaLink="false">http://wordpressapi.com/?p=5265</guid> <description><![CDATA[If you want to use the mongodb with php then you need to install pecl libraries. Mongo extension is not bundled with PHP. For installing the Mongo use following URL: If you dont have pecl installed on your linux machine then use following command. # yum install php-pecl* then use following command # pecl install.....]]></description> <content:encoded><![CDATA[<div
id="_mcePaste"><img
class="alignnone size-full wp-image-5266" title="mongodb-and-php" src="http://wordpressapi.com/files/mongodb-and-php.jpg" alt="" width="493" height="227" /></div><div>If you want to use the mongodb with php then you need to install pecl libraries. Mongo extension is not bundled with PHP.</div><div
id="_mcePaste">For installing the Mongo use following URL:</div><div
id="_mcePaste">If you dont have pecl installed on your linux machine then use following command.</div><div
id="_mcePaste"># yum install php-pecl*</div><div
id="_mcePaste">then use following command</div><div
id="_mcePaste"># pecl install mongo</div><div
id="_mcePaste">Then open the php.ini file. if you are using the linux then use following command.</div><div
id="_mcePaste"># vim /etc/php.ini</div><div
id="_mcePaste"><pre class="brush: plain;">&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;## Add following lines, end of php.ini file ##&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;# MongoDB Driver&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;extension=mongo.so&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;</pre></div><div
id="_mcePaste">Restart the apache webserver using following command</div><div
id="_mcePaste"># /etc/init.d/httpd restart</div><div
id="_mcePaste">If Mongodb server is running then use can test your mongodb database using following code:</div><div
id="_mcePaste">Create the mongotest.php file</div><div
id="_mcePaste"><pre class="brush: plain;">&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;&lt;?php&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;// connect&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;$m = new Mongo();&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;// select a database&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;$db = $m-&gt;wordpress;&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;$collection = $db-&gt;wordpressapi;&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;// add an element&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;$obj = array( &quot;title&quot; =&gt; &quot;Sony this Good.\n&quot;, &quot;author&quot; =&gt; &quot;Wordpressapi.com&quot; );&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;$collection-&gt;insert($obj);&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;// add another element, with a different &quot;shape&quot;&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;$obj = array( &quot;title&quot; =&gt; &quot;Wordpressapi.com&quot;, &quot;online&quot; =&gt; true );&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;$collection-&gt;insert($obj);&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;// find everything in the collection&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;$cursor = $collection-&gt;find();&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;// iterate through the results&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;foreach ($cursor as $obj) {&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;echo $obj[&quot;title&quot;] . &quot;\n&quot;;&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;echo $obj[&quot;author&quot;] . &quot;\n&quot;;&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;}&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;// disconnect&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;$m-&gt;close();&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;?&gt;&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;[/php]&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;If you open this file in browser then you can see the following words in browser:&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;Sony this Good. WordPressapi.com Sony this Good. WordPressapi.com&lt;/div&gt;
If you want to use the mongodb with php then you need to install pecl libraries. Mongo extension is not bundled with PHP.
For installing the Mongo use following URL:
If you dont have pecl installed on your linux machine then use following command.# yum install php-pecl*
then use following command# pecl install mongo
Then open the php.ini file. if you are using the linux then use following command.
# vim /etc/php.ini
[code]## Add following lines, end of php.ini file ### MongoDB Driverextension=mongo.so</pre><p>Restart the apache webserver using following command<br
/> # /etc/init.d/httpd restart<br
/> If Mongodb server is running then use can test your mongodb database using following code:<br
/> Create the mongotest.php file[/code]&lt;?php<br
/> // connect$m = new Mongo();<br
/> // select a database$db = $m-&gt;wordpress;$collection = $db-&gt;wordpressapi;<br
/> // add an element$obj = array( &#8220;title&#8221; =&gt; &#8220;Sony this Good.\n&#8221;, &#8220;author&#8221; =&gt; &#8220;WordPressapi.com&#8221; );$collection-&gt;insert($obj);<br
/> // add another element, with a different &#8220;shape&#8221;$obj = array( &#8220;title&#8221; =&gt; &#8220;WordPressapi.com&#8221;, &#8220;online&#8221; =&gt; true );$collection-&gt;insert($obj);<br
/> // find everything in the collection$cursor = $collection-&gt;find();<br
/> // iterate through the resultsforeach ($cursor as $obj) {    echo $obj["title"] . &#8220;\n&#8221;;     echo $obj["author"] . &#8220;\n&#8221;;}<br
/> // disconnect$m-&gt;close();<br
/> ?&gt;<br
/> [/php]<br
/> If you open this file in browser then you can see the following words in browser:Sony this Good. WordPressapi.com Sony this Good. WordPressapi.com</p> ]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2010/09/09/mongodb-php/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to install Mongodb on linux</title><link>http://wordpressapi.com/2010/09/09/how-to-install-mongodb-on-linux/</link> <comments>http://wordpressapi.com/2010/09/09/how-to-install-mongodb-on-linux/#comments</comments> <pubDate>Thu, 09 Sep 2010 10:25:43 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[MySql]]></category> <category><![CDATA[news]]></category> <category><![CDATA[tutorials]]></category> <category><![CDATA[mongo]]></category> <category><![CDATA[mongodb]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Server]]></category><guid
isPermaLink="false">http://wordpressapi.com/?p=5261</guid> <description><![CDATA[Before installing the Mongodb on linux box you need to install following packages on box. [root@sonyk-pc Download]# sudo yum -y install git tcsh scons gcc-c++ glibc-devel [root@sonyk-pc Download]# sudo yum -y install boost-devel pcre-devel js-devel readline-devel [root@sonyk-pc Download]# sudo yum -y install boost-devel-static readline-static ncurses-static For 32bit user use following command [root@sonyk-pc Download]# wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.6.2.tgz.....]]></description> <content:encoded><![CDATA[<div
id="_mcePaste"><img
class="alignnone size-full wp-image-5262" title="Mongodb-database" src="http://wordpressapi.com/files/Mongodb-database.jpg" alt="" width="500" height="333" /></div><div></div><div>Before installing the Mongodb on linux box you need to install following packages on box.</div><div
id="_mcePaste">[root@sonyk-pc Download]# sudo yum -y install git tcsh scons gcc-c++ glibc-devel</div><div
id="_mcePaste">[root@sonyk-pc Download]# sudo yum -y install boost-devel pcre-devel js-devel readline-devel</div><div
id="_mcePaste">[root@sonyk-pc Download]# sudo yum -y install boost-devel-static readline-static ncurses-static</div><div
id="_mcePaste">For 32bit user use following command</div><div
id="_mcePaste">[root@sonyk-pc Download]# wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.6.2.tgz</div><div
id="_mcePaste">For 64bit use following command</div><div
id="_mcePaste">[root@sonyk-pc Download]# wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-1.6.2.tgz</div><div
id="_mcePaste">[root@sonyk-pc Download]# tar xzf mongodb-linux-i686-1.6.2.tgz</div><div
id="_mcePaste">[root@sonyk-pc Download]#  cd mongodb-linux-i686-1.6.2</div><div
id="_mcePaste">Mongo stores database in data/db folder. so we need to create those folder using following command.</div><div
id="_mcePaste">[root@sonyk-pc mongodb-linux-i686-1.6.2]# sudo mkdir -p /data/db/</div><div
id="_mcePaste">[root@sonyk-pc mongodb-linux-i686-1.6.2]# sudo chown `id -u` /data/db</div><div
id="_mcePaste">Using following command you can start the mongo database.</div><div
id="_mcePaste">[root@sonyk-pc mongodb-linux-i686-1.6.2]# ./bin/mongod</div><div
id="_mcePaste">./bin/mongod &#8211;help for help and startup options</div><div
id="_mcePaste">Thu Sep  9 13:10:55 MongoDB starting : pid=22159 port=27017 dbpath=/data/db/ 32-bit</div><div
id="_mcePaste">** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data</div><div
id="_mcePaste">**       see http://blog.mongodb.org/post/137788967/32-bit-limitations</div><div
id="_mcePaste">Thu Sep  9 13:10:55 db version v1.6.2, pdfile version 4.5</div><div
id="_mcePaste">If you want to create mongodb service in linux then use following steps:</div><div
id="_mcePaste">[root@sonyk-pc Download]# wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.6.2.tgz</div><div
id="_mcePaste">[root@sonyk-pc Download]# tar xzf http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.6.2.tgz</div><div
id="_mcePaste">[root@sonyk-pc Download]# mv mongodb-linux-i686-1.6.2 /opt/mongodb</div><div
id="_mcePaste">[root@sonyk-pc Download]# mkdir -p /srv/db/mongodb</div><div
id="_mcePaste">[root@sonyk-pc Download]# touch /srv/db/mongodb.log</div><div
id="_mcePaste">[root@sonyk-pc Download]# mkdir /opt/bin/</div><div
id="_mcePaste">[root@sonyk-pc Download]# mkdir /opt/config/</div><div
id="_mcePaste">create the File: /opt/bin/mongodb-stop</div><div
id="_mcePaste">Put following code in that file;</div><div
id="_mcePaste"><pre class="brush: plain;">&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;#!/bin/bash&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;pid=`ps -o pid,command ax | grep mongod | awk '!/awk/ &amp;&amp; !/grep/ {print $1}'`;&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;if [ &quot;${pid}&quot; != &quot;&quot; ]; then&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;kill -2 ${pid};&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;fi&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;</pre></div><div
id="_mcePaste">create the File: /opt/bin/mongodb-start</div><div
id="_mcePaste">Put following code in that file:</div><div
id="_mcePaste"><pre class="brush: plain;">&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;#!/bin/sh&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;/opt/mongodb/bin/mongod --config /opt/config/mongodb \&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;## --upgrade \ ##runs a database upgrade option if needed \&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;</pre></div><div
id="_mcePaste">File: /opt/config/mongodb</div><div
id="_mcePaste">Put following code in that file:</div><div
id="_mcePaste"><pre class="brush: plain;">&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;# Configuration Options for MongoDB&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;#&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;# For More Information, Consider:&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;# - Configuration Parameters: http://www.mongodb.org/display/DOCS/Command+Line+Parameters&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;# - File Based Configuration: http://www.mongodb.org/display/DOCS/File+Based+Configuration&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;dbpath = /srv/db/mongodb&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;logpath = /srv/db/mongodb.log&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;logappend = true&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;bind_ip = 127.0.0.1&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;port = 27017&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;fork = true&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;auth = true&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;# noauth = true&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;</pre></div><div
id="_mcePaste">Do that file as linux executatble</div><div
id="_mcePaste">chmod +x /opt/bin/mongodb-start</div><div
id="_mcePaste">chmod +x /opt/bin/mongodb-stop</div><div
id="_mcePaste">We&#8217;ve also created a very basic &#8220;init script&#8221; as a wrapper around the mongodb-start and mongo-stop scripts described above. You will still need to modify and manage the configuration of your MongoDB server in the files above. This script only provides a means for ensuring that MongoDB will start at boot. Issue the following commands:</div><div
id="_mcePaste">wget http://library.linode.com/databases/mongodb/reference/init-rpm.sh</div><div
id="_mcePaste">mv init-rpm.sh /etc/rc.d/init.d/mongodb</div><div
id="_mcePaste">chmod +x /etc/rc.d/init.d/mongodb /etc/init.d/mongodb</div><div
id="_mcePaste">chkconfig &#8211;add mongodb</div><div
id="_mcePaste">chkconfig &#8211;level 35 mongodb on</div><div
id="_mcePaste">You will also need to create a user and group for mongodb; issue the following command:</div><div
id="_mcePaste"><pre class="brush: plain;">&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;useradd -M -r --home-dir /opt/mongodb mongodb&lt;/div&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;</pre></div><div
id="_mcePaste">Now issue the following command to ensure that the MongoDB user you just created will have access to all required files in the /srv/db/ hierarchy:</div><div
id="_mcePaste">chown mongodb:mongodb -R /srv/db/</div><div
id="_mcePaste">To start and stop MongoDB using the init script, issue the appropriate command from the following:</div><div
id="_mcePaste">/etc/init.d/mongodb start</div><div
id="_mcePaste">/etc/init.d/mongodb stop</div><div
id="_mcePaste">For checking the web admin interface of Mongodb &#8211; listening on port 28017</div><div
id="_mcePaste">Check this URL : http://localhost:28017/</div><p>Before installing the Mongodb on linux box you need to install following packages on box.[root@sonyk-pc Download]# sudo yum -y install git tcsh scons gcc-c++ glibc-devel[root@sonyk-pc Download]# sudo yum -y install boost-devel pcre-devel js-devel readline-devel[root@sonyk-pc Download]# sudo yum -y install boost-devel-static readline-static ncurses-static</p><p>For 32bit user use following command[root@sonyk-pc Download]# wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.6.2.tgz<br
/> For 64bit use following command[root@sonyk-pc Download]# wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-1.6.2.tgz</p><p>[root@sonyk-pc Download]# tar xzf mongodb-linux-i686-1.6.2.tgz [root@sonyk-pc Download]#  cd mongodb-linux-i686-1.6.2<br
/> Mongo stores database in data/db folder. so we need to create those folder using following command.<br
/> [root@sonyk-pc mongodb-linux-i686-1.6.2]# sudo mkdir -p /data/db/[root@sonyk-pc mongodb-linux-i686-1.6.2]# sudo chown `id -u` /data/db<br
/> Using following command you can start the mongo database.<br
/> [root@sonyk-pc mongodb-linux-i686-1.6.2]# ./bin/mongod./bin/mongod &#8211;help for help and startup optionsThu Sep  9 13:10:55 MongoDB starting : pid=22159 port=27017 dbpath=/data/db/ 32-bit<br
/> ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data**       see http://blog.mongodb.org/post/137788967/32-bit-limitations<br
/> Thu Sep  9 13:10:55 db version v1.6.2, pdfile version 4.5</p><p>If you want to create mongodb service in linux then use following steps:<br
/> [root@sonyk-pc Download]# wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.6.2.tgz [root@sonyk-pc Download]# tar xzf http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.6.2.tgz[root@sonyk-pc Download]# mv mongodb-linux-i686-1.6.2 /opt/mongodb[root@sonyk-pc Download]# mkdir -p /srv/db/mongodb[root@sonyk-pc Download]# touch /srv/db/mongodb.log<br
/> [root@sonyk-pc Download]# mkdir /opt/bin/[root@sonyk-pc Download]# mkdir /opt/config/<br
/> create the File: /opt/bin/mongodb-stopPut following code in that file;<pre class="brush: plain;">#!/bin/bash
pid=`ps -o pid,command ax | grep mongod | awk '!/awk/ &amp;&amp; !/grep/ {print $1}'`;if [ &quot;${pid}&quot; != &quot;&quot; ]; then    kill -2 ${pid};fi</pre><p>create the File: /opt/bin/mongodb-startPut following code in that file:<pre class="brush: plain;">#!/bin/sh
/opt/mongodb/bin/mongod --config /opt/config/mongodb \## --upgrade \ ##runs a database upgrade option if needed \</pre><p>File: /opt/config/mongodbPut following code in that file:<pre class="brush: plain;"># Configuration Options for MongoDB## For More Information, Consider:# - Configuration Parameters: http://www.mongodb.org/display/DOCS/Command+Line+Parameters# - File Based Configuration: http://www.mongodb.org/display/DOCS/File+Based+Configuration
dbpath = /srv/db/mongodblogpath = /srv/db/mongodb.loglogappend = true
bind_ip = 127.0.0.1port = 27017fork = true
auth = true# noauth = true</pre><p>Do that file as linux executatblechmod +x /opt/bin/mongodb-startchmod +x /opt/bin/mongodb-stop</p><p>We&#8217;ve also created a very basic &#8220;init script&#8221; as a wrapper around the mongodb-start and mongo-stop scripts described above. You will still need to modify and manage the configuration of your MongoDB server in the files above. This script only provides a means for ensuring that MongoDB will start at boot. Issue the following commands:<br
/> wget http://library.linode.com/databases/mongodb/reference/init-rpm.shmv init-rpm.sh /etc/rc.d/init.d/mongodbchmod +x /etc/rc.d/init.d/mongodb /etc/init.d/mongodbchkconfig &#8211;add mongodbchkconfig &#8211;level 35 mongodb on</p><p>You will also need to create a user and group for mongodb; issue the following command:</p><pre class="brush: plain;">useradd -M -r --home-dir /opt/mongodb mongodb</pre><p>Now issue the following command to ensure that the MongoDB user you just created will have access to all required files in the /srv/db/ hierarchy:<br
/> chown mongodb:mongodb -R /srv/db/<br
/> To start and stop MongoDB using the init script, issue the appropriate command from the following:<br
/> /etc/init.d/mongodb start/etc/init.d/mongodb stop</p><p>For checking the web admin interface of Mongodb &#8211; listening on port 28017Check this URL : http://localhost:28017/</p> ]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2010/09/09/how-to-install-mongodb-on-linux/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to install the Mysql workbench on Fedora</title><link>http://wordpressapi.com/2010/09/01/install-mysql-workbench-fedora/</link> <comments>http://wordpressapi.com/2010/09/01/install-mysql-workbench-fedora/#comments</comments> <pubDate>Wed, 01 Sep 2010 18:29:03 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[MySql]]></category> <category><![CDATA[technology]]></category> <category><![CDATA[fedora]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[mysql workbench]]></category><guid
isPermaLink="false">http://wordpressapi.com/?p=5245</guid> <description><![CDATA[You can use following commands for installing the Mysql workbench on Linux system. Mysql workbench is very nice tool for creating the ER diagram on mysql database. I personaly like that tool so much. [root@sonyk-pc sony]# rpm -Uvh remi-release-11.rpm warning: remi-release-11.rpm: Header V3 DSA signature: NOKEY, key ID 00f97f56 Preparing&#8230; ########################################### [100%] 1:remi-release ########################################### [100%].....]]></description> <content:encoded><![CDATA[<p>You can use following commands for installing the Mysql workbench on Linux system. Mysql workbench is very nice tool for creating the ER diagram on mysql database. I personaly like that tool so much.<br
/> <strong>[root@sonyk-pc sony]# rpm -Uvh remi-release-11.rpm</strong><br
/> warning: remi-release-11.rpm: Header V3 DSA signature: NOKEY, key ID 00f97f56<br
/> Preparing&#8230;                ########################################### [100%]<br
/> 1:remi-release           ########################################### [100%]</p><p><strong>[root@sonyk-pc sony]# yum &#8211;enablerepo=remi install mysql-workbench</strong><br
/> Loaded plugins: refresh-packagekit<br
/> remi                                                                                                                                                                                                       | 3.0 kB     00:00<br
/> remi/primary_db                                                                                                                                                                                            | 198 kB     00:01<br
/> Setting up Install Process<br
/> Resolving Dependencies<br
/> &#8211;&gt; Running transaction check<br
/> &#8212;&gt; Package mysql-workbench.i586 0:5.2.26-1.fc11.remi set to be updated<br
/> &#8211;&gt; Processing Dependency: mysql-connector-c++ &gt;= 1.1.0-0.1.bzr888 for package: mysql-workbench-5.2.26-1.fc11.remi.i586<br
/> &#8211;&gt; Processing Dependency: python-paramiko for package: mysql-workbench-5.2.26-1.fc11.remi.i586<br
/> &#8211;&gt; Running transaction check<br
/> &#8212;&gt; Package mysql-connector-c++.i586 0:1.1.0-0.1.bzr888.fc11.remi set to be updated<br
/> &#8212;&gt; Package python-paramiko.noarch 0:1.7.5-1.fc11 set to be updated<br
/> &#8211;&gt; Finished Dependency Resolution</p><p>Dependencies Resolved</p><p>==================================================================================================================================================================================================================================<br
/> Package                                                    Arch                                          Version                                                            Repository                                      Size<br
/> ==================================================================================================================================================================================================================================<br
/> Installing:<br
/> mysql-workbench                                            i586                                          5.2.26-1.fc11.remi                                                 remi                                            14 M<br
/> Installing for dependencies:<br
/> mysql-connector-c++                                        i586                                          1.1.0-0.1.bzr888.fc11.remi                                         remi                                           252 k<br
/> python-paramiko                                            noarch                                        1.7.5-1.fc11                                                       updates                                        982 k</p><p>Transaction Summary<br
/> ==================================================================================================================================================================================================================================<br
/> Install       3 Package(s)<br
/> Upgrade       0 Package(s)</p><p>Total download size: 15 M<br
/> Is this ok [y/N]: y<br
/> Downloading Packages:<br
/> (1/3): mysql-connector-c++-1.1.0-0.1.bzr888.fc11.remi.i586.rpm                                                                                                                                             | 252 kB     00:03<br
/> (2/3): mysql-workbench-5.2.26-1.fc11.remi.i586.rpm                                                                                                                                                         |  14 MB     02:17<br
/> http://fedoramirror.hnsdc.com/updates/11/i386/python-paramiko-1.7.5-1.fc11.noarch.rpm: [Errno 14] HTTP Error 404: Not Found<br
/> Trying other mirror.<br
/> (3/3): python-paramiko-1.7.5-1.fc11.noarch.rpm                                                                                                                                                             | 982 kB     00:09<br
/> &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br
/> Total                                                                                                                                                                                              98 kB/s |  15 MB     02:34<br
/> warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 00f97f56<br
/> remi/gpgkey                                                                                                                                                                                                | 1.3 kB     00:00<br
/> Importing GPG key 0x00F97F56 &#8220;Remi Collet &#8221; from /etc/pki/rpm-gpg/RPM-GPG-KEY-remi<br
/> Is this ok [y/N]: y<br
/> Running rpm_check_debug<br
/> Running Transaction Test<br
/> Finished Transaction Test<br
/> Transaction Test Succeeded<br
/> Running Transaction<br
/> Installing     : python-paramiko-1.7.5-1.fc11.noarch                                                                                                                                                                        1/3<br
/> Installing     : mysql-connector-c++-1.1.0-0.1.bzr888.fc11.remi.i586                                                                                                                                                        2/3<br
/> Installing     : mysql-workbench-5.2.26-1.fc11.remi.i586                                                                                                                                                                    3/3</p><p>Installed:<br
/> mysql-workbench.i586 0:5.2.26-1.fc11.remi</p><p>Dependency Installed:<br
/> mysql-connector-c++.i586 0:1.1.0-0.1.bzr888.fc11.remi                                                                   python-paramiko.noarch 0:1.7.5-1.fc11</p><p>Complete!<br
/> [root@sonyk-pc sony]#</p><p>After installation you will find the mysql workbench under application-&gt; programming  menu</p><p>After that you will you will see the following screen.</p><p><img
class="alignnone size-large wp-image-5246" title="mysql-workbench" src="http://wordpressapi.com/files/mysql-workbench-600x411.jpg" alt="" width="600" height="411" /></p><p>clicking on new connection you can create the new connections and after that If you want to create the ER diagram then go to database Option and reverse engineering.</p> ]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2010/09/01/install-mysql-workbench-fedora/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Find the largest tables on MySQL Server</title><link>http://wordpressapi.com/2010/08/01/find-the-largest-tables-on-mysql-server/</link> <comments>http://wordpressapi.com/2010/08/01/find-the-largest-tables-on-mysql-server/#comments</comments> <pubDate>Sun, 01 Aug 2010 06:21:43 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[MySql]]></category> <category><![CDATA[databases]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[mysql interview]]></category> <category><![CDATA[Server]]></category> <category><![CDATA[tables]]></category><guid
isPermaLink="false">http://purab.wordpress.com/?p=20</guid> <description><![CDATA[Using following article You can find the largest tables from Mysql database. Finding largest tables on MySQL instance is no brainier in MySQL 5.0+ thanks to Information Schema but I still wanted to post little query I use for the purpose so I can easily find it later, plus it is quite handy in a.....]]></description> <content:encoded><![CDATA[<p><img
class="alignnone size-full wp-image-4977" title="mysql-server" src="http://wordpressapi.com/files/mysql-server.jpg" alt="" width="208" height="243" /></p><p>Using following article You can find the largest tables from Mysql database.</p><p>Finding largest tables on MySQL instance is no brainier in MySQL 5.0+ thanks to Information Schema but I still wanted to post little query I use for the purpose so I can easily find it later, plus it is quite handy in a way it presents information:</p><div
class="igBar"><span><a
href="http://www.mysqlperformanceblog.com/2008/02/04/finding-out-largest-tables-on-mysql-server/#">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">SQL:</span></p><div><div
class="sql"><ol><li><div
style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">mysql&gt; <span
style="font-weight: bold; color: #993333;">SELECT</span> concat<span
style="font-weight: bold; color: #006600;">(</span>table_schema,<span
style="color: #ff0000;">&#8216;.&#8217;</span>,table_name<span
style="font-weight: bold; color: #006600;">)</span>,concat<span
style="font-weight: bold; color: #006600;">(</span>round<span
style="font-weight: bold; color: #006600;">(</span>table_rows/<span
style="color: #800000;">1000000</span>,<span
style="color: #800000;">2</span><span
style="font-weight: bold; color: #006600;">)</span>,<span
style="color: #ff0000;">&#8216;M&#8217;</span><span
style="font-weight: bold; color: #006600;">)</span> rows,concat<span
style="font-weight: bold; color: #006600;">(</span>round<span
style="font-weight: bold; color: #006600;">(</span>data_length/<span
style="font-weight: bold; color: #006600;">(</span><span
style="color: #800000;">1024</span>*<span
style="color: #800000;">1024</span>*<span
style="color: #800000;">1024</span><span
style="font-weight: bold; color: #006600;">)</span>,<span
style="color: #800000;">2</span><span
style="font-weight: bold; color: #006600;">)</span>,<span
style="color: #ff0000;">&#8216;G&#8217;</span><span
style="font-weight: bold; color: #006600;">)</span> <span
style="font-weight: bold; color: #993333;">DATA</span>,concat<span
style="font-weight: bold; color: #006600;">(</span>round<span
style="font-weight: bold; color: #006600;">(</span>index_length/<span
style="font-weight: bold; color: #006600;">(</span><span
style="color: #800000;">1024</span>*<span
style="color: #800000;">1024</span>*<span
style="color: #800000;">1024</span><span
style="font-weight: bold; color: #006600;">)</span>,<span
style="color: #800000;">2</span><span
style="font-weight: bold; color: #006600;">)</span>,<span
style="color: #ff0000;">&#8216;G&#8217;</span><span
style="font-weight: bold; color: #006600;">)</span> idx,concat<span
style="font-weight: bold; color: #006600;">(</span>round<span
style="font-weight: bold; color: #006600;">(</span><span
style="font-weight: bold; color: #006600;">(</span>data_length+index_length<span
style="font-weight: bold; color: #006600;">)</span>/<span
style="font-weight: bold; color: #006600;">(</span><span
style="color: #800000;">1024</span>*<span
style="color: #800000;">1024</span>*<span
style="color: #800000;">1024</span><span
style="font-weight: bold; color: #006600;">)</span>,<span
style="color: #800000;">2</span><span
style="font-weight: bold; color: #006600;">)</span>,<span
style="color: #ff0000;">&#8216;G&#8217;</span><span
style="font-weight: bold; color: #006600;">)</span> total_size,round<span
style="font-weight: bold; color: #006600;">(</span>index_length/data_length,<span
style="color: #800000;">2</span><span
style="font-weight: bold; color: #006600;">)</span> idxfrac <span
style="font-weight: bold; color: #993333;">FROM</span> information_schema.<span
style="font-weight: bold; color: #993333;">TABLES</span> <span
style="font-weight: bold; color: #993333;">ORDER</span> <span
style="font-weight: bold; color: #993333;">BY</span> data_length+index_length <span
style="font-weight: bold; color: #993333;">DESC</span> <span
style="font-weight: bold; color: #993333;">LIMIT</span> <span
style="color: #800000;">10</span>;</div></li><li><div
style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">+<span
style="font-style: italic; color: #808080;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+</span></div></li><li><div
style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">| concat<span
style="font-weight: bold; color: #006600;">(</span>table_schema,<span
style="color: #ff0000;">&#8216;.&#8217;</span>,table_name<span
style="font-weight: bold; color: #006600;">)</span> | rows   | <span
style="font-weight: bold; color: #993333;">DATA</span> | idx    | total_size | idxfrac |</div></li><li><div
style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">+<span
style="font-style: italic; color: #808080;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+</span></div></li><li><div
style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">| art87.link_out87                    | <span
style="color: #800000;">37</span>.25M | <span
style="color: #800000;">14</span>.83G | <span
style="color: #800000;">14</span>.17G | <span
style="color: #800000;">29</span>.00G     | <span
style="color: #800000;">0</span>.<span
style="color: #800000;">96</span> |</div></li><li><div
style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">| art87.article87                     | <span
style="color: #800000;">12</span>.67M | <span
style="color: #800000;">15</span>.83G | <span
style="color: #800000;">4</span>.79G  | <span
style="color: #800000;">20</span>.62G     | <span
style="color: #800000;">0</span>.<span
style="color: #800000;">30</span> |</div></li><li><div
style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">| art116.article116                   | <span
style="color: #800000;">10</span>.49M | <span
style="color: #800000;">12</span>.52G | <span
style="color: #800000;">3</span>.65G  | <span
style="color: #800000;">16</span>.18G     | <span
style="color: #800000;">0</span>.<span
style="color: #800000;">29</span> |</div></li><li><div
style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">| art84.article84                     | <span
style="color: #800000;">10</span>.10M | <span
style="color: #800000;">10</span>.11G | <span
style="color: #800000;">3</span>.59G  | <span
style="color: #800000;">13</span>.70G     | <span
style="color: #800000;">0</span>.<span
style="color: #800000;">35</span> |</div></li><li><div
style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">| art104.link_out104                  | <span
style="color: #800000;">23</span>.66M | <span
style="color: #800000;">6</span>.63G  | <span
style="color: #800000;">6</span>.55G  | <span
style="color: #800000;">13</span>.18G     | <span
style="color: #800000;">0</span>.<span
style="color: #800000;">99</span> |</div></li><li><div
style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">| art118.article118                   | <span
style="color: #800000;">7</span>.06M  | <span
style="color: #800000;">10</span>.49G | <span
style="color: #800000;">2</span>.68G  | <span
style="color: #800000;">13</span>.17G     | <span
style="color: #800000;">0</span>.<span
style="color: #800000;">26</span> |</div></li><li><div
style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">| art106.article106                   | <span
style="color: #800000;">9</span>.86M  | <span
style="color: #800000;">10</span>.19G | <span
style="color: #800000;">2</span>.76G  | <span
style="color: #800000;">12</span>.95G     | <span
style="color: #800000;">0</span>.<span
style="color: #800000;">27</span> |</div></li><li><div
style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">| art85.article85                     | <span
style="color: #800000;">6</span>.20M  | <span
style="color: #800000;">9</span>.82G  | <span
style="color: #800000;">2</span>.51G  | <span
style="color: #800000;">12</span>.33G     | <span
style="color: #800000;">0</span>.<span
style="color: #800000;">26</span> |</div></li><li><div
style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">| art91.article91                     | <span
style="color: #800000;">8</span>.66M  | <span
style="color: #800000;">9</span>.17G  | <span
style="color: #800000;">2</span>.66G  | <span
style="color: #800000;">11</span>.83G     | <span
style="color: #800000;">0</span>.<span
style="color: #800000;">29</span> |</div></li><li><div
style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">| art94.article94                     | <span
style="color: #800000;">5</span>.21M  | <span
style="color: #800000;">10</span>.10G | <span
style="color: #800000;">1</span>.69G  | <span
style="color: #800000;">11</span>.79G     | <span
style="color: #800000;">0</span>.<span
style="color: #800000;">17</span> |</div></li><li><div
style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">+<span
style="font-style: italic; color: #808080;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+</span></div></li><li><div
style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span
style="color: #800000;">10</span> rows <span
style="font-weight: bold; color: #993333;">IN</span> <span
style="font-weight: bold; color: #993333;">SET</span> <span
style="font-weight: bold; color: #006600;">(</span><span
style="color: #800000;">2</span> min <span
style="color: #800000;">29</span>.<span
style="color: #800000;">19</span> sec<span
style="font-weight: bold; color: #006600;">)</span></div></li></ol></div></div></div><p>I do some converting and rounding to see number of rows in millions and data and index size in GB so I can save on counting zeros.<br
/> The last column shows how much does the index take compared to the data which is mainly for informational purposes but for MyISAM can also help you to size your key buffer compared to operating system cache.</p><p>I also use it to see which tables may be worth to review in terms of indexes. Large index size compared to data size often indicates there is a lot of indexes (so it is well possible there are some <a
href="http://www.mysqlperformanceblog.com/2006/08/17/duplicate-indexes-and-redundant-indexes/">duplicates, redundant </a>or simply unused indexes among them) or may be there is long primary key with Innodb tables. Of course it also could be perfectly fine tables but it is worth to look.</p><p>Changing the query a bit to look for different sorting order or extra data &#8211; such as average row length you can learn quite a lot about your schema this way.</p><p>It is also worth to note queries on information_schema can be rather slow if you have a lot of large tables. On this instance it took 2.5 minutes to run for 450 tables.</p><p><strong>UPDATE:</strong> To make things easier I&#8217;ve added INFORMATION_SCHEMA to the query so it works whatever database you have active. It does not work with MySQL before 5.0 still of course</p> ]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2010/08/01/find-the-largest-tables-on-mysql-server/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>How to take mysql backup from file system</title><link>http://wordpressapi.com/2010/05/08/mysql-backup-file-system/</link> <comments>http://wordpressapi.com/2010/05/08/mysql-backup-file-system/#comments</comments> <pubDate>Sat, 08 May 2010 06:29:14 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[MySql]]></category> <category><![CDATA[Open source]]></category> <category><![CDATA[tutorials]]></category> <category><![CDATA[mysql backup]]></category><guid
isPermaLink="false">http://wordpressapi.com/?p=2071</guid> <description><![CDATA[Many times we fail to restore the mysql dump from command line. Some times mysql server crash. First go to your filesystem. Here I am using the fedora OS for this example In linux go to /var/lib/mysql path In that folder each folder means seprate database. Copy that all folders to your local machine. again.....]]></description> <content:encoded><![CDATA[<p><a
href="http://wordpressapi.com/files/mysql-backup.jpg"><img
class="alignnone size-full wp-image-2072" title="mysql-backup" src="http://wordpressapi.com/files/mysql-backup.jpg" alt="" width="399" height="291" /></a><br
/> Many times we fail to restore the mysql dump from command line.<br
/> Some times mysql server crash. First go to your filesystem.<br
/> Here I am using the fedora OS for this example</p><p>In linux go to /var/lib/mysql path</p><p>In that folder each folder means seprate database.</p><p>Copy that all folders to your local machine.<br
/> again go to your mysql local installtion and paste that folder into your mysql folder.</p><p>For in each database folder file you will find follwoing types of files in the folder<br
/> db.opt<br
/> test.frm<br
/> test.MYD<br
/> test.MYI</p><p>just copy and paste in your system</p> ]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2010/05/08/mysql-backup-file-system/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>how to create multi level unique id in mysql (composite unique key in mysql)</title><link>http://wordpressapi.com/2010/05/01/create-multi-level-unique-id-mysql-composite-unique-key-mysql/</link> <comments>http://wordpressapi.com/2010/05/01/create-multi-level-unique-id-mysql-composite-unique-key-mysql/#comments</comments> <pubDate>Sat, 01 May 2010 06:36:47 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[MySql]]></category> <category><![CDATA[tutorials]]></category><guid
isPermaLink="false">http://wordpressapi.com/?p=2054</guid> <description><![CDATA[Multi level unique is very important feature in mysql. This feature is present all databases. Using this composite unique key we can achieve multilevel uniqueness. Here I am going to give you how to create the composite unique key in mysql. mysql&#62; alter table `user` add unique `DATE_uuid` (`date`, `uuid`) how to check indexes on.....]]></description> <content:encoded><![CDATA[<p><a
href="http://wordpressapi.com/files/mysql_logo.jpg"><img
class="alignnone size-full wp-image-2055" title="mysql_logo" src="http://wordpressapi.com/files/mysql_logo.jpg" alt="" width="273" height="309" /></a></p><p>Multi level unique is very important feature in mysql. This feature is present all databases. Using this composite unique key we can achieve multilevel uniqueness.</p><p>Here I am going to give you how to create the composite unique key in mysql.</p><p>mysql&gt; alter table `user` add unique `DATE_uuid` (`date`, `uuid`)</p><p>how to check indexes on table<br
/> mysql&gt; show index from user;<br
/> +&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+<br
/> | Table          | Non_unique | Key_name   | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |<br
/> +&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+<br
/> | user |          0 | PRIMARY    |            1 | user_id         | A         |           0 |     NULL | NULL   |      | BTREE      |         |<br
/> | user |          0 | DATE_uuid |            1 | date        | A         |        NULL |     NULL | NULL   |      | BTREE      |         |<br
/> | user |          0 | DATE_uuid |            2 | uuid       | A         |           0 |     NULL | NULL   |      | BTREE      |         |<br
/> +&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+<br
/> 3 rows in set (0.01 sec)</p><p>mysql&gt;</p> ]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2010/05/01/create-multi-level-unique-id-mysql-composite-unique-key-mysql/feed/</wfw:commentRss> <slash:comments>31</slash:comments> </item> <item><title>How to work with PHP array</title><link>http://wordpressapi.com/2010/02/24/work-php-array/</link> <comments>http://wordpressapi.com/2010/02/24/work-php-array/#comments</comments> <pubDate>Wed, 24 Feb 2010 16:00:48 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[MySql]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[tutorials]]></category> <category><![CDATA[array]]></category><guid
isPermaLink="false">http://wordpressapi.com/?p=1492</guid> <description><![CDATA[If you are programmer then you dont need introduction of array. In every language array is the most important part. Using array we can achive so many things and array is useful for so many times when we do programming. In this article I am going to share some method about PHP array. What is.....]]></description> <content:encoded><![CDATA[<p>If you are programmer then you dont need introduction of array. In every language array is the most important part.</p><p>Using array we can achive so many things and array is useful for so many times when we do programming.<br
/> In this article I am going to share some method about PHP array.</p><p>What is PHP array?<br
/> An array in PHP is actually an ordered map. A map is a type that associates values to keys. This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more. As array values can be other arrays, trees and multidimensional arrays are also possible.</p><p>Following is syntax<br
/> array(key =&gt; value)</p><p>Creating PHP array:</p><pre class="brush: php;">
&lt;?php
$arr = array(&quot;str_arr&quot; =&gt; &quot;this is string&quot;, 25 =&gt; true);

echo $arr[&quot;str_arr&quot;]; // print this is string
echo $arr[25];    // print ture
?&gt;
</pre><p>How to print direct PHP array.</p><pre class="brush: php;">
&lt;?php
$arr=array(&quot;a&quot;=&gt;&quot;jimi&quot;,&quot;b&quot;=&gt;&quot;timi&quot;,&quot;c&quot;=&gt;&quot;limi&quot;);
print_r($arr);
?&gt;
</pre><p>How to print PHP array preformated</p><pre class="brush: php;">
&lt;?php
$arr=array(&quot;a&quot;=&gt;&quot;jimi&quot;,&quot;b&quot;=&gt;&quot;timi&quot;,&quot;c&quot;=&gt;&quot;limi&quot;);
print_r(&quot;&lt;pre&gt;&quot;.$arr);
?&gt;
</pre><p>How to create a two-dimensional PHP array</p><pre class="brush: php;">
&lt;?php
$arr = array (
 &quot;fruits&quot;  =&gt; array(&quot;a&quot; =&gt; &quot;orange&quot;, &quot;b&quot; =&gt; &quot;banana&quot;, &quot;c&quot; =&gt; &quot;apple&quot;),
 &quot;numbers&quot; =&gt; array(1, 2, 3, 4, 5, 6),
 &quot;holes&quot;   =&gt; array(&quot;first&quot;, 5 =&gt; &quot;second&quot;, &quot;third&quot;)
);
print_r(&quot;&lt;pre&gt;&quot;.$arr);
?&gt;
</pre><p>How to create an array from MySql table</p><pre class="brush: php;">
&lt;?
function cre_array($row) {
 foreach($row as $key =&gt; $value) {
 global $$key;
 $$key = $value;
 }
}

//User table has first_name field present.

$sql = mysql_query(&quot;SELECT * FROM 'users'&quot;);
while ($row = mysql_fetch_assoc($sql)) {
 cre_array($row);
 echo $first_name.'&lt;br&gt;'; //instead of $row['first_name']
}

?&gt;
</pre><p>How to count PHP array count</p><pre class="brush: php;">
$fruits = array(&quot;a&quot; =&gt; &quot;orange&quot;, &quot;b&quot; =&gt; &quot;banana&quot;, &quot;c&quot; =&gt; &quot;apple&quot;);
echo sizeof($fruits);
echo $arrayLength = count($fruits);
</pre><p>PHP and MySql and Array</p><pre class="brush: php;">
&lt;?php
$sql = &quot;SELECT key,value FROM table&quot;;
$result = mysql_query($sql);
while($row = mysql_fetch_row($result)) {
$myArray[$row[0]] = $row[1];
}

while(list($key,$value) = each($myArray)) {
echo &quot;$key : $value&quot;;
}
?&gt;
</pre><p>Following image will help you to understand two dimensional array.</p><p><a
href="http://wordpressapi.com/files/twodim-array.png"><img
class="alignnone size-medium wp-image-1493" title="twodim-array" src="http://wordpressapi.com/files/twodim-array-300x243.png" alt="" width="300" height="243" /></a></p> ]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2010/02/24/work-php-array/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Issue with installing the mysql gem: solved, how to install mysql gem without issue</title><link>http://wordpressapi.com/2009/11/17/issue-with-installing-the-mysql-gem-solved-how-to-install-mysql-gem-without-issue/</link> <comments>http://wordpressapi.com/2009/11/17/issue-with-installing-the-mysql-gem-solved-how-to-install-mysql-gem-without-issue/#comments</comments> <pubDate>Tue, 17 Nov 2009 09:50:35 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[MySql]]></category> <category><![CDATA[Open source]]></category> <category><![CDATA[Ruby on Rails]]></category> <category><![CDATA[Rails]]></category> <category><![CDATA[ruby]]></category><guid
isPermaLink="false">http://purab.wordpress.com/2009/11/17/issue-with-installing-the-mysql-gem-solved-how-to-install-mysql-gem-without-issue/</guid> <description><![CDATA[When tried to install mysql gem I got following error [root@localhost siwan]# sudo gem install mysql Building native extensions. This could take a while&#8230; ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb checking for mysql_ssl_set()&#8230; yes checking for rb_str_set_len()&#8230; no checking for rb_thread_start_timer()&#8230; yes checking for mysql.h&#8230; no checking for.....]]></description> <content:encoded><![CDATA[<p>When tried to install mysql gem I got following error<br
/> [root@localhost siwan]# sudo gem install mysql<br
/> Building native extensions.  This could take a while&#8230;<br
/> ERROR:  Error installing mysql:<br
/> ERROR: Failed to build gem native extension.</p><p>/usr/bin/ruby extconf.rb<br
/> checking for mysql_ssl_set()&#8230; yes<br
/> checking for rb_str_set_len()&#8230; no<br
/> checking for rb_thread_start_timer()&#8230; yes<br
/> checking for mysql.h&#8230; no<br
/> checking for mysql/mysql.h&#8230; no<br
/> *** extconf.rb failed ***<br
/> Could not create Makefile due to some reason, probably lack of<br
/> necessary libraries and/or headers.  Check the mkmf.log file for more<br
/> details.  You may need configuration options.</p><p>Provided configuration options:<br
/> &#8211;with-opt-dir<br
/> &#8211;without-opt-dir<br
/> &#8211;with-opt-include<br
/> &#8211;without-opt-include=${opt-dir}/include<br
/> &#8211;with-opt-lib<br
/> &#8211;without-opt-lib=${opt-dir}/lib<br
/> &#8211;with-make-prog<br
/> &#8211;without-make-prog<br
/> &#8211;srcdir=.<br
/> &#8211;curdir<br
/> &#8211;ruby=/usr/bin/ruby<br
/> &#8211;with-mysql-config<br
/> &#8211;without-mysql-config</p><p>Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.<br
/> Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out</p><p>To find the mysql path on machine used following command<br
/> [root@localhost siwan]# which mysql<br
/> /usr/bin/mysql</p><p>I tried following command:<br
/> [root@localhost siwan]# sudo gem install mysql — –with-mysql-dir=/usr/bin/mysql</p><p>I Got the same error</p><p>[root@localhost siwan]# sudo gem install mysql — –with-mysql-dir=/usr/bin/mysql<br
/> Building native extensions.  This could take a while&#8230;<br
/> ERROR:  Error installing mysql:<br
/> ERROR: Failed to build gem native extension.</p><p>/usr/bin/ruby extconf.rb<br
/> checking for mysql_ssl_set()&#8230; yes<br
/> checking for rb_str_set_len()&#8230; no<br
/> checking for rb_thread_start_timer()&#8230; yes<br
/> checking for mysql.h&#8230; no<br
/> checking for mysql/mysql.h&#8230; no<br
/> *** extconf.rb failed ***<br
/> Could not create Makefile due to some reason, probably lack of<br
/> necessary libraries and/or headers.  Check the mkmf.log file for more<br
/> details.  You may need configuration options.</p><p>Provided configuration options:<br
/> &#8211;with-opt-dir<br
/> &#8211;without-opt-dir<br
/> &#8211;with-opt-include<br
/> &#8211;without-opt-include=${opt-dir}/include<br
/> &#8211;with-opt-lib<br
/> &#8211;without-opt-lib=${opt-dir}/lib<br
/> &#8211;with-make-prog<br
/> &#8211;without-make-prog<br
/> &#8211;srcdir=.<br
/> &#8211;curdir<br
/> &#8211;ruby=/usr/bin/ruby<br
/> &#8211;with-mysql-config<br
/> &#8211;without-mysql-config</p><p>Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.<br
/> Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out<br
/> ERROR:  could not find gem — locally or in a repository<br
/> ERROR:  could not find gem –with-mysql-dir=/usr/bin/mysql locally or in a repository</p><p>Then I checked the mysql-devel<br
/> [root@localhost siwan]# yum list mysql-devel<br
/> Loaded plugins: refresh-packagekit<br
/> Available Packages<br
/> mysql-devel.i586                                              5.1.37-1.fc11                                               updates</p><p>Then I Installed the mysql-devel<br
/> [root@localhost siwan]# yum install mysql-devel<br
/> Installed:<br
/> mysql-devel.i586 0:5.1.37-1.fc11<br
/> Complete!</p><p>Then I tried the mysql Gem installing&#8230;..I am able to install the mysql gem&#8230;<br
/> [root@localhost siwan]# gem install mysql<br
/> Building native extensions.  This could take a while&#8230;<br
/> Successfully installed mysql-2.8.1<br
/> 1 gem installed<br
/> Installing ri documentation for mysql-2.8.1&#8230;<br
/> Installing RDoc documentation for mysql-2.8.1&#8230;<br
/> [root@localhost siwan]#</p> ]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2009/11/17/issue-with-installing-the-mysql-gem-solved-how-to-install-mysql-gem-without-issue/feed/</wfw:commentRss> <slash:comments>13</slash:comments> </item> <item><title>How to setup mongrel cluster setup on fedora</title><link>http://wordpressapi.com/2009/11/02/how-to-setup-mongrel-cluster-setup-on-fedora/</link> <comments>http://wordpressapi.com/2009/11/02/how-to-setup-mongrel-cluster-setup-on-fedora/#comments</comments> <pubDate>Mon, 02 Nov 2009 13:46:43 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[Apache]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[MySql]]></category> <category><![CDATA[Open source]]></category> <category><![CDATA[Ruby on Rails]]></category> <category><![CDATA[mongrel]]></category> <category><![CDATA[mongrel_cluster]]></category> <category><![CDATA[Rails]]></category> <category><![CDATA[ruby]]></category><guid
isPermaLink="false">http://purab.wordpress.com/?p=293</guid> <description><![CDATA[First install the following gems: #su #gem install mongrel #gem install mongrel_cluster #cd project_name #mongrel_rails cluster::configure -e production -p 3000 -N 3 -c /home/siwan/project_name -a 127.0.0.1 &#8212;-prefix /project_name # mongrel_rails cluster::start You are able to start your applicaton at http://127.0.0.1:3000, http://127.0.0.1:3001 and http://127.0.0.1:3002 for all the cluster # mongrel_rails cluster::stop Advanced prepairation for production realeaze.....]]></description> <content:encoded><![CDATA[<p>First install the following gems:<br
/> #su<br
/> #gem install mongrel<br
/> #gem install mongrel_cluster<br
/> #cd project_name<br
/> #mongrel_rails cluster::configure -e production -p 3000 -N 3 -c /home/siwan/project_name -a 127.0.0.1 &#8212;-prefix /project_name<br
/> # mongrel_rails cluster::start</p><p>You are able to start your applicaton at http://127.0.0.1:3000, http://127.0.0.1:3001 and http://127.0.0.1:3002</p><p>for all the cluster<br
/> # mongrel_rails cluster::stop</p><p>Advanced prepairation for production realeaze<br
/> $ mkdir /etc/mongrel_cluster</p><p>#vim /etc/mongrel_cluster/project_name.yml<br
/> copy and paste following text;<br
/> user: project_name<br
/> cwd: //home/siwan/project_name<br
/> log_file: /home/siwan/project_name/mongrel.log<br
/> port: &#8220;3000&#8243;<br
/> environment: production<br
/> group: dev<br
/> address: localhost<br
/> pid_file: /home/siwan/project_name/tmp/pids/mongrel.pid<br
/> servers: 3</p><p>or you can run the following command</p><p>or copy and paste the content from config/mongrel_cluster.yml file to /etc/mongrel_cluster/project_name.yml</p><p># ln -s /home/siwan/project_name/config/mongrel_cluster.yml /etc/mongrel_cluster/project_name.yml</p><p>Then open your httpd.conf file for apache configration:</p><p>&lt;Proxy balancer://project_name&gt;<br
/> BalancerMember http://127.0.0.1:3000<br
/> BalancerMember http://127.0.0.1:3001<br
/> BalancerMember http://127.0.0.1:3002<br
/> &lt;/Proxy&gt;</p><p>&lt;VirtualHost *:80&gt;<br
/> ProxyPreserveHost On<br
/> # Avoid open you server to proxying<br
/> ProxyRequests Off<br
/> # Options +FollowSymLinks<br
/> RewriteEngine On</p><p>RewriteRule ^/(images|stylesheet|javascript|html)/?(.*) /home/siwan/project_name/public/$0 [L]<br
/> ServerAdmin siwan@yahoo.co.in<br
/> DocumentRoot /home/project_name/<br
/> ServerName example.com<br
/> RewriteRule  ^/(.*)$  balancer://project_name%{REQUEST_URI} [P,QSA,L]<br
/> &lt;/VirtualHost&gt;</p><p>Restart the apache server<br
/> #/etc/init.d/httpd restart</p><p>Command for restart the mongrel servers from any where<br
/> # mongrel_rails cluster::restart -C /etc/mongrel_cluster/project_name.yml</p> ]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2009/11/02/how-to-setup-mongrel-cluster-setup-on-fedora/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>How to install mysql-connector-java / mysql-connector-odbc on fedora</title><link>http://wordpressapi.com/2009/11/02/how-to-install-mysql-connector-java-mysql-connector-odbc-on-fedora/</link> <comments>http://wordpressapi.com/2009/11/02/how-to-install-mysql-connector-java-mysql-connector-odbc-on-fedora/#comments</comments> <pubDate>Mon, 02 Nov 2009 09:36:43 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[MySql]]></category> <category><![CDATA[fedora]]></category> <category><![CDATA[java]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[odbc]]></category><guid
isPermaLink="false">http://purab.wordpress.com/2009/11/02/how-to-install-mysql-connector-java-mysql-connector-odbc-on-fedora/</guid> <description><![CDATA[I am using the Fedora9 for installation I downloaded rmp file from this location. http://rpm.pbone.net/index.php3/stat/4/idpl/7221422/com/mysql-connector-java-3.1.12-5.fc9.i386.rpm.html If you are using the fedora 10 or 11, you can use this url; http://www.rpmfind.net/linux/rpm2html/search.php?query=mysql-connector-java&#38;submit=Search+&#8230;&#38;system=fedora+9&#38;arch= [siwan@localhost ]$ su Password: [root@localhost ]# rpm -Uvh mysql-connector-java-3.1.12-5.fc9.i386.rpm Preparing&#8230; ########################################### [100%] 1:mysql-connector-java ########################################### [100%] [root@localhost ]# how to install mysql-connector-odbc on fedora I downloaded.....]]></description> <content:encoded><![CDATA[<p>I am using the Fedora9 for installation<br
/> I downloaded rmp file from this location.</p><p>http://rpm.pbone.net/index.php3/stat/4/idpl/7221422/com/mysql-connector-java-3.1.12-5.fc9.i386.rpm.html</p><p>If you are using the fedora 10 or 11, you can use this url;</p><p>http://www.rpmfind.net/linux/rpm2html/search.php?query=mysql-connector-java&amp;submit=Search+&#8230;&amp;system=fedora+9&amp;arch=</p><p>[siwan@localhost ]$ su<br
/> Password:<br
/> [root@localhost ]# rpm -Uvh mysql-connector-java-3.1.12-5.fc9.i386.rpm<br
/> Preparing&#8230;                ########################################### [100%]<br
/> 1:mysql-connector-java   ########################################### [100%]<br
/> [root@localhost ]#</p><p>how to install mysql-connector-odbc on fedora</p><p>I downloaded rmp file from this location.</p><p>http://rpm.pbone.net/index.php3?stat=3&amp;search=mysql-connector-odbc&amp;srodzaj=3</p><p>[root@localhost Desktop]# rpm -Uvh mysql-connector-odbc-3.51.24r1071-1.fc9.i386.rpm<br
/> Preparing&#8230;                ########################################### [100%]<br
/> 1:mysql-connector-odbc   ########################################### [100%]<br
/> [root@localhost Desktop]#</p> ]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2009/11/02/how-to-install-mysql-connector-java-mysql-connector-odbc-on-fedora/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>How to find the Mysql database engine type</title><link>http://wordpressapi.com/2009/10/09/how-to-find-the-mysql-database-engine-type/</link> <comments>http://wordpressapi.com/2009/10/09/how-to-find-the-mysql-database-engine-type/#comments</comments> <pubDate>Fri, 09 Oct 2009 12:18:00 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[MySql]]></category> <category><![CDATA[database]]></category><guid
isPermaLink="false">http://purab.wordpress.com/?p=271</guid> <description><![CDATA[You need to use this command for checking the engine type: SHOW TABLE STATUS WHERE Name = &#8216;users&#8217;; Or Use this command for checking the all table&#8217;s engine type. SHOW TABLE STATUS; Or You can use this command for database: mysqlshow &#8211;status db_name; I used following URL for creating this commands: http://dev.mysql.com/doc/refman/4.1/en/show-table-status.html 5 SHOW TABLE.....]]></description> <content:encoded><![CDATA[<p>You need to use this command for checking the engine type:</p><p>SHOW TABLE STATUS WHERE Name = &#8216;users&#8217;;</p><p>Or Use this command for checking the all table&#8217;s engine type.</p><p>SHOW TABLE STATUS;</p><p>Or You can use this command for database:</p><p>mysqlshow &#8211;status db_name;</p><p>I used following URL for creating this commands:</p><p><a
href="http://dev.mysql.com/doc/refman/4.1/en/show-table-status.html" target="_blank">http://dev.mysql.com/doc/refman/4.1/en/show-table-status.html</a></p><div
id="_mcePaste" style="overflow:hidden;width:1px;height:1px"><span
class="vote-count-post"> 5 </span> <img
class="vote-down" title="This answer is not useful (click again to undo)" src="http://sstatic.net/so/img/vote-arrow-down.png" alt="vote down" width="40" height="25" /> <img
class="vote-accepted" style="cursor:default" title="The question owner accepted this as the best answer Oct 17 '08 at 19:34" src="http://sstatic.net/so/img/vote-accepted-on.png" alt="check" width="30" height="31" /><code>SHOW TABLE STATUS WHERE Name = 'xxx'</code></p></div> ]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2009/10/09/how-to-find-the-mysql-database-engine-type/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Create XML through php and mysql</title><link>http://wordpressapi.com/2009/10/08/create-xml-through-php-and-mysql/</link> <comments>http://wordpressapi.com/2009/10/08/create-xml-through-php-and-mysql/#comments</comments> <pubDate>Thu, 08 Oct 2009 11:21:43 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[MySql]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[XML]]></category> <category><![CDATA[xml]]></category><guid
isPermaLink="false">http://purab.wordpress.com/2009/10/08/create-xml-through-php-and-mysql/</guid> <description><![CDATA[Here I am giving you the very basic sample code for creating the XML file through PHP and MYsql &#60;?php // We&#39;ll be outputting a PDF header(&#39;Content-type: text/xml&#39;); echo &#34;&#8221; $db_name = &#8220;testDB&#8221;; $connection = mysql_connect(&#8220;example.com&#8221;, &#8220;username&#8221;, &#8220;password&#8221;) or die(&#8220;Could not connect.&#8221;); $table_name = &#8216;user&#8217;; $query = &#8220;select * from &#8221; . $table_name; $result =.....]]></description> <content:encoded><![CDATA[<p>Here I am giving you the very basic sample code for creating the XML file through PHP and MYsql</p><p>&lt;?php</p><p>// We&#39;ll be outputting a PDF<br
/> header(&#39;Content-type: text/xml&#39;);</p><p>echo &quot;&#8221;</p><p>$db_name = &#8220;testDB&#8221;;<br
/> $connection = mysql_connect(&#8220;example.com&#8221;, &#8220;username&#8221;, &#8220;password&#8221;) or die(&#8220;Could not connect.&#8221;);<br
/> $table_name = &#8216;user&#8217;;</p><p>$query = &#8220;select * from &#8221; . $table_name;</p><p>$result = mysql_query($query, $connection) or die(&#8220;Could not complete database query&#8221;);<br
/> $num = mysql_num_rows($result);</p><p>while ($row = mysql_fetch_assoc($result)) {<br
/> echo &#8220;&#8221;. $row['firstname'].&#8221;";<br
/> echo &#8220;&#8221;. $row['lastname'].&#8221;";<br
/> echo &#8220;<br
/> <address>&#8220;. $row['address'].&#8221;</address><p>&#8220;;<br
/> echo &#8220;&#8221;. $row['age'].&#8221;";<br
/> }</p><p>?&gt;</p> ]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2009/10/08/create-xml-through-php-and-mysql/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Solved :Error establishing a database connection</title><link>http://wordpressapi.com/2009/10/02/solved-error-establishing-a-database-connection/</link> <comments>http://wordpressapi.com/2009/10/02/solved-error-establishing-a-database-connection/#comments</comments> <pubDate>Fri, 02 Oct 2009 09:51:48 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[MySql]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[wordpress]]></category><guid
isPermaLink="false">http://purab.wordpress.com/2009/10/02/solved-error-establishing-a-database-connection/</guid> <description><![CDATA[Many times I saw this message. &#8220;Error establishing a database connection&#8221;. That time I did not understand why this message is coming. When started working on WordPress blog Plugins, Themes. Then I got to know about this error. Whenever you mis-configured the wp-config.php file. You will this kind of error. You need to Fill following.....]]></description> <content:encoded><![CDATA[<p>Many times I saw this message. &#8220;Error establishing a database connection&#8221;. That time I did not understand why this message is coming.</p><p>When started working on WordPress blog Plugins, Themes. Then I got to know about this error.<br
/> Whenever you mis-configured the wp-config.php file. You will this kind of error.</p><p>You need to Fill following information correctly:(dont forget to create database your own)<br
/> ** The name of the database for WordPress */</p><p>define(&#8216;DB_NAME&#8217;, &#8216;wordpress&#8217;);</p><p>/** MySQL database username */</p><p>define(&#8216;DB_USER&#8217;, &#8216;root&#8217;);</p><p>/** MySQL database password */</p><p>define(&#8216;DB_PASSWORD&#8217;, &#8221;);</p><p>/** MySQL hostname */</p><p>define(&#8216;DB_HOST&#8217;, &#8216;localhost&#8217;);</p><p>This will solve your problem.</p> ]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2009/10/02/solved-error-establishing-a-database-connection/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Php Mysql Question and Answers for Interview</title><link>http://wordpressapi.com/2009/01/22/php-mysql-question-and-answers-for-interview/</link> <comments>http://wordpressapi.com/2009/01/22/php-mysql-question-and-answers-for-interview/#comments</comments> <pubDate>Thu, 22 Jan 2009 05:26:26 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[MySql]]></category> <category><![CDATA[PHP]]></category><guid
isPermaLink="false">http://purab.wordpress.com/?p=71</guid> <description><![CDATA[What is the difference between PHP4 and PHP5? PHP4 cannot support oops concepts and Zend engine 1 is used. PHP5 supports oops concepts and Zend engine 2 is used. Error supporting is increased in PHP5. XML and SQLLite will is increased in PHP5.Can we use include(abc.PHP) two times in a PHP page makeit.PHP”? Yes we.....]]></description> <content:encoded><![CDATA[<p><strong>What is the difference between PHP4 and PHP5?</strong><br
/> PHP4 cannot support oops concepts and Zend engine 1 is used.<br
/> PHP5 supports oops concepts and Zend engine 2 is used.<br
/> Error supporting is increased in PHP5.<br
/> XML and SQLLite will is increased in PHP5.Can we use include(abc.PHP) two times in a PHP page makeit.PHP”?<br
/> Yes we can include that many times we want, but here are some things to make sure of:<br
/> (including abc.PHP, the file names are case-sensitive)<br
/> there shouldn’t be any duplicate function names, means there should not be functions or classes or variables with the same name in abc.PHP and makeit.php</p><p><strong>How i can get ip address &#8211; REMOTE_ADDR &#8211; the IP address of the client</strong><br
/> REMOTE_HOST &#8211; the host address of the client, if available</p><p><strong>What is the difference between echo and print statement?</strong> &#8211; echo() can take multiple expressions,Print cannot take multiple expressions.<br
/> echo has the slight performance advantage because it doesn&#8217;t have a return value.<br
/> True, echo is a little bit faster.</p><p><strong>How we know browser properties </strong>-echo $_SERVER['HTTP_USER_AGENT'] . &#8220;&lt;hr /&gt; &#8220;;<br
/> $browser = get_browser();<br
/> foreach ($browser as $name =&gt; $value) {<br
/> echo &#8220;&lt;b&gt;$name&lt;/b&gt; $value &lt;br /&gt; &#8220;;<br
/> }</p><p><strong>How i will check that user is, logged in or not. i want to make it a function and i want to use in each page and after login i want to go in current page(same page. where i was working)</strong></p><p><strong>What is difference between require_once(), require(), include(). Becouse above three function usely use to call a file in another file.</strong><br
/> Difference between require() and require_once(): require() includes and evaluates a specific file, while require_once() does that only if it has not been included before (on the same page).<br
/> So, require_once() is recommended to use when you want to include a file where you have a lot of functions for example. This way you make sure you don&#8217;t include the file more times and you will not get the &#8220;function re-declared&#8221; error.<br
/> Difference between require() and include() is that require() produces a FATAL ERROR if the file you want to include is not found, while include() only produces a WARNING.<br
/> There is also include_once() which is the same as include(), but the difference between them is the same as the difference between require() and require_once().</p><p><strong>How do I generate a random number from-php?</strong><br
/> srand((double)microtime()*1000000);<br
/> echo rand(0,100);</p><p><strong>How do I set the browser timeout?</strong><br
/> set_time_limit(900);<br
/> this sets the timeout too 900 seconds / 15 minutes.</p><p><strong>How can I do error handling in php?</strong></p><p><strong>Is it possible to connect to a ftp server with php?</strong><br
/> Yes it is possible, you can use the ftp_connect function. (PHP 3&gt;= 3.0.13, PHP 4 &gt;= 4.0b4)</p><p><strong>How do I find out how a user came to my page?</strong><br
/> You have the variable $HTTP_REFERER which holds the page that refered to you page, if there are any referer, ie if the user enters your url directly the referer variable will be empty.</p><p><strong>How can I add text to an image?</strong><br
/> array imagettftext ( resource $image, float $size, float $angle, int $x, int $y, int $color, string $fontfile, string $text )<br
/> <strong>how to rotate an image using php code?</strong><br
/> $move90 = imagerotate($myimage,90);<br
/> //$myimage is the reference to the loaded image, eg through imagecreatefromjpeg</p><p><strong>How do I find the size of an array?</strong> –use Count function<br
/> $values = range(&#8220;A&#8221;,&#8221;Z&#8221;);<br
/> echo count($values);</p><p><strong>How do I remove escape characters from data?</strong><br
/> $data = &#8220;I\&#8217;m the king of the castle&#8221;;<br
/> echo stripslashes($data); //I&#8217;m the king of the castle</p><p><strong>What are magic quotes?</strong><br
/> Magic quotes is a configuration setting within PHP that means that all data containing a single or double quote, or NUL, will automatically be escaped with a backslash before being entered into a database.</p><p><strong>How can we encrypt the username and password using PHP?</strong></p><p><strong>What is the difference between $message and $$message?</strong><br
/> $message is a simple variable whereas $$message is a reference variable.</p><p><strong>What are the differences between DROP a table and TRUNCATE a table?</strong></p><p><strong>What’s the difference between md5(), crc32() and sha1() crypto on PHP?</strong><br
/> The major difference is the length of the hash generated. CRC32 is, evidently, 32 bits, while sha1() returns a 128 bit value, and md5() returns a 160 bit value. This is important when avoiding collisions.</p><p><strong>How to set cookies?</strong><br
/> setcookie(’variable’,&#8217;value’,&#8217;time’)<br
/> ;</p> ]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2009/01/22/php-mysql-question-and-answers-for-interview/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Important mysql quries</title><link>http://wordpressapi.com/2009/01/08/important-mysql-quries/</link> <comments>http://wordpressapi.com/2009/01/08/important-mysql-quries/#comments</comments> <pubDate>Thu, 08 Jan 2009 14:28:09 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[MySql]]></category> <category><![CDATA[mysql interview]]></category><guid
isPermaLink="false">http://purab.wordpress.com/2009/01/08/important-mysql-quries/</guid> <description><![CDATA[Taking backup of all mysql databases &#62;mysqldump -uroot -p --all-databases &#62;&#62; all_database_dump.sql; for single database mysqldump -uroot -p public_wordpressmu wp_1_posts &#62; one.sql database import from sql file mysql &#8211;verbose -uroot -p public_wordpressmu wp_1_posts &#60; one.sql Creating Trigger create trigger DROP TRIGGER wordpress.after_wp_1_post_update; delimiter // CREATE TRIGGER wordpressmu.after_wp_1_post_update AFTER UPDATE ON wordpressmu.wp_1_posts FOR EACH ROW IF.....]]></description> <content:encoded><![CDATA[<p><strong>Taking backup of all mysql databases</strong></p><pre><strong><code>&gt;mysqldump -uroot -p --all-databases</code></strong> &gt;&gt; all_database_dump.sql;</pre><h3>for single database</h3><pre>mysqldump -uroot -p public_wordpressmu wp_1_posts &gt; one.sql</pre><h3>database import from sql file</h3><p>mysql &#8211;verbose -uroot -p public_wordpressmu wp_1_posts &lt; one.sql</p><h3><strong>Creating Trigger</strong></h3><p>create trigger<br
/> DROP TRIGGER wordpress.after_wp_1_post_update;</p><p>delimiter //</p><p>CREATE TRIGGER wordpressmu.after_wp_1_post_update</p><p>AFTER UPDATE ON wordpressmu.wp_1_posts</p><p>FOR EACH ROW</p><p>IF new.post_status = &#8216;publish&#8217; THEN</p><p>INSERT INTO .article_posts (id,ref_id, title, status,<br
/> comments_on, created_at, updated_at) values (new.id,new.id,<br
/> new.post_title, new.post_status, 1, new.post_date, new.post_date);</p><p>END IF;</p><p>//</p><p>delimiter ;</p><p><strong>Insert from different table (migration)</strong></p><p>INSERT INTO database_anme.TableName(id, ref_id, title, status, comments_on, created_at, updated_at) select id, id, post_title, post_status, 1, post_date,post_date from wordpress.wp_1_posts</p><p><strong>Update multiple rows in through Sql query</strong></p><p>Update user set status=&#8221;ok&#8221; where id in (2 ,3 ,4 ,5,6)</p><p><strong>changing all post path and image path</strong><br
/> UPDATE wp_1_posts SET post_content = REPLACE(post_content, &#8216;test.siwan.com&#8217;, &#8216;www.siwan.com&#8217;);</p><p><strong>WordPress -fetching category through sql queryfrom post</strong></p><p>SELECT wp_1_term_taxonomy.taxonomy, wp_1_term_relationships.object_id, wp_1_terms.name, wp_1_posts.post_title<br
/> FROM wp_1_posts INNER JOIN ((wp_1_terms INNER JOIN wp_1_term_taxonomy ON wp_1_terms.term_id = wp_1_term_taxonomy.term_id) INNER JOIN wp_1_term_relationships ON wp_1_term_taxonomy.term_taxonomy_id = wp_1_term_relationships.term_taxonomy_id) ON wp_1_posts.ID = wp_1_term_relationships.object_id<br
/> WHERE wp_1_term_taxonomy.taxonomy=&#8217;category&#8217; and wp_1_term_relationships.object_id=&#8217;217&#8242;<br
/> ORDER BY wp_1_term_relationships.object_id ;</p> ]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2009/01/08/important-mysql-quries/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> <item><title>Getting Information about Databases and Tables</title><link>http://wordpressapi.com/2008/02/15/getting-information-about-databases-and-tables/</link> <comments>http://wordpressapi.com/2008/02/15/getting-information-about-databases-and-tables/#comments</comments> <pubDate>Fri, 15 Feb 2008 07:22:36 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[MySql]]></category> <category><![CDATA[databases]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[tables]]></category><guid
isPermaLink="false">http://purab.wordpress.com/?p=22</guid> <description><![CDATA[MySQL provides a SHOW statement that has several variant forms that display information about databases and the tables in them. SHOW is helpful for keeping track of the contents of your databases and for reminding yourself about the structure of your tables. You can also use SHOW prior to issuing ALTER TABLE; it&#8217;s often easier.....]]></description> <content:encoded><![CDATA[<p>MySQL provides a <tt>SHOW</tt> statement that has several variant forms that display information about databases and the tables in them. <tt>SHOW</tt> is helpful for keeping track of the contents of your databases and for reminding yourself about the structure of your tables. You can also use <tt>SHOW</tt> prior to issuing <tt>ALTER TABLE</tt>; it&#8217;s often easier to figure out how to specify a change to a column after you determine the column&#8217;s current definition.</p><p>The <tt>SHOW</tt> statement can be used to obtain information about several aspects of your databases and tables:</p><ul><li>List the databases managed by the server:<pre>SHOW DATABASES;</pre></li><li>List the tables in the current database or in a given database:<pre>SHOW TABLES;
SHOW TABLES FROM <i>db_name</i>;</pre></li><li> Note that <tt>SHOW TABLES</tt> doesn&#8217;t show <tt>TEMPORARY</tt> tables.</li><li>Display information about columns or indexes in a table:<pre>SHOW COLUMNS FROM <i>tbl_name</i>;
SHOW INDEX FROM <i>tbl_name</i>;</pre></li><li> The <tt>DESCRIBE <i>tbl_name</i></tt> and <tt>EXPLAIN <i>tbl_name</i></tt> statements are synonymous with <tt>SHOW COLUMNS FROM <i>tbl_name</i></tt>.</li><li>Display descriptive information about tables in the current database or        in a given database:<pre>SHOW TABLE STATUS;
SHOW TABLE STATUS FROM <i>db_name</i>;</pre></li><li> This statement was introduced in MySQL 3.23.0.</li><li>Display the <tt>CREATE TABLE</tt> statement that corresponds to the current        structure of a table:<pre>SHOW CREATE TABLE <i>tbl_name</i>;</pre></li><li> This statement was introduced in MySQL 3.23.20.</li></ul><p>Several forms of <tt>SHOW</tt> take a <tt>LIKE '<i>pat</i>'</tt> clause allowing a pattern to be given that limits the scope of the output. <tt>'<i>pat</i>'</tt> is interpreted as a SQL pattern that can include the &#8216;<tt>%</tt>&#8216; and &#8216;<tt>_</tt>&#8216; wildcard characters. For example, the following statement displays the names of tables in the current database that begin with <tt>'geo'</tt>:</p><pre>SHOW TABLES LIKE 'geo%';</pre><p>To match a literal instance of a wildcard character in a <tt>LIKE</tt> pattern, precede it with a backslash. Generally, this is done to match a literal &#8216;<tt>_</tt>&#8216;, which occurs frequently in database, table, and column names.</p><p>The <tt>mysqlshow</tt> command provides some of the same information as the <tt>SHOW</tt> statement, which allows you to get database and table information from the shell:</p><ul><li>List databases managed by the server:<pre>% <b>mysqlshow</b></pre></li><li>List tables in the named database:<pre>% <b>mysqlshow</b> <i>db_name</i></pre></li><li>Display information about columns in the named table:<pre>% <b>mysqlshow</b> <i>db_name tbl_name</i></pre></li><li>Display information about indexes in the named table:<pre>% <b>mysqlshow --keys</b> <i>db_name tbl_name</i></pre></li><li>Display descriptive information about tables in the named database:<pre>% <b>mysqlshow --status </b><i>db_name</i></pre></li></ul><p>The <tt>mysqldump</tt> utility allows you to see the structure of your tables in the form of a <tt>CREATE TABLE</tt> statement (much like <tt>SHOW CREATE TABLE</tt>). When using <tt>mysqldump</tt> to review table structure, be sure to invoke it with the <tt>--no-data</tt> option so that you don&#8217;t get swamped with your table&#8217;s data!</p><pre>% <b>mysqldump --no-data</b> <i>db_name tbl_name</i></pre><p>If you omit the table name, <tt>mysqldump</tt> displays the structure for all tables in the database.</p><p>For both <tt>mysqlshow</tt> and <tt>mysqldump</tt>, you can specify the usual connection parameter options (such as <tt>--host</tt> or <tt>--user</tt>.)</p><h3>Determining Which Table Types Your Server Supports</h3><p>ISAM is the only type available before MySQL 3.23. From 3.23 on, MyISAM, MERGE, and HEAP are always available, and availability of the other types can be assessed by means of an appropriate <tt>SHOW</tt> <tt>VARIABLES</tt> statement:</p><pre>SHOW VARIABLES LIKE 'have_isam';
SHOW VARIABLES LIKE 'have_bdb';
SHOW VARIABLES LIKE 'have_inno%';</pre><p>If the output from the query shows that the variable has a value of <tt>YES</tt>, the corresponding table handler is enabled. If the value is something else or there is no output, the handler is unavailable. The use of the pattern <tt>have_inno%</tt> to determine InnoDB availability matches both <tt>have_innodb</tt> and <tt>have_innobase</tt>. (The latter form was used in MySQL 3.23.30 to 3.23.36 before being renamed to <tt>have_innodb</tt>.)</p><p>You can use table type information to determine whether your server supports transactions. BDB and InnoDB are the two transaction-safe table types, so check whether their handlers are enabled as described in the preceding discussion.</p><p>As of MySQL 4.1, the list of table types is available directly through the <tt>SHOW TABLE TYPES</tt> statement:</p><pre>mysql&gt; <b>SHOW TABLE TYPES;</b>
+--------+---------+-----------------------------------------------------------+
| Type   | Support | Comment                                                   |
+--------+---------+-----------------------------------------------------------+
| MyISAM | DEFAULT | Default type from 3.23 with great performance             |
| HEAP   | YES     | Hash based, stored in memory, useful for temporary tables |
| MERGE  | YES     | Collection of identical MyISAM tables                     |
| ISAM   | YES     | Obsolete table type; Is replaced by MyISAM                |
| InnoDB | YES     | Supports transactions, row-level locking and foreign keys |
| BDB    | YES     | Supports transactions and page-level locking              |
+--------+---------+-----------------------------------------------------------+</pre><p>The <tt>Support</tt> value is <tt>YES</tt> or <tt>NO</tt> to indicate that the handler is or is not available, <tt>DISABLED</tt> if the handler is present but turned off, or <tt>DEFAULT</tt> for the table type that the server uses by default. The handler designated as <tt>DEFAULT</tt> should be considered available.</p><h3>Checking a Table&#8217;s Existence or Type</h3><p>It&#8217;s sometimes useful to be able to tell from within an application whether or not a given table exists. You can use <tt>SHOW TABLES</tt> to find out:</p><pre>SHOW TABLES LIKE '<i>tbl_name</i>';
SHOW TABLES FROM <i>db_name</i> LIKE '<i>tbl_name</i>';</pre><p>If the <tt>SHOW</tt> statement lists information for the table, it exists. It&#8217;s also possible to determine table existence with either of the following statements:</p><pre>SELECT COUNT(*) FROM tbl_name;
SELECT * FROM tbl_name WHERE 0;</pre><p>Each statement succeeds if the table exists and fails if it doesn&#8217;t. The first statement is most appropriate for MyISAM and ISAM tables, for which <tt>COUNT(*)</tt> with no <tt>WHERE</tt> clause is highly optimized. (It&#8217;s not so good for InnoDB or BDB tables, which require a full scan to count the rows.) The second statement is more general because is runs quickly for any table type. Use of these queries is most suitable for use within application programming languages, such as Perl or PHP, because you can test the success or failure of the query and take action accordingly. They&#8217;re not especially useful in a batch script that you run from <tt>mysql</tt> because you can&#8217;t do anything if an error occurs except terminate (or ignore the error, but then there&#8217;s obviously no point in running the query at all).</p><p>To determine the type of a table, you can use <tt>SHOW TABLE STATUS</tt> as of MySQL 3.23.0 or <tt>SHOW CREATE TABLE</tt> as of MySQL 3.23.20. The output from both statements includes a table type indicator. For versions older than 3.23.0, neither statement is available; but then the only available table type is ISAM, so there is no ambiguity about what storage format your tables use.</p> ]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2008/02/15/getting-information-about-databases-and-tables/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Mysql table types</title><link>http://wordpressapi.com/2008/02/15/mysql-table-types/</link> <comments>http://wordpressapi.com/2008/02/15/mysql-table-types/#comments</comments> <pubDate>Fri, 15 Feb 2008 07:22:22 +0000</pubDate> <dc:creator>Sony</dc:creator> <category><![CDATA[MySql]]></category> <category><![CDATA[database]]></category> <category><![CDATA[table]]></category> <category><![CDATA[types]]></category><guid
isPermaLink="false">http://purab.wordpress.com/?p=21</guid> <description><![CDATA[As of MySQL 4.1, the list of table types is available directly through the SHOW TABLE TYPES statement: mysql&#62; SHOW TABLE TYPES; +--------+---------+-----------------------------------------------------------+ &#124; Type &#124; Support &#124; Comment &#124; +--------+---------+-----------------------------------------------------------+ &#124; MyISAM &#124; DEFAULT &#124; Default type from 3.23 with great performance &#124; &#124; HEAP &#124; YES &#124; Hash based, stored in memory, useful.....]]></description> <content:encoded><![CDATA[<p>As of MySQL 4.1, the list of table types is available directly through the <tt>SHOW TABLE TYPES</tt> statement:</p><pre>mysql&gt; <b>SHOW TABLE TYPES;</b>
+--------+---------+-----------------------------------------------------------+
| Type   | Support | Comment                                                   |
+--------+---------+-----------------------------------------------------------+
| MyISAM | DEFAULT | Default type from 3.23 with great performance             |
| HEAP   | YES     | Hash based, stored in memory, useful for temporary tables |
| MERGE  | YES     | Collection of identical MyISAM tables                     |
| ISAM   | YES     | Obsolete table type; Is replaced by MyISAM                |
| InnoDB | YES     | Supports transactions, row-level locking and foreign keys |
| BDB    | YES     | Supports transactions and page-level locking              |
+--------+---------+-----------------------------------------------------------+</pre>]]></content:encoded> <wfw:commentRss>http://wordpressapi.com/2008/02/15/mysql-table-types/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (user agent is rejected)
Database Caching 132/190 queries in 1.207 seconds using disk

Served from: wordpressapi.com @ 2010-09-09 21:17:35 -->