<?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 Admin Zone &#187; mysql</title>
	<atom:link href="http://linuxadminzone.com/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://linuxadminzone.com</link>
	<description>Adding more reasons to celebrate Open Source.</description>
	<lastBuildDate>Wed, 09 May 2012 10:17:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Fix mysql memory table error: The table xtable is full</title>
		<link>http://linuxadminzone.com/fix-mysql-memory-table-error-the-table-xtable-is-full/</link>
		<comments>http://linuxadminzone.com/fix-mysql-memory-table-error-the-table-xtable-is-full/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 08:34:55 +0000</pubDate>
		<dc:creator>jagbir</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[memory table]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://linuxadminzone.com/?p=474</guid>
		<description><![CDATA[Replication just stopped in one Slave server with error: The table xtable is full which means no more records are permitted to insert in this table by MySQL and hence this has broken the replication. I checked that xtable is having storage engine as Memory. In such tables, the max. no. of records you can [...]]]></description>
			<content:encoded><![CDATA[<p>Replication just stopped in one Slave server with error: The table xtable is full which means no more records are permitted to insert in this table by MySQL and hence this has broken the replication. </p>
<p>I checked that xtable is having storage engine as Memory. In such tables, the max. no. of records you can insert is controlled by variable <a href="http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_max_heap_table_size" target="_blank">max_heap_table_size</a>. When checking the size of this variable, I found that this is having default value:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql<span style="color: #000000; font-weight: bold;">&gt;</span> show variables like <span style="color: #ff0000;">'max_heap_table_size'</span>;
+---------------------+----------+
<span style="color: #000000; font-weight: bold;">|</span> Variable_name       <span style="color: #000000; font-weight: bold;">|</span> Value    <span style="color: #000000; font-weight: bold;">|</span>
+---------------------+----------+
<span style="color: #000000; font-weight: bold;">|</span> max_heap_table_size <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">16777216</span> <span style="color: #000000; font-weight: bold;">|</span>
+---------------------+----------+
<span style="color: #000000;">1</span> row <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0.00</span> sec<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>So we need to increase the value of this variable and then issue Alter Table command to make it effective. Also do not forget to add variable with new value in your my.cnf. </p>
<p>Change the variable value:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">set</span>  <span style="color: #007800;">max_heap_table_size</span>=<span style="color: #000000;">268435456</span>;
Query OK, <span style="color: #000000;">0</span> rows affected <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0.00</span> sec<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
mysql<span style="color: #000000; font-weight: bold;">&gt;</span> show variables like <span style="color: #ff0000;">'max_heap_table_size'</span>;
+---------------------+-----------+
<span style="color: #000000; font-weight: bold;">|</span> Variable_name       <span style="color: #000000; font-weight: bold;">|</span> Value     <span style="color: #000000; font-weight: bold;">|</span>
+---------------------+-----------+
<span style="color: #000000; font-weight: bold;">|</span> max_heap_table_size <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">268435456</span> <span style="color: #000000; font-weight: bold;">|</span>
+---------------------+-----------+
<span style="color: #000000;">1</span> row <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0.00</span> sec<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>Now let&#8217;s truncate the table and issue Alter table on it to make the value effective for this table:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql<span style="color: #000000; font-weight: bold;">&gt;</span> truncate table xtable;
Query OK, <span style="color: #000000;">0</span> rows affected <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0.00</span> sec<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
mysql<span style="color: #000000; font-weight: bold;">&gt;</span> alter table xtable <span style="color: #007800;">ENGINE</span>=MEMORY;
Query OK, <span style="color: #000000;">88</span> rows affected <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0.06</span> sec<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Records: <span style="color: #000000;">88</span>  Duplicates: <span style="color: #000000;">0</span>  Warnings: <span style="color: #000000;">0</span></pre></div></div>

<p>After this fix, the issue has been resolved. Make sure that you do not run the truncate command on table which have important data. I have issued truncate because it contains temporary/transactional data so we are fine with removing all records here.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxadminzone.com/fix-mysql-memory-table-error-the-table-xtable-is-full/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beware about admin commands in MySQL replication</title>
		<link>http://linuxadminzone.com/beware-about-admin-commands-in-mysql-replication/</link>
		<comments>http://linuxadminzone.com/beware-about-admin-commands-in-mysql-replication/#comments</comments>
		<pubDate>Fri, 19 Nov 2010 11:08:09 +0000</pubDate>
		<dc:creator>jagbir</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[replication]]></category>

		<guid isPermaLink="false">http://linuxadminzone.com/?p=265</guid>
		<description><![CDATA[Here is the situation: We are doing replication of only 1 table from a database (live) to other host (backup). so we expect that updates which are on others DBs/tables except on this table should not replicate. Wrong! they got replicated. We shifted one DB say DB1 from live env to Backup DB host and [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the situation: We are doing replication of only 1 table from a database (live) to other host (backup). so we expect that updates which are on others DBs/tables except on this table should not replicate. Wrong! they got replicated. </p>
<p>We shifted one DB say DB1 from live env to Backup DB host and then removed that DB1 from Live. Even replication was only for a single table of a particular DB say DB5, DB1 got removed from Backup host as well, living us in vaccum <img src='http://linuxadminzone.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  </p>
<p>Luckily we had backup so restored immediately. Its like a confirmation now that all administrative commands like creating/dropping databases/tables etc get replicated to your client even if you are doing &#8216;selective&#8217; replication. </p>
]]></content:encoded>
			<wfw:commentRss>http://linuxadminzone.com/beware-about-admin-commands-in-mysql-replication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compile mysql 5.1 with innodb and optimize for heavy usage</title>
		<link>http://linuxadminzone.com/compile-mysql-5-1-with-innodb-and-optimize-for-heavy-usage/</link>
		<comments>http://linuxadminzone.com/compile-mysql-5-1-with-innodb-and-optimize-for-heavy-usage/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 13:11:41 +0000</pubDate>
		<dc:creator>jagbir</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://linuxadminzone.com/?p=206</guid>
		<description><![CDATA[MySQL stopped default inclusion of InnoDB in latest 5.1.x, so if you need InnoDB, you have to compile it from source. I have done following steps in CentOS 5.4 server to compile MySQL and optimize it later for a heavy site: 1. Remove earlier installation of MySQL, if any and download source rpm from MySQL [...]]]></description>
			<content:encoded><![CDATA[<p>MySQL stopped default inclusion of InnoDB in latest 5.1.x, so if you need InnoDB, you have to compile it from source. I have done following steps in CentOS 5.4 server to compile MySQL and optimize it later for a heavy site:  </p>
<p>1. Remove earlier installation of MySQL, if any and download source rpm from MySQL site. I&#8217;ve also removed earlier installation of PHP here to upgrade it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ rpm <span style="color: #660033;">-e</span> php-mysql mysql-server php php-devel php-pear</pre></div></div>

<p>Download the latest source rpm from <a href="http://dev.mysql.com/downloads/mysql/5.1.html">MySQL download site</a>, you will get source rpm like below and install it. Installation of source rpm will put it as tar file in /usr/src/redhat/SOURCES, make sure to create /usr/src/redhat/SOURCES directory before installation:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ls</span>
MySQL-community-5.1.45-<span style="color: #000000;">1</span>.rhel5.src.rpm</pre></div></div>

<p>Add mysql user/group if its already not there:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ groupadd mysql
$ useradd <span style="color: #660033;">-g</span> mysql mysql
&nbsp;
$ rpm <span style="color: #660033;">-i</span> MySQL-community-5.1.45-<span style="color: #000000;">1</span>.rhel5.src.rpm
warning: user mysqldev does not exist - using root
warning: group mysqldev does not exist - using root
warning: user mysqldev does not exist - using root
warning: group mysqldev does not exist - using root
&nbsp;
ignore above warnings. 
&nbsp;
$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>redhat<span style="color: #000000; font-weight: bold;">/</span>SOURCES
$ <span style="color: #c20cb9; font-weight: bold;">ls</span>
mysql-5.1.45.tar.gz</pre></div></div>

<p>2. Install required dependencies to compile MySQL:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ yum <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">gcc</span> gcc-c++ ncurses-devel</pre></div></div>

<p>Uncompress and compile it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">tar</span> xzf mysql-5.1.45.tar.gz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> mysql-5.1.45
$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql  <span style="color: #660033;">--localstatedir</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>data <span style="color: #660033;">--sysconfdir</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>mysql <span style="color: #660033;">--with-mysqld-user</span>=mysql <span style="color: #660033;">--with-plugins</span>=innobase,myisam <span style="color: #660033;">--enable-thread-safe-client</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>I need only InnoDB and MyISAM so enabled these storage engines with threads in configure command above. If you need, <a href="http://linuxadminzone.com/how-to-quickly-convert-mysql-databases-from-myisam-to-innodb/">you can convert your existing MyISAM DB into InnoDB quickly</a>.  for more configure options you can check documentation <a href="http://dev.mysql.com/doc/refman/5.1/en/configure-options.html">here</a>. </p>
<p>3. After compilation, you can check that everything related to MySQL is there in /var/lib/directory, change owner of this directory from root to mysql:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span> 
$ <span style="color: #c20cb9; font-weight: bold;">ls</span> mysql<span style="color: #000000; font-weight: bold;">/</span>
bin  docs  include  lib  libexec  mysql-test  share  sql-bench
$ <span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> mysql:mysql mysql<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>Create data directory and initialize default mysql database:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> mysql
$ bin<span style="color: #000000; font-weight: bold;">/</span>mysql_install_db <span style="color: #660033;">--user</span>=mysql</pre></div></div>

<p>Copy startup script to /etc/init.d</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>redhat<span style="color: #000000; font-weight: bold;">/</span>SOURCES<span style="color: #000000; font-weight: bold;">/</span>mysql-5.1.45<span style="color: #000000; font-weight: bold;">/</span>support-files<span style="color: #000000; font-weight: bold;">/</span>mysql.server <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>mysql
$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>mysql
$ chkconfig <span style="color: #660033;">--level</span> <span style="color: #000000;">345</span> mysql on</pre></div></div>

<p>4. Create my.cnf file, start MySQL and update root password: </p>
<p>Create initial my.cnf file by coping sample file, tuned for heavy usage using InnoDB:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>redhat<span style="color: #000000; font-weight: bold;">/</span>SOURCES<span style="color: #000000; font-weight: bold;">/</span>mysql-5.1.45<span style="color: #000000; font-weight: bold;">/</span>support-files<span style="color: #000000; font-weight: bold;">/</span>my-innodb-heavy-4G.cnf <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>my.cnf</pre></div></div>

<p>Open my.cnf and set values of some variables according to specs of your server:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>my.cnf
<span style="color: #007800;">innodb_data_file_path</span>=ibdata1:2000M;ibdata2:10M:autoextend
<span style="color: #007800;">innodb_log_file_size</span>=100M
<span style="color: #007800;">innodb_buffer_pool_size</span>=5G
<span style="color: #007800;">innodb_additional_mem_pool_size</span>=20M
<span style="color: #007800;">innodb_thread_concurrency</span>=<span style="color: #000000;">8</span></pre></div></div>

<p>Here I&#8217;ve set buffer_pool_size as 5G, keep it increasing upto 80% of RAM in the server. Set thread concurrency according to available cpus*2. <a href="http://linuxadminzone.com/optimize-mysql-on-a-large-database-server/">Here you can see more optimization tips</a>. Start MySQL service now:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>mysql start
Starting MySQL..                                           <span style="color: #7a0874; font-weight: bold;">&#91;</span>  OK  <span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>Jump into mysql prompt and update password:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ mysql 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection <span style="color: #c20cb9; font-weight: bold;">id</span> is <span style="color: #000000;">2</span>
Server version: 5.1.45-log Source distribution
&nbsp;
Type <span style="color: #ff0000;">'help;'</span> or <span style="color: #ff0000;">'\h'</span> <span style="color: #000000; font-weight: bold;">for</span> help. Type <span style="color: #ff0000;">'\c'</span> to <span style="color: #c20cb9; font-weight: bold;">clear</span> the buffer.
&nbsp;
mysql<span style="color: #000000; font-weight: bold;">&gt;</span> use mysql; 
mysql<span style="color: #000000; font-weight: bold;">&gt;</span> UPDATE user SET <span style="color: #007800;">Password</span>=PASSWORD<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'yourpass'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> WHERE <span style="color: #007800;">User</span>=<span style="color: #ff0000;">'root'</span> ;
Query OK, <span style="color: #000000;">3</span> rows affected <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0.00</span> sec<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Rows matched: <span style="color: #000000;">3</span>  Changed: <span style="color: #000000;">3</span>  Warnings: <span style="color: #000000;">0</span>
&nbsp;
mysql<span style="color: #000000; font-weight: bold;">&gt;</span> flush privileges; 
Query OK, <span style="color: #000000;">0</span> rows affected <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0.00</span> sec<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
mysql<span style="color: #000000; font-weight: bold;">&gt;</span> quit;</pre></div></div>

<p>5. We are done with MySQL. You can also run Multiple MySQL servers in a single machine, <a href="http://linuxadminzone.com/setting-up-mutiple-mysql-database-servers-on-a-single-linux-machine/">I&#8217;ve already blogged steps to implement that</a>. You are good at this point about MySQL, continuing reading if you need to install/config latest PHP also. I&#8217;m going to install PHP 5.2.x using CentOS&#8217;s Testing repository: </p>
<p>Create testing repository:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>yum.repos.d<span style="color: #000000; font-weight: bold;">/</span>CentOS-Testing.repo
<span style="color: #7a0874; font-weight: bold;">&#91;</span>c5-testing<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #007800;">name</span>=CentOS-<span style="color: #000000;">5</span> Testing 
<span style="color: #007800;">baseurl</span>=http:<span style="color: #000000; font-weight: bold;">//</span>dev.centos.org<span style="color: #000000; font-weight: bold;">/</span>centos<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$releasever</span><span style="color: #000000; font-weight: bold;">/</span>testing<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$basearch</span><span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #007800;">enabled</span>=<span style="color: #000000;">1</span>
<span style="color: #007800;">gpgcheck</span>=<span style="color: #000000;">1</span>
<span style="color: #007800;">gpgkey</span>=http:<span style="color: #000000; font-weight: bold;">//</span>dev.centos.org<span style="color: #000000; font-weight: bold;">/</span>centos<span style="color: #000000; font-weight: bold;">/</span>RPM-GPG-KEY-CentOS-testing</pre></div></div>

<p>Press Ctrl+d (once) to save file.</p>
<p>Install PHP stuff:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ yum <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">--enablerepo</span>=c5-testing php-mysql php php-devel php-pear php-mcrypt php-mbstring</pre></div></div>

<p>6. Install PhpMyAdmin to provide a GUI for MySQL:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>downloads.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>project<span style="color: #000000; font-weight: bold;">/</span>phpmyadmin<span style="color: #000000; font-weight: bold;">/</span>phpMyAdmin<span style="color: #000000; font-weight: bold;">/</span>3.3.2<span style="color: #000000; font-weight: bold;">/</span>phpMyAdmin-3.3.2-english.zip?<span style="color: #007800;">use_mirror</span>=space
$ <span style="color: #c20cb9; font-weight: bold;">unzip</span> phpMyAdmin-3.3.2-english.zip
$ <span style="color: #c20cb9; font-weight: bold;">mv</span> phpMyAdmin-3.3.2 phpmyadmin
$ <span style="color: #7a0874; font-weight: bold;">cd</span> phpmyadmin
$ <span style="color: #c20cb9; font-weight: bold;">cp</span> config.sample.inc.php config.inc.php</pre></div></div>

<p>Update phpmyadmin config.inc.php according to your environment. Add an alias to access phpmyadin in your httpd.conf file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>httpd.conf
<span style="color: #666666; font-style: italic;">### add following lines in this file</span>
Alias <span style="color: #000000; font-weight: bold;">/</span>phpmyadmin<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #ff0000;">&quot;/opt/phpmyadmin/&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>Directory <span style="color: #ff0000;">&quot;/opt/phpmyadmin&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
<span style="color: #000000; font-weight: bold;">&lt;/</span>Directory<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>Restart httpd service to apply new upgrade of PHP and to access PhpMyAdmin and check. I also noticed one issue while trying to connect MySQL from remote, like from PhpMyAdmin. The programs searches for MySQL sock but unable to find. to resolve this create a symlink in to /var/lib/mysql:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>mysql.sock <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql</pre></div></div>

<p>Check again and everything should run as expected. </p>
<p>Related Articles on MySQL:<br />
* <a href="http://linuxadminzone.com/optimize-and-fix-mysql-server-running-slow-without-any-load/">Optimize and fix MySQL running slow without any load.</a><br />
* <a href="http://linuxadminzone.com/find-out-the-clients-of-your-mysql-server/">Find out clients of your MySQL Server.</a><br />
* <a href="http://linuxadminzone.com/setting-up-a-mysql-cluster-7-0-in-redhat-based-linux/">Setup MySQL Cluster 7.0 in Redhat based Linux.</a><br />
* <a href="http://linuxadminzone.com/how-to-setup-mysql-cluster-in-amazon-ec2/">Setup MySQL Cluster in Amazon EC2 cloud.</a><br />
* <a href="http://linuxadminzone.com/quickly-repair-a-huge-corrupted-or-crashed-table-in-mysql/ ">Quickly repair a huge table.</a><br />
* <a href="http://linuxadminzone.com/ignore-mysql-error-while-executing-bulk-statements/">Ignore MySQL error while executing statements in bulk.</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://linuxadminzone.com/compile-mysql-5-1-with-innodb-and-optimize-for-heavy-usage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to quickly convert mysql databases from MyISAM to InnoDB</title>
		<link>http://linuxadminzone.com/how-to-quickly-convert-mysql-databases-from-myisam-to-innodb/</link>
		<comments>http://linuxadminzone.com/how-to-quickly-convert-mysql-databases-from-myisam-to-innodb/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 10:06:30 +0000</pubDate>
		<dc:creator>jagbir</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://linuxadminzone.com/?p=198</guid>
		<description><![CDATA[Recently I was in need to convert all databases of a MySQL server from MyISAM engine to InnoDB. They are facing severe issues due to table level locking in MyISAM and wanted move to InnoDB. This task can be a mammoth work but if you work little smarter, all you need to execute few statements [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was in need to convert all databases of a MySQL server from MyISAM engine to InnoDB. They are facing severe issues due to table level locking in MyISAM and wanted move to InnoDB. This task can be a mammoth work but if you work little smarter, all you need to execute few statements and look at the progress while having cup of coffee. Also note that you can convert in both side, means from MyISAM to InnoDB and from InnoDB to MyISAM using these commands. </p>
<p>There can be many approaches to do same work, like dumping all databases and replacing myisam with innodb in all create table commands in dump file and then restoring all databases. But this can take very long time and you also need to delete data from mysql before restore etc. so I preferred following approach: </p>
<p>1. Extract name of all databases into a text file and remove system databases from it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ mysql <span style="color: #660033;">--skip-column-names</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;show databases;&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> alldb.txt
$ <span style="color: #c20cb9; font-weight: bold;">vi</span> alldb.txt <span style="color: #666666; font-style: italic;">## Remove system databases like 'information_schema, mysql' or any other db you want to exclude from this file.</span></pre></div></div>

<p>I&#8217;ve used &#8211;skip-column-names option here to tell MySQL do not add any column/head name in output.</p>
<p>2. Download <a href="http://www.maatkit.org/">MaatKit</a>  mk-find tool. This is like system find command but for database:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>opt
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.maatkit.org<span style="color: #000000; font-weight: bold;">/</span>get<span style="color: #000000; font-weight: bold;">/</span>mk-find</pre></div></div>

<p>3. Instead of specifying password in mysql command line, I prefer storing it in ~/.my.cnf while doing such works to avoid typing passwords every time. you can create this file or supply password as you wish.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cat</span> ~<span style="color: #000000; font-weight: bold;">/</span>.my.cnf
<span style="color: #7a0874; font-weight: bold;">&#91;</span>client<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #007800;">user</span>=root
<span style="color: #007800;">password</span>=<span style="color: #ff0000;">&quot;password&quot;</span></pre></div></div>

<p>4. Before executing the command to convert storage engine make sure that &#8216;skip-innodb&#8217; is not in your my.cnf file. This is because in envrionment of all MyISAM, its normally placed to disable storage engines which are not in use. You need to delete/comment this line and restart mysql service first. Execute the following command to start conversion:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">for</span> dbname <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> alldb.txt<span style="color: #000000; font-weight: bold;">`</span>; <span style="color: #000000; font-weight: bold;">do</span> .<span style="color: #000000; font-weight: bold;">/</span>mk-find <span style="color: #007800;">$dbname</span> <span style="color: #660033;">--engine</span> MyISAM <span style="color: #660033;">--exec</span> <span style="color: #ff0000;">&quot;ALTER TABLE %D.%N ENGINE=INNODB&quot;</span> <span style="color: #660033;">--print</span>; <span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>This will extract all database names one by one and supply that name to mk-find tool which execute alter table command on all of its tables to convert their storage engine from MyISAM to InnoDB. This can take much time depending no. of tables and their size. </p>
<p>Related articles on MySQL:<br />
* <a href="http://linuxadminzone.com/setting-up-mutiple-mysql-database-servers-on-a-single-linux-machine/">Run multiple MySQL servers in a single Linux machine</a><br />
* <a href="http://linuxadminzone.com/find-out-the-clients-of-your-mysql-server/">Find out clients of your MySQL Server</a><br />
* <a href="http://linuxadminzone.com/setting-up-a-mysql-cluster-7-0-in-redhat-based-linux/">Setup MySQL Cluster 7.0 in Linux</a><br />
* <a href="http://linuxadminzone.com/how-to-setup-mysql-cluster-in-amazon-ec2/">Setup MySQL Cluster in Amazon EC2</a><br />
* <a href="http://linuxadminzone.com/optimize-and-fix-mysql-server-running-slow-without-any-load/">Optimize and fix MySQL Server running slow without any load </a><br />
* <a href="http://linuxadminzone.com/quickly-repair-a-huge-corrupted-or-crashed-table-in-mysql/">Quickly repair a huge corrupted table</a><br />
* <a href="http://linuxadminzone.com/optimize-mysql-on-a-large-database-server/">Optimize large MySQL setup </a><br />
* <a href="http://linuxadminzone.com/ignore-mysql-error-while-executing-bulk-statements/">Ignore MySQL error while executing bulk statements</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://linuxadminzone.com/how-to-quickly-convert-mysql-databases-from-myisam-to-innodb/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Find out the clients of your MySQL server</title>
		<link>http://linuxadminzone.com/find-out-the-clients-of-your-mysql-server/</link>
		<comments>http://linuxadminzone.com/find-out-the-clients-of-your-mysql-server/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 08:49:58 +0000</pubDate>
		<dc:creator>jagbir</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://linuxadminzone.com/?p=181</guid>
		<description><![CDATA[Sometimes in large deployments, there are cases when MySQL server, setup by you long time back which has been in use by multiple teams in your organization, needs some change or update or intrupption in its service and you are in need to know how many clients are there which connects to this server. One [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes in large deployments, there are cases when MySQL server, setup by you long time back which has been in use by multiple teams in your organization, needs some change or update or intrupption in its service and you are in need to know how many clients are there which connects to this server. </p>
<p>One way to know is to check user table in &#8216;mysql&#8217; database, you might have created individual users/databases for your clients/users. But over the time, unless taking care seriously, we tend to forget the exactly how many users/scripts/machines are there making connections. May be you have used same read-only user in various scripts scattered over many machines which you&#8217;ve created just for a single client.   </p>
<p>The other way, I&#8217;ve used here is to monitor your connections over a period of time and noting down IP addresses of machines making connections. After some time, you will have a good idea about your clients machines/users. In MySQL server, the &#8216;processlist&#8217; command shows information about clients connected to server. </p>
<p>I have 1 MySQL master server and few of its slave servers for which I want to know who are using these servers. Store IP addresses of these servers in &#8220;serversip.txt&#8221; file. In an unfortunate case, if you have forgotten your mysql root password, check here to quickly reset it. Execute &#8220;show processlist&#8221; command into each of servers and extract and save IP addresses from output in a file. We have to execute this frequently, so you can run through cron (every minute) or just add infinite loop and sleep to do the same, like below:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">vi</span> searchclient.sh</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">do</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> serverip <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> serversip.txt<span style="color: #000000; font-weight: bold;">`</span>; <span style="color: #000000; font-weight: bold;">do</span> 
        mysql <span style="color: #660033;">-u</span> root <span style="color: #660033;">-p</span> password <span style="color: #660033;">-h</span> <span style="color: #007800;">$serverip</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;show processlist;&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">&quot;Id\|system user\|Commands&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $3 }'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span><span style="color: #ff0000;">':'</span> <span style="color: #660033;">-f</span> <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> clientsip.txt  
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">60</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>execute this script and keep it running for some time, preferrably for several hours to fetch all IPs who tried connecting your servers except system (replication etc) connections. Then kill this script as it will not stop automatically. Now we have got client&#8217;s IP addresses in &#8220;clientsip.txt&#8221; but there will be lots of duplicate IPs. Let&#8217;s clear out duplicates:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cat clientsip.txt | sort | uniq &gt; ipclients.txt</span></pre></div></div>

<p>Your clients IP list is in &#8220;ipclients.txt&#8221; file. further, if you want to know hostnames, you can issue another command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># for ips in `cat ipclients.txt`; do host $ips &gt;&gt; clienthosts.txt; done</span></pre></div></div>

<p>Your client host names are in &#8220;clienthosts.txt&#8221;. Let me know your suggestions/tips for any better way to do this. </p>
<p>Related articles on MySQL: </p>
<p>* <a href="http://linuxadminzone.com/setting-up-a-mysql-cluster-7-0-in-redhat-based-linux/">Setup MySQL Cluster 7.0 on Redhat based Linux</a><br />
* <a href="http://linuxadminzone.com/how-to-setup-mysql-cluster-in-amazon-ec2/">How to Setup MySQL Cluster in Amazon EC2 cloud computing</a><br />
* <a href="http://linuxadminzone.com/setting-up-mutiple-mysql-database-servers-on-a-single-linux-machine/">Setup multiple MySQL server instances in single server</a><br />
* <a href="http://linuxadminzone.com/quickly-repair-a-huge-corrupted-or-crashed-table-in-mysql/">Quickly repair a huge corrupted table</a><br />
* <a href="http://linuxadminzone.com/optimize-mysql-on-a-large-database-server/">Optimize very large MySQL database server</a><br />
* <a href="http://linuxadminzone.com/ignore-mysql-error-while-executing-bulk-statements/">Ignore MySQL errors while executing bulk statements</a><br />
* <a href="http://linuxadminzone.com/optimize-and-fix-mysql-server-running-slow-without-any-load/">Fix MySQL server running slow without any load</a></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxadminzone.com/find-out-the-clients-of-your-mysql-server/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

