<?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>MySQL &#8211; lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</title>
	<atom:link href="http://lifelinux.com/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://lifelinux.com</link>
	<description>All About Linux !</description>
	<lastBuildDate>Sat, 23 Feb 2013 02:30:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.3</generator>
	<item>
		<title>How Do I Fix &#8220;Host is blocked because of many connection error&#8221; In MySQL</title>
		<link>http://lifelinux.com/how-do-i-fix-host-is-blocked-because-of-many-connection-error-in-mysql/</link>
					<comments>http://lifelinux.com/how-do-i-fix-host-is-blocked-because-of-many-connection-error-in-mysql/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Sat, 23 Feb 2013 02:26:32 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=1566</guid>

					<description><![CDATA[<p>Today, I got following MySQL error in a PHP application: Host &#8216;host_name&#8217; is blocked because of many connection errors; unblock with &#8216;mysqladmin flush-hosts&#8217;. It means that mysqld has received many connection requests from the given host. Default max_connect_errors value is 10, that is remote host will be blocked if there is more than 10 connection [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/how-do-i-fix-host-is-blocked-because-of-many-connection-error-in-mysql/">How Do I Fix &#8220;Host is blocked because of many connection error&#8221; In MySQL</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>Today, I got following MySQL error in a PHP application: Host &#8216;host_name&#8217; is blocked because of many connection errors; unblock with &#8216;mysqladmin flush-hosts&#8217;. It means that mysqld has received many connection requests from the given host. Default max_connect_errors value is 10, that is remote host will be blocked if there is more than 10 connection errors.<br />
<span id="more-1566"></span><br />
To fix, type the following command</p>
<pre>
# mysqladmin flush-hosts
</pre>
<p>To avoid this happening again, edit my.cnf</p>
<pre>
# vi /etc/my.cnf
</pre>
<p>Add the following line</p>
<pre>
max_connect_errors=10000
</pre>
<p>The value of the max_connect_errors system variable determines how many successive interrupted connection requests are permitted. Restart MySQL to reload configuration file</p>
<pre>
# service mysqld restart
</pre>
<p>Or, the value &#8216;max_connect_errors&#8217; can also be set at runtime, type the following commands</p>
<pre>
# mysql -uroot -p
# mysql> SET GLOBAL max_connect_errors=10000;
</pre>
<g:plusone href="http://lifelinux.com/how-do-i-fix-host-is-blocked-because-of-many-connection-error-in-mysql/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/how-do-i-fix-host-is-blocked-because-of-many-connection-error-in-mysql/">How Do I Fix &#8220;Host is blocked because of many connection error&#8221; In MySQL</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/how-do-i-fix-host-is-blocked-because-of-many-connection-error-in-mysql/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Repair And Optimize All Tables In All MySQL Databases Using Command</title>
		<link>http://lifelinux.com/repair-and-optimize-all-tables-in-all-mysql-databases-using-command/</link>
					<comments>http://lifelinux.com/repair-and-optimize-all-tables-in-all-mysql-databases-using-command/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Mon, 01 Aug 2011 01:17:06 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[mysql optimize table]]></category>
		<category><![CDATA[mysql repair table]]></category>
		<category><![CDATA[mysqlcheck]]></category>
		<category><![CDATA[Optimize All Tables In All MySQL Databases]]></category>
		<category><![CDATA[Repair And Optimize All Tables]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=900</guid>

					<description><![CDATA[<p>There&#8217;s a simple command to automatically check, repair and optimize all tables in all databases when you&#8217;re running a MySQL server on Linux / Unix / BSD. mysqlcheck -u{username} -p{password} –check –optimize –auto-repair –all-databases Where: {username} – user full access to the all databases {password} – password for {user} account mysqlcheck uses the SQL statements [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/repair-and-optimize-all-tables-in-all-mysql-databases-using-command/">Repair And Optimize All Tables In All MySQL Databases Using Command</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>There&#8217;s a simple command to automatically check, repair and optimize all tables in all databases when you&#8217;re running a MySQL server on Linux / Unix / BSD.</p>
<pre>mysqlcheck -u{username} -p{password}  –check –optimize –auto-repair –all-databases</pre>
<p><span id="more-900"></span><br />
<strong>Where:</strong><br />
{username} – user full access to the all databases<br />
{password} – password for {user} account</p>
<p><strong>mysqlcheck</strong> uses the SQL statements CHECK TABLE, REPAIR TABLE, ANALYZE TABLE, and OPTIMIZE TABLE in a convenient way for the user. It determines which statements to use for the operation you want to perform, and then sends the statements to the server to be executed.</p>
<p>See the <a href="http://dev.mysql.com/doc/refman/5.0/en/mysqlcheck.html">mysqlcheck</a> docs for more information.</p>
<g:plusone href="http://lifelinux.com/repair-and-optimize-all-tables-in-all-mysql-databases-using-command/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/repair-and-optimize-all-tables-in-all-mysql-databases-using-command/">Repair And Optimize All Tables In All MySQL Databases Using Command</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/repair-and-optimize-all-tables-in-all-mysql-databases-using-command/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>MySQL Slow Query Log File</title>
		<link>http://lifelinux.com/mysql-slow-query-log-file/</link>
					<comments>http://lifelinux.com/mysql-slow-query-log-file/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Sun, 08 May 2011 11:27:47 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[/etc/my.cnf]]></category>
		<category><![CDATA[enable log slow query]]></category>
		<category><![CDATA[estart mysql service]]></category>
		<category><![CDATA[long_query_time]]></category>
		<category><![CDATA[my.cnf]]></category>
		<category><![CDATA[MySQL Slow Query]]></category>
		<category><![CDATA[mysql-slow-queries]]></category>
		<category><![CDATA[mysqld restart]]></category>
		<category><![CDATA[vi command]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=349</guid>

					<description><![CDATA[<p>The slow query log consists of all SQL statements that took more than long_query_time seconds to execute and required at least min_examined_row_limit rows to be examined. The time to acquire the initial table locks is not counted as execution time. mysqld writes a statement to the slow query log after it has been executed and [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/mysql-slow-query-log-file/">MySQL Slow Query Log File</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><blockquote><p>The slow query log consists of all SQL statements that took more than long_query_time seconds to execute and required at least min_examined_row_limit rows to be examined. The time to acquire the initial table locks is not counted as execution time. <strong>mysqld</strong> writes a statement to the slow query log after it has been executed and after all locks have been released, so log order might be different from execution order. The default value of <strong>long_query_time</strong> is 10. The minimum value is 0, and a resolution of microseconds is supported when logging to a file. However, the microseconds part is ignored and only integer values are written when logging to tables.<br />
Source: http://dev.mysql.com/doc/refman/5.5/en/slow-query-log.html
</p></blockquote>
<p><span id="more-349"></span></p>
<p>To make the change permanent whenever the MySQL server is started, and for MySQL prior 5.1.x, edit your my.cnf file (on Linux boxes this is usually somewhere like /etc/my.cnf or /etc/mysql/my.cnf) and uncomment the &#8220;log_slow_queries&#8221; line or add it if it&#8217;s not present.<br />
On a CentOS, type the following command</p>
<pre>
[root@server2 ~]# vi /etc/my.cnf
</pre>
<p>For example, the line to uncomment looks like so:</p>
<pre>
...
log_slow_queries = /var/log/mysql/mysql-slow-queries.log
...
</pre>
<p>You can change the log file name to something else or leave it blank so it uses the default. The default is to log the queries into a file in the MySQL data directory.</p>
<h3>Setting the long_query_time</h3>
<p>You can also specify how long a quey needs to run for before it is logged with the &#8220;long_query_time&#8221; setting. By default this is 10 seconds. In the my.cnf file, to change it to e.g. 1 second add the following:</p>
<pre>
...
long_query_time = 1
log_slow_queries = /var/log/mysql/mysql-slow-queries.log
...
</pre>
<p>After that, restart mysql service. Enter the following command:</p>
<pre>
[root@server2 ~]# /etc/init.d/mysqld restart
</pre>
<g:plusone href="http://lifelinux.com/mysql-slow-query-log-file/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/mysql-slow-query-log-file/">MySQL Slow Query Log File</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/mysql-slow-query-log-file/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to backup and restore large mysql database</title>
		<link>http://lifelinux.com/how-to-backup-and-restore-large-mysql-database/</link>
					<comments>http://lifelinux.com/how-to-backup-and-restore-large-mysql-database/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Sun, 01 May 2011 07:00:13 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[backup data]]></category>
		<category><![CDATA[backup mysql]]></category>
		<category><![CDATA[backup script]]></category>
		<category><![CDATA[backup service]]></category>
		<category><![CDATA[centralized storage]]></category>
		<category><![CDATA[ftp backup]]></category>
		<category><![CDATA[ftp servers]]></category>
		<category><![CDATA[gnu tar]]></category>
		<category><![CDATA[incremental backup]]></category>
		<category><![CDATA[incremental backups]]></category>
		<category><![CDATA[mysql databases]]></category>
		<category><![CDATA[mysql server]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[nas backup]]></category>
		<category><![CDATA[script generator]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[storage array]]></category>
		<category><![CDATA[tape backups]]></category>
		<category><![CDATA[tar command]]></category>
		<category><![CDATA[tar gz]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=317</guid>

					<description><![CDATA[<p>If you have very large mysql database then it is very hard to backup and restore using the conventional phpmyadmin or any other programs. In this Tutorial I will explain you how to backup and restore a larger database. This tutorial can be used while moving your database from one server to another. First you [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-backup-and-restore-large-mysql-database/">How to backup and restore large mysql database</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>If you have very large <strong>mysql database</strong> then it is very hard to backup and restore using the conventional phpmyadmin or any other programs.<br />
In this Tutorial I will explain you how to backup and restore a larger database. This tutorial can be used while moving your database from one server to another.<span id="more-317"></span><br />
First you need to have shell (ssh) access to your server. Then follow the steps:</p>
<h3>To Backup Mysql Database</h3>
<pre>
root@lifelinux:~# mysqldump  -u [username] -p[password] [dbname] > [backup.sql]
</pre>
<p>[username] is your database user name<br />
[password] is the password for your database (Note: there is no space between -p and the password)<br />
[dbname] is The name of your database<br />
[backup.sql] is The file name for your database backup</p>
<h3>Backup Mysql Database with compress</h3>
<p>If your mysql database is very big, you might want to compress the output of mysql dump. Just use the mysql backup command below and pipe the output to gzip, then you will get the output as gzip file.</p>
<pre>
root@lifelinux:~# mysqldump -u [username] -p[password] [dbname] | gzip -9 > [backup.sql.gz]
</pre>
<h3>Restore Mysql Database</h3>
<p>To restore the database you need to create the database in target machine then use this command</p>
<pre>
root@lifelinux:~# mysql -u [username] -p[password] [dbname] < [backup.sql]
</pre>
<h3>Restore Compressed Mysql Database</h3>
<pre>
root@lifelinux:~# gunzip < [backup.sql.gz] | mysql -u [username] -p[password] [dbname]
</pre>
<g:plusone href="http://lifelinux.com/how-to-backup-and-restore-large-mysql-database/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-backup-and-restore-large-mysql-database/">How to backup and restore large mysql database</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/how-to-backup-and-restore-large-mysql-database/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Create A MySQL User Account</title>
		<link>http://lifelinux.com/create-a-mysql-user-account/</link>
					<comments>http://lifelinux.com/create-a-mysql-user-account/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Wed, 24 Nov 2010 05:29:27 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[create mysql account]]></category>
		<category><![CDATA[create mysql user]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql command]]></category>
		<category><![CDATA[mysql database server]]></category>
		<category><![CDATA[mysql server]]></category>
		<category><![CDATA[new account on mysql]]></category>
		<category><![CDATA[user accounts on mysql]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=130</guid>

					<description><![CDATA[<p>The MySQL access control system enables you to create MySQL accounts and define what each account can do. The steps bellow to create a new user MySQL account. Step 1: Login MySQL as root mysql -u root -p Step 2: Using GRANT command to create new MySQL account mysql&#62; GRANT ALL ON &#60;database_name&#62;.* TO &#60;new_account&#62;@&#60;server&#62; [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/create-a-mysql-user-account/">Create A MySQL User Account</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>The <strong>MySQL</strong> access control system enables you to create MySQL accounts and define what each account can do. The steps bellow to create a new user MySQL account.<span id="more-130"></span></p>
<h2>Step 1: Login MySQL as root</h2>
<pre>mysql -u root -p
</pre>
<h2>Step 2: Using GRANT command to create new MySQL account</h2>
<pre>mysql&gt;   GRANT ALL ON &lt;database_name&gt;.* TO &lt;new_account&gt;@&lt;server&gt; IDENTIFIED BY '';
</pre>
<p><strong>Example</strong>: I have database called demo and i want to assign all privileges to new account called user1, i will type the following command:</p>
<pre>mysql&gt;   GRANT ALL ON demo.* TO user1@localhost IDENTIFIED BY 'mypassword';
</pre>
<p><strong>Note: </strong>GRANT ALL is means set all privileges to new account. But only on demo database and can&#8217;t access other database. Read more about <a href="http://dev.mysql.com/doc/refman/5.1/en/grant.html#grant-database-privileges" target="_blank">database privileges</a>.</p>
<h2>Step 3: Exit MySQL interface</h2>
<pre>mysql&gt;   exit;
</pre>
<h2>Step 4: Login MySQL with new Account</h2>
<pre>mysql -u &lt;new_account&gt; -p
</pre>
<p>Replace &lt;new_account&gt; by your new account created.</p>
<g:plusone href="http://lifelinux.com/create-a-mysql-user-account/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/create-a-mysql-user-account/">Create A MySQL User Account</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/create-a-mysql-user-account/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Reset The Root Password Of MySQL Server</title>
		<link>http://lifelinux.com/reset-the-root-password-of-mysql-server/</link>
					<comments>http://lifelinux.com/reset-the-root-password-of-mysql-server/#comments</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Wed, 24 Nov 2010 04:01:31 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[mysql command]]></category>
		<category><![CDATA[mysql password]]></category>
		<category><![CDATA[Recover MySQL password]]></category>
		<category><![CDATA[Recover Password MySQL]]></category>
		<category><![CDATA[restart mysql]]></category>
		<category><![CDATA[start mysql]]></category>
		<category><![CDATA[stop mysql]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=123</guid>

					<description><![CDATA[<p>By default, MySQL server will be installed with root account and password is blank. If you have set the password for root and forget it, then you will need to reset the root password for MySQL. This topic has detail steps on how to reset password for root on MySQL Server. Step 1: Stop MySQL [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/reset-the-root-password-of-mysql-server/">Reset The Root Password Of MySQL Server</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>By default, MySQL server will be installed with root account and password is blank. If you have set the password for root and forget it, then you will need to reset the root password for MySQL.<span id="more-123"></span></p>
<p>This topic has detail steps on how to reset password for root on MySQL Server.</p>
<h2>Step 1: Stop MySQL service</h2>
<pre>
service mysqld stop
</pre>
<h2>Step 2: Start MySQL with mysql-safe command</h2>
<pre>
mysql-safe --skip-grant-tables &amp;
</pre>
<p>&#8211;skip-grant-tables is a option to enable anyone connect MySQL Server without password and with all privileges.</p>
<h2>Step 3: Connect MySQL with root account and blank password</h2>
<pre>
mysql -u root -p
</pre>
<h2>Step 4: Change password for root account</h2>
<pre>
mysql&gt;   UPDATE mysql.user SET password = PASSWORD('NEW_PASSWORD') WHERE User = 'root';
mysql&gt;   FLUSH PRIVILEGES;
mysql&gt;   exit;
</pre>
<h2>Step 5: Restart MySQL</h2>
<pre>
service mysqld restart
</pre>
<g:plusone href="http://lifelinux.com/reset-the-root-password-of-mysql-server/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/reset-the-root-password-of-mysql-server/">Reset The Root Password Of MySQL Server</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/reset-the-root-password-of-mysql-server/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Converting to Per Table Data for InnoDB</title>
		<link>http://lifelinux.com/converting-to-per-table-data-for-innodb/</link>
					<comments>http://lifelinux.com/converting-to-per-table-data-for-innodb/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 23 Nov 2010 08:48:18 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[changing to per-table]]></category>
		<category><![CDATA[innodb_file_per_table]]></category>
		<category><![CDATA[myisam to innodb]]></category>
		<category><![CDATA[per table data innodb]]></category>
		<category><![CDATA[shared innodb]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=56</guid>

					<description><![CDATA[<p>Issue with shared InnoDB /var/lib/mysql/ibdata1 storage InnoDB tables currently store data and indexes into a shared tablespace (/var/lib/mysql/ibdata1). Due to the shared tablespace, data corruption for one InnoDB table can result in MySQL failing to start up on the entire machine. Repairing InnoDB corruption can be extremely difficult to perform and can result in data [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/converting-to-per-table-data-for-innodb/">Converting to Per Table Data for InnoDB</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p><strong>Issue with shared InnoDB /var/lib/mysql/ibdata1 storage</strong><br />
InnoDB tables currently store data and indexes into a shared tablespace  (/var/lib/mysql/ibdata1). Due to the shared tablespace, data corruption  for one InnoDB table can result in MySQL failing to start up on the  entire machine. Repairing InnoDB corruption can be extremely difficult  to perform and can result in data loss for tables that were not  corrupted originally during that repair process.<span id="more-56"></span></p>
<p>Since MySQL 5.5 will be using InnoDB as the default storage engine, it  is important to consider the consequences of continuing to utilize the  shared tablespace in /var/lib/mysql/ibdata1</p>
<p><strong>Changing to per-table tablespace with innodb_file_per_table</strong></p>
<p>As an option to resolve the issue, MySQL has a configuration variable  called innodb_file per_table. To use this variable, the following could  be placed into /etc/my.cnf to convert InnoDB to a per table file for  each InnoDB engine table:</p>
<pre>innodb_file_per_table=1</pre>
<p>After adding the line, MySQL would need to be restarted on the machine.</p>
<p>The result for using that line in /etc/my.cnf would cause any databases  after the line is added to create .idb files in /var/lib/mysql/database/  location. Please note that the shared tablespace will still hold  internal data dictionary and undo logs.</p>
<p><strong>Converting old InnoDB tables</strong></p>
<p>Any old databases with InnoDB tables set to previously share the  tablespace in ibdata1 will still be using that file, so those old  databases would need to be switched to the new system. The following  command in MySQL CLI would create a list of InnoDB engine tables and a  command to run for each to convert them to the new innodb_file_per_table  system:</p>
<pre>select concat('alter table ',TABLE_SCHEMA ,'.',table_name,'  ENGINE=InnoDB;') FROM INFORMATION_SCHEMA.tables where table_type='BASE  TABLE' and engine = 'InnoDB';</pre>
<p>An example for Roundcube on my test machine shows the following return upon running the prior command:</p>
<pre>alter table roundcube.cache ENGINE=InnoDB; alter table roundcube.contacts ENGINE=InnoDB; alter table roundcube.identities ENGINE=InnoDB; alter table roundcube.messages ENGINE=InnoDB; alter table roundcube.session ENGINE=InnoDB; alter table roundcube.users ENGINE=InnoDB;</pre>
<p>You would then simply need to issue the commands noted by MySQL CLI to  then covert each table to the new innodb_file_per_table format.</p>
<p>Please note that these commands would only need to be run in MySQL  command line for the conversion, which can be reached in root SSH by  typing <strong>mysql</strong> at the bash prompt.</p>
<p><strong>Possible Issues for Converting Old InnoDB Tables</strong></p>
<p>1. Possible system load might occur during the conversion<br />
2. Possible issues with drive space filling up for the conversion</p>
<g:plusone href="http://lifelinux.com/converting-to-per-table-data-for-innodb/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/converting-to-per-table-data-for-innodb/">Converting to Per Table Data for InnoDB</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/converting-to-per-table-data-for-innodb/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How To Make Multiple Updates Using A Single Query In MySQL</title>
		<link>http://lifelinux.com/how-to-make-multiple-updates-using-a-single-query-in-mysql/</link>
					<comments>http://lifelinux.com/how-to-make-multiple-updates-using-a-single-query-in-mysql/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 23 Nov 2010 07:52:16 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[multiple updates in mysql]]></category>
		<category><![CDATA[multiple updates in mysql with single query]]></category>
		<category><![CDATA[multiple updates using a single query]]></category>
		<category><![CDATA[update with single query]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=21</guid>

					<description><![CDATA[<p>Q. How to make multiple updates using a single query in mysql ? A. Using CASE &#38; WHEN commands to solve it. As you might know it’s quite easy to make multiple INSERTs in a single query, like this: INSERT INTO table_name (field1, field2) VALUES ('value1', 'value2'), ('value3', 'value4'); However, for some strange reason you [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-make-multiple-updates-using-a-single-query-in-mysql/">How To Make Multiple Updates Using A Single Query In MySQL</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p><span style="color: #ff0000;">Q</span>. How to make multiple updates using a single query in mysql ?</p>
<p><span style="color: #0000ff;">A</span>. Using CASE &amp; WHEN commands to solve it.<span id="more-21"></span></p>
<p>As you might know it’s quite easy to make multiple INSERTs in a single query, like this:</p>
<pre>INSERT INTO table_name (field1, field2) VALUES
('value1', 'value2'),
('value3', 'value4');
</pre>
<p><!--more-->However, for some strange reason you <strong>can’t</strong> do multiple changes to a table in a single Update query like this:</p>
<pre>UPDATE table_name
SET (field2 = 'valuex' WHERE field1 = 'value1'),
(field2='valuey' WHERE field1 = 'value3');
</pre>
<p>But, you can do a very interesting trick. You can combine an UPDATE with a CASE like this:</p>
<pre>UPDATE table_name SET field2 = CASE
WHEN field1 = 'value1' THEN 'valuex';
WHEN field1 = 'value3' THEN 'valuey';
ELSE field2
END;
</pre>
<p>The ELSE field2 is very important, otherwise you will overwrite the rest of the table with NULL.</p>
<g:plusone href="http://lifelinux.com/how-to-make-multiple-updates-using-a-single-query-in-mysql/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-make-multiple-updates-using-a-single-query-in-mysql/">How To Make Multiple Updates Using A Single Query In MySQL</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/how-to-make-multiple-updates-using-a-single-query-in-mysql/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
