<?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>Linux, Programming, Telephony, Asterisk, Apache, Tips &#38; Tricks &#187; Mysql</title>
	<atom:link href="http://shahidz.com/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://shahidz.com</link>
	<description>Passionate About Technology</description>
	<lastBuildDate>Wed, 18 Aug 2010 07:03:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>moving mysql data directory</title>
		<link>http://shahidz.com/moving-mysql-data-directory/</link>
		<comments>http://shahidz.com/moving-mysql-data-directory/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 17:38:11 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[Securities]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://shahidz.com/?p=104</guid>
		<description><![CDATA[In some cases you have to change the default MySql data directory, for doing this you have to follow some steps. Here I will explain each steps one by one.

Stop MySql server using following command.
$ sudo /etc/init.d/mysql stop
Copy the existing data directory (which is located in /var/lib/mysql) using following command.
$ sudo cp -R -p /var/lib/mysql /path/to/new/datadir
Edit [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://shahidz.com/wp-content/uploads/2010/01/logo-mysql-300x218.jpg"><img class="alignleft size-full wp-image-117" title="logo-mysql-300x218" src="http://shahidz.com/wp-content/uploads/2010/01/logo-mysql-300x218.jpg" alt="" width="300" height="218" /></a>In some cases you have to change the default MySql data directory, for doing this you have to follow some steps. Here I will explain each steps one by one.</p>
<ol>
<li>Stop MySql server using following command.</li>
<pre>$ sudo /etc/init.d/mysql stop</pre>
<li>Copy the existing data directory (which is located in <em>/var/lib/mysql</em>) using following command.</li>
<pre>$ sudo cp -R -p /var/lib/mysql /path/to/new/datadir</pre>
<li>Edit the MySQL configuration file with your favorite text editor.</li>
<pre>$ sudo vim /etc/mysql/my.cnf</pre>
<li>Find the entry for <em>datadir</em>, change the path to the new data directory.</li>
<li>Some Linux distributions uses some security software called <strong>AppArmor </strong>that specifies the areas of your filesystem applications are allowed to access. Unless you modify the AppArmor profile for MySQL, you&#8217;ll never be able to restart MySQL with the new datadir location. So edit the file <em>/etc/apparmor.d/usr.sbin.mysqld</em> using your favorite editor.</li>
<pre>$ sudo vim /etc/apparmor.d/usr.sbin.mysqld</pre>
<li>Duplicate the lines beginning with <em>/var/lib/mysql</em> and replace duplicated strings with /<em>new_datadir.</em></li>
<pre><em>/var/lib/mysql/ r,
/var/lib/mysql/** rwk,
/var/log/mysql/ r,
/var/log/mysql/* rw,
#
/path/to/new/datadir r,
/path/to/new/datadir** rwk,
/path/to/new/datadir r,
/path/to/new/datadir* rw,</em></pre>
<li>Restart the AppArmor profiles with the following command.</li>
<pre>$ sudo /etc/init.d/apparmor restart</pre>
<li>Restart the MySql server with the following command.</li>
<pre>$ sudo /etc/init.d/mysql start</pre>
</ol>
<p>MySQL should now start without any errors and your data will be stored in the new location.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Fmoving-mysql-data-directory%2F&amp;linkname=moving%20mysql%20data%20directory"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/moving-mysql-data-directory/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>mysql-proxy: error while loading shared libraries: libmysql-proxy.so.0 or libmysql-chassis.so</title>
		<link>http://shahidz.com/mysql-proxy-error-while-loading-shared-libraries-libmysql-proxyso0-or-libmysql-chassisso/</link>
		<comments>http://shahidz.com/mysql-proxy-error-while-loading-shared-libraries-libmysql-proxyso0-or-libmysql-chassisso/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 08:06:32 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Mysql]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[lua]]></category>
		<category><![CDATA[mysql-proxy]]></category>

		<guid isPermaLink="false">http://shahidz.com/?p=108</guid>
		<description><![CDATA[Getting the below errors:
$ ./agent/sbin/mysql-proxy -V
mysql-proxy: error while loading shared libraries: libmysql-chassis.so.0: cannot open shared object file: No such file or directory
mysql-proxy: error while loading shared libraries: libmysql-proxy.so.0: cannot open shared object file: No such file or directory
The error occurred because the mysql-proxy can&#8217;t find the library files needed for it. So copy the needed [...]]]></description>
			<content:encoded><![CDATA[<p>Getting the below errors:</p>
<pre>$ ./agent/sbin/mysql-proxy -V
mysql-proxy: error while loading shared libraries: libmysql-chassis.so.0: cannot open shared object file: No such file or directory
mysql-proxy: error while loading shared libraries: libmysql-proxy.so.0: cannot open shared object file: No such file or directory</pre>
<p>The error occurred because the mysql-proxy can&#8217;t find the library files needed for it. So copy the needed files to necessary directory.</p>
<pre> $ sudo cp /usr/local/lib/libmysql-* /usr/lib/i486-linux-gnu/
 $ mysql-proxy -V
  mysql-proxy 0.7.2
  glib2: 2.20.1
  libevent: 1.3e
  lua: Lua 5.1.4
    LUA_PATH: /usr/local/lib/mysql-proxy/lua/?.lua
    LUA_CPATH: /usr/local/lib/mysql-proxy/lua/?.so
  == plugins ==
  admin: 0.7.0
  proxy: 0.7.0
</pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Fmysql-proxy-error-while-loading-shared-libraries-libmysql-proxyso0-or-libmysql-chassisso%2F&amp;linkname=mysql-proxy%3A%20error%20while%20loading%20shared%20libraries%3A%20libmysql-proxy.so.0%20or%20libmysql-chassis.so"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/mysql-proxy-error-while-loading-shared-libraries-libmysql-proxyso0-or-libmysql-chassisso/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting Up the world Database (Countries, States, Cites, etc)</title>
		<link>http://shahidz.com/setting-up-the-world-database-countries-states-cites-etc/</link>
		<comments>http://shahidz.com/setting-up-the-world-database-countries-states-cites-etc/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 06:04:19 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Mysql]]></category>
		<category><![CDATA[]]></category>
		<category><![CDATA[cities]]></category>
		<category><![CDATA[countris]]></category>
		<category><![CDATA[district]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[population]]></category>
		<category><![CDATA[states]]></category>

		<guid isPermaLink="false">http://shahidz.com/setting-up-the-world-database-countries-states-cites-etc/</guid>
		<description><![CDATA[In certain applications we need the details of all the counties in the world, all the states in in each country and the capital of all the country.  And it is difficult to create all theses information&#8217;s manually. But mysql provide a file world.sql which contains sample data for a     world [...]]]></description>
			<content:encoded><![CDATA[<p>In certain applications we need the details of all the counties in the world, all the states in in each country and the capital of all the country.  And it is difficult to create all theses information&#8217;s manually. But mysql provide a file <font color="#800080"><code class="filename">world.sql</code></font> which contains sample data for a     <code class="literal">world</code> database that you can play with. This file contains names of all the Countries in the world, States, Cities, etc.  The file     is available for download from the mysql site <a href="http://dev.mysql.com/doc" target="_blank">http://dev.mysql.com/doc</a>. For more details about <font color="#800080">world.sql</font> visit the site <a href="http://dev.mysql.com/doc/world-setup/en/world-setup.html" target="_blank">http://dev.mysql.com/doc/world-setup/en/world-setup.html</a>.</p>
<p>To load the contents of the <code class="filename">world.sql</code> file into     MySQL, use the following procedure:</p>
<ol type="1">
<li>         Change directory to where the <code class="filename">world.sql</code>         file is locatedIf your current directory is not the same as the location of the         <code class="filename">world.sql</code> file, use a <span><strong class="command">cd</strong></span>         command to change location.</li>
<li>         Connect to the MySQL server using the <span><strong class="command">mysql</strong></span>         programAt your command-line prompt, issue this command:
<pre class="programlisting">shell&gt; <strong class="userinput"><code>mysql -u root</code></strong></pre>
<p>This command connects to the server using the MySQL         <code class="literal">root</code> account to make sure that you&#8217;ll have         permission to create the <code class="literal">world</code> database. The         <code class="option">--p</code> option tells <span><strong class="command">mysql</strong></span> to         prompt you for the <code class="literal">root</code> password. Enter the         password when prompted. (Remember that the MySQL         <code class="literal">root</code> account is not the same as the operating         system <code class="literal">root</code> account and probably will have a         different password.)</li>
</ol>
<ol type="1">
<li value="3">         Create the <code class="literal">world</code> database and select it as         the default database:In the <span><strong class="command">mysql</strong></span> program, issue the following         statements:
<pre class="programlisting">mysql&gt; <strong class="userinput"><code>CREATE DATABASE world;</code></strong>
mysql&gt; <strong class="userinput"><code>USE world</code></strong></pre>
</li>
<li>         Load the contents of <code class="filename">world.sql</code> into the         <code class="literal">world</code> databaseIssue a <code class="literal">SOURCE</code> command to tell         <span><strong class="command">mysql</strong></span> to read and process the contents of         <code class="filename">world.sql</code>:
<pre class="programlisting">mysql&gt; <strong class="userinput"><code>SOURCE world.sql</code></strong></pre>
<p>You&#8217;ll see quite a bit of output as <span><strong class="command">mysql</strong></span>         reads queries from the <code class="filename">world.sql</code> file and         executes them.</li>
</ol>
<p>After <span><strong class="command">mysql</strong></span> finishes processing the     <code class="filename">world.sql</code> file, try this statement:</p>
<pre class="programlisting">mysql&gt; <strong class="userinput"><code>SHOW TABLES;</code></strong>
+-----------————————--------------+
| Tables_in_world |
+-----------————————--------------+
| City            |
| Country         |
| CountryLanguage |
+-----------————————--------------+</pre>
<p class="itemizedlist">The <code class="literal">world</code> tables contain the following types of     information:</p>
<ul>
<li>         <code class="literal">Country</code>: Information about countries of the         world.</li>
<li>         <code class="literal">City</code>: Information about some of the cities in         those countries.</li>
<li>         <code class="literal">CountryLanguage</code>: Languages spoken in each         country.</li>
</ul>
<p>To see what columns each table contains, use     <code class="literal">DESCRIBE</code>. For example:</p>
<pre class="programlisting">mysql&gt; <strong class="userinput"><code>DESCRIBE Country;</code></strong>
mysql&gt; <strong class="userinput"><code>DESCRIBE City;</code></strong>
mysql&gt; <strong class="userinput"><code>DESCRIBE CountryLanguage</code></strong></pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Fsetting-up-the-world-database-countries-states-cites-etc%2F&amp;linkname=Setting%20Up%20the%20world%20Database%20%28Countries%2C%20States%2C%20Cites%2C%20etc%29"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/setting-up-the-world-database-countries-states-cites-etc/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Monitoring services using Mon</title>
		<link>http://shahidz.com/mon/</link>
		<comments>http://shahidz.com/mon/#comments</comments>
		<pubDate>Sun, 29 Jun 2008 12:09:27 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mysql]]></category>

		<guid isPermaLink="false">http://shahidz.com/mon/</guid>
		<description><![CDATA[Monitoring services using Mon
mon is a general-purpose scheduler and alert management tool used for monitoring service availability and
triggering alerts upon failure detection.
Mon uses some Linux command and services such as ping command to check host connectivity and mail servers for sending mail, so you must install postfix and other packages so that mon should work [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Monitoring services using Mon</strong></p>
<p>mon is a general-purpose scheduler and alert management tool used for monitoring service availability and<br />
triggering alerts upon failure detection.</p>
<p>Mon uses some Linux command and services such as ping command to check host connectivity and mail servers for sending mail, so you must install postfix and other packages so that mon should work smoothly.</p>
<p><strong>Installing and configuring Mon in Ubuntu </strong></p>
<p>Now we will see how we can install and configure mon in Ubuntu.</p>
<p><strong>Install process</strong></p>
<pre>$ sudo apt-get install mon</pre>
<p><strong>Start mon </strong></p>
<pre>$ sudo /etc/init.d/mon start</pre>
<p><strong>Configuring Mon </strong></p>
<p>For configuring mon edit the configuration file <strong>/etc/mon/mon.cf</strong></p>
<pre>hostgroup servers 192.168.1.6  #There must be a one line gape after hostgroup line.

watch servers
    service ping
        interval 1m
        monitor fping.monitor
        period wd {Mon-Fri} hr {7am-10pm}
            alert mail.alert user@example.com
            alertevery 3m
        period wd {Sat-Sun}
            alert mail.alert user@example.com</pre>
<p>First we define the hosts that we want to monitor. Then we create the a &#8220;watch&#8221; section for this hosts with only one service to monitor, the <strong>&#8220;ping&#8221;</strong> service. The service will be monitored using the monitor <strong>&#8220;fping.monitor&#8221;</strong> that you can find in &#8220;<strong>/usr/lib/mon/mon.d/fping.monitor&#8221;</strong>. Then we define the periods in which we want to monitor the hosts and the alert we will use if the monitor detects a fail. In this case we use the <strong>&#8220;mail.alert&#8221;</strong> agent that you can find in <strong>&#8220;/usr/lib/mon/alert.d/mail.alert&#8221;</strong>. An email to &#8220;user@example.com&#8221; will be sent if a fail is detected in the monitor.</p>
<p>Sample example for configuring mon for monitoring a host connectivity, mysql, apache and a web page.</p>
<pre>hostgroup ping_services 192.168.1.6

hostgroup webservers itswork.com

hostgroup mysql_server localhost

hostgroup apache_service 192.168.1.6

watch ping_services
service ping
    interval 1m
    monitor fping.monitor
    period wday {Mon-Sun} hour {0-23}
        alert mail.alert user@example.com
        alertevery 1m

watch webservers example.com
service site
        interval 1m
        monitor http.monitor -p 80 -u /index.php
        period wday{Mon-Sun} hr {0am-24pm}
            alert mail.alert user@example.com

watch apache_service 192.168.1.6
service apache
        interval 1m
        monitor http.monitor
        period wday{Mon-Sun} hr {0am-24pm}
            alert mail.alert user@example.com

watch mysql_server
    service mysql
        interval 1m
        monitor mysql.monitor --username=mon --password=mon --database=mon localhost
        period wday {Mon-Sun}
            alert mail.alert -S "Host 1 Mysql Server is down!!" user@example.com
            upalert mail.alert -S "Host1 MYSQL server is back up" user@example.com
            alertevery 60s
            alertafter 3</pre>
<p>For more help click <a href="http://www.us.kernel.org/pub/software/admin/mon/html/man/mon.html" target="_blank">here</a></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Fmon%2F&amp;linkname=Monitoring%20services%20using%20Mon"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/mon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Logging into Mysql without Password</title>
		<link>http://shahidz.com/logging-into-mysql-without-password/</link>
		<comments>http://shahidz.com/logging-into-mysql-without-password/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 07:26:02 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[mysql password]]></category>
		<category><![CDATA[mysqld_safe]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[recovering mysql password]]></category>

		<guid isPermaLink="false">http://shahidz.com/logging-into-mysql-without-password/</guid>
		<description><![CDATA[Recovering MySQL Password and Permission Problems
If you garble your GRANT commands or forget passwords and find that you don&#8217;t have access to the critical mysql table even as the root user don&#8217;t panic. You can access MySQL without password. Superuser can access MySQL using  mysqld_safe command and you can change mysql password. Become the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Recovering MySQL Password and Permission Problems</strong></p>
<p>If you garble your GRANT commands or forget passwords and find that you don&#8217;t have access to the critical mysql table even as the root user don&#8217;t panic. You can access MySQL without password. Superuser can access MySQL using  <strong>mysqld_safe </strong>command and you can change mysql password. Become the superuser on the operating system (we&#8217;re talking now about the Unix root, not the MySQL root) and kill the MySQL process.</p>
<p><strong> Step : 1</strong></p>
<p>Stop MySQL server</p>
<pre>shahid@shahid:~$ sudo /etc/init.d/mysql stop
[sudo] password for shahid:
 * Stopping MySQL database server mysqld                                 [ OK ]
shahid@shahid:~$</pre>
<p><strong>Step : 2</strong></p>
<p>Make sure MySQL is was not running</p>
<pre>shahid@shahid:~$ ps aux | grep mysql
shahid   18751  0.0  0.0   3004   756 pts/5    S+   11:54   0:00 grep mysql
shahid@shahid:~$</pre>
<p><strong>Step : 3</strong></p>
<p>Start Mysql using mysqld_safe</p>
<pre>shahid@shahid:~$ sudo mysqld_safe --skip-grant-tables
nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[19285]: started</pre>
<p><strong>Step : 4</strong></p>
<p>Make sure you can now get access to the <strong>mysql</strong> database:</p>
<pre>shahid@shahid:~$ mysql mysql
mysql&gt;</pre>
<p>Assign a password once again to the MySQL root user:</p>
<pre>mysql&gt; UPDATE mysql.user SET Password=PASSWORD('newpassword') WHERE User='root' AND Host='localhost';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0
mysql&gt; FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql&gt;</pre>
<p><strong>Step : 5</strong></p>
<p>Terminate the MySQL server and restart it in the usual way. Make any necessary changes to the privileges through GRANT commands, running mysql as the root user.</p>
<pre>shahid@shahid:~$ sudo /etc/init.d/mysql start
 * Starting MySQL database server mysqld                                 [ OK ]
 * Checking for corrupt, not cleanly closed and upgrade needing tables.
shahid@shahid:~$</pre>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Flogging-into-mysql-without-password%2F&amp;linkname=Logging%20into%20Mysql%20without%20Password"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/logging-into-mysql-without-password/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to setup Memcached server</title>
		<link>http://shahidz.com/how-to-setup-memcached-server/</link>
		<comments>http://shahidz.com/how-to-setup-memcached-server/#comments</comments>
		<pubDate>Sun, 01 Jun 2008 10:04:12 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://shahidz.com/?p=27</guid>
		<description><![CDATA[Introduction
Memcached is a high-performance, distributed caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in memory to reduce the number of times the database must be read.
Installing memcached
shahid@shahid-laptop:~$ sudo apt-get install memcached
shahid@shahid-laptop:~$ sudo apt-get install php5-memcache
After installing these two packages next step is to configure memcached.conf file. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>Memcached is a high-performance, distributed caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in <span class="mw-redirect">memory</span> to reduce the number of times the database must be read.</p>
<p><strong>Installing memcached</strong></p>
<pre>shahid@shahid-laptop:~$ sudo apt-get install memcached
shahid@shahid-laptop:~$ sudo apt-get install php5-memcache</pre>
<p>After installing these two packages next step is to configure memcached.conf file. ( /etc/memcached.conf )<a href="http://shahidz.com/wp-content/uploads/2008/06/memcached.txt" title="Memcached.conf">Memcached.conf</a></p>
<p>After that edit the memecached.ini file. ( /etc/php5/apache2/conf.d/memcache.ini )</p>
<p>A sample memcache.ini file</p>
<pre>; uncomment the next line to enable the module
extension=memcache.so
[memcache]
memcache.dbpath="/var/lib/memcache"
memcache.maxreclevel=0
memcache.maxfiles=0
memcache.archivememlim=0
memcache.maxfilesize=0
memcache.maxratio=0
session.save_handler = memcache
session.save_path = "tcp://192.168.1.1:11211?weight=1,tcp://192.168.1.2:11211"</pre>
<p>There are some situations where you want to store instances of memcache on two servers. On this situaltion you want to set &#8217;session.save_path&#8217; as in the above example as comma separated.After that start memcached</p>
<pre>shahid@shahid-laptop:~$ memcached -d   ==&gt; Start memcache as a background process</pre>
<pre>shahid@shahid-laptop:~$ memcached -vv ==&gt; Start memcached as a foreground process</pre>
<p>For testing memcached you can start memcached using -vv option . If you start memcached using -vv option you can see stroing session on memcache on the terminal.</p>
<pre>shahid@shahid-laptop:~$ memcached -vv
slab class   1: chunk size     96 perslab 10922
slab class   2: chunk size    120 perslab  8738
slab class   3: chunk size    152 perslab  6898
slab class   4: chunk size    192 perslab  5461
slab class   5: chunk size    240 perslab  4369
slab class   6: chunk size    304 perslab  3449
slab class   7: chunk size    384 perslab  2730
slab class   8: chunk size    480 perslab  2184
slab class   9: chunk size    600 perslab  1747
slab class  10: chunk size    752 perslab  1394
slab class  11: chunk size    944 perslab  1110
slab class  12: chunk size   1184 perslab   885
slab class  13: chunk size   1480 perslab   708
slab class  14: chunk size   1856 perslab   564
slab class  15: chunk size   2320 perslab   451
slab class  16: chunk size   2904 perslab   361
slab class  17: chunk size   3632 perslab   288
slab class  18: chunk size   4544 perslab   230
slab class  19: chunk size   5680 perslab   184
slab class  20: chunk size   7104 perslab   147
slab class  21: chunk size   8880 perslab   118
slab class  22: chunk size  11104 perslab    94
slab class  23: chunk size  13880 perslab    75
slab class  24: chunk size  17352 perslab    60
slab class  25: chunk size  21696 perslab    48
slab class  26: chunk size  27120 perslab    38
slab class  27: chunk size  33904 perslab    30
slab class  28: chunk size  42384 perslab    24
slab class  29: chunk size  52984 perslab    19
slab class  30: chunk size  66232 perslab    15
slab class  31: chunk size  82792 perslab    12
slab class  32: chunk size 103496 perslab    10
slab class  33: chunk size 129376 perslab     8
slab class  34: chunk size 161720 perslab     6
slab class  35: chunk size 202152 perslab     5
slab class  36: chunk size 252696 perslab     4
slab class  37: chunk size 315872 perslab     3
slab class  38: chunk size 394840 perslab     2
slab class  39: chunk size 493552 perslab     2
&lt;3 server listening
&lt;7 new client connection
&lt;7 get 190c562b24186ff47914309b3ceaab95
&gt;7 END
&lt;7 set 190c562b24186ff47914309b3ceaab95 0 1440 0
&gt;7 STORED
&lt;7 connection closed.
&lt;7 new client connection
&lt;7 get 8c1f38e6f02939cea6a6563049e216c8
&gt;7 END
&lt;8 new client connection
&lt;8 get 7925615c1ab9933cb33af0121881a82b
&gt;8 END</pre>
<p>Another method for checking whether memcached was enamble or not is to check the phpinfo() function. In the phpinfo page should contain memcache module.</p>
<p><a href="http://shahidz.com/wp-content/uploads/2008/06/screenshot.png" title="Memcache module"><img src="http://shahidz.com/wp-content/uploads/2008/06/screenshot.png" alt="Memcache module" /></a></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Fhow-to-setup-memcached-server%2F&amp;linkname=How%20to%20setup%20Memcached%20server"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/how-to-setup-memcached-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Backuping &amp; Restoring using mysqldump &amp; mysqlhotcopy</title>
		<link>http://shahidz.com/backuping-restoring-using-mysqldump-mysqlhotcopy/</link>
		<comments>http://shahidz.com/backuping-restoring-using-mysqldump-mysqlhotcopy/#comments</comments>
		<pubDate>Wed, 12 Mar 2008 04:38:00 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Linux Commands]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[backups]]></category>
		<category><![CDATA[mysql backups]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[mysqlhotcopy]]></category>

		<guid isPermaLink="false">http://shahidz.com/?p=15</guid>
		<description><![CDATA[Using mysqldump
Using &#8216;mysqldump&#8217; command you can take the mysql database backup. This command all the datas to a text file.
The syntax is
shell&#62; mysqldump [options] db_name [tables]
shell&#62; mysqldump [options] –databases db_name1 [db_name2 db_name3…]
shell&#62; mysqldump [options] –all-databases
Backuping Examples:
shell&#62; mysqldump -u root -p dbaseName &#62; file.sql;
shell&#62; Enter the password
Restoring Example:
Suppose, we have the database as file.sql, and we [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Using mysqldump</strong></p>
<p>Using &#8216;mysqldump&#8217; command you can take the mysql database backup. This command all the datas to a text file.</p>
<p>The syntax is</p>
<p>shell&gt; mysqldump [options] db_name [tables]<br />
shell&gt; mysqldump [options] –databases db_name1 [db_name2 db_name3…]<br />
shell&gt; mysqldump [options] –all-databases</p>
<p>Backuping Examples:</p>
<p>shell&gt; mysqldump -u root -p dbaseName &gt; file.sql;</p>
<p>shell&gt; Enter the password</p>
<p>Restoring Example:</p>
<p>Suppose, we have the database as file.sql, and we want to load it to the database, we can use &#8216;mysql&#8217; command to restore the database.</p>
<p>shell&gt; mysql -u root -p passwod dbaseName &lt; file.sql</p>
<p>shell&gt; Enter the password</p>
<p>Before executing this, make sure you are in the bin folder of mysql</p>
<p><strong>Using mysqlhotcopy</strong></p>
<p>Syntax:<br />
shell&gt;  mysqlhotcopy -u user <username> -p password dbname</p>
<password> <database> /backup/location/</database></password></username></p>
<p>Backuping Examples:<br />
shell&gt;  mysqlhotcopy -u user -p password mydb1 mydb2 /backup/location/</p>
<p>This will create a directory with the database name called ‘mydb1’ and &#8216;mydb2&#8242; in /backup/location/’</p>
<p>Restoring Example:<br />
To restore the backup you have to stop mysql using<br />
shell&gt; /etc/init.d/mysql stop</p>
<p>Then you have to copy the database backup file which is in the backup directory to the original mysql director which is ‘/var/lib/mysql/mysql1’</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Fbackuping-restoring-using-mysqldump-mysqlhotcopy%2F&amp;linkname=Backuping%20%26%23038%3B%20Restoring%20using%20mysqldump%20%26%23038%3B%20mysqlhotcopy"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/backuping-restoring-using-mysqldump-mysqlhotcopy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
