<?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>Hello System Admin &#124; Where system admins share technical article and tips &#124; Create free Blog &#124; Updates on domains, web hosting, servers and more &#187; Mysql</title>
	<atom:link href="http://hellosystemadmin.com/blog/category/linux/mysql-in-linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://hellosystemadmin.com</link>
	<description></description>
	<lastBuildDate>Fri, 09 Jul 2010 04:29:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to insert a CSV file in to mysql database through mysql console</title>
		<link>http://hellosystemadmin.com/blog/how-to-insert-a-csv-file-in-to-mysql-through-mysql-databaseconsole/</link>
		<comments>http://hellosystemadmin.com/blog/how-to-insert-a-csv-file-in-to-mysql-through-mysql-databaseconsole/#comments</comments>
		<pubDate>Thu, 20 May 2010 10:50:15 +0000</pubDate>
		<dc:creator>Aneesh</dc:creator>
				<category><![CDATA[Mysql]]></category>

		<guid isPermaLink="false">http://hellosystemadmin.com/?p=448</guid>
		<description><![CDATA[






When you want to insert larger CSV file in to a mysql database using  PhpMyadmin or any other GUI tools it may take long time or even it  may be stopped. You can easily Import the CSV file in to mysql database using mysql command.  Log on to the server and  open mysql command and [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-2585810307670535";
/* 468x60, created 11/28/09 */
google_ad_slot = "9594852426";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><script type="text/javascript"><!--
google_ad_client = "pub-2585810307670535";
/* 468x60, created 11/28/09 */
google_ad_slot = "9594852426";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p>When you want to insert larger CSV file in to a mysql database using  PhpMyadmin or any other GUI tools it may take long time or even it  may be stopped. You can easily Import the CSV file in to mysql database using mysql command.  Log on to the server and  open mysql command and log on to the console and do run the following command. I guess the Db name is  testdb</p>
<p><em><span style="color: #993300">use testdb;<br />
load data local infile &#8216;CSVFILE.CSV&#8217; into table TABLENAME fields terminated by &#8216;,&#8217; enclosed by &#8216;&#8221;&#8216; lines terminated by &#8216;\n&#8217;;</span></em></p>
<p><em><span style="color: #993300"><script type="text/javascript"><!--
google_ad_client = "pub-2585810307670535";
/* 468x60, created 11/28/09 */
google_ad_slot = "9594852426";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script> <script type="text/javascript"><!--
google_ad_client = "pub-2585810307670535";
/* 468x60, created 11/28/09 */
google_ad_slot = "9594852426";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></span></em></p>
<p><em><span style="color: #993300"></p>
<div class="wp-caption alignnone" style="width: 478px"><a href="http://www.x-cart.com/aff/?aff_id=8VNAII"><img title="XCart" src="http://secure.qtmsoft.com/affiliate/affiliate_xcart_468_60_1.jpg" alt="XCart" width="468" height="60" /></a><p class="wp-caption-text">XCart</p></div>
<p></span></em></p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fhellosystemadmin.com%2Fblog%2Fhow-to-insert-a-csv-file-in-to-mysql-through-mysql-databaseconsole%2F', 'How+to+insert+a+CSV+file+in+to+mysql+database+through+mysql+console')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fhellosystemadmin.com%2Fblog%2Fhow-to-insert-a-csv-file-in-to-mysql-through-mysql-databaseconsole%2F', title: '+How+to+insert+a+CSV+file+in+to+mysql+database+through+mysql+console+' })"/></div>]]></content:encoded>
			<wfw:commentRss>http://hellosystemadmin.com/blog/how-to-insert-a-csv-file-in-to-mysql-through-mysql-databaseconsole/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql takes 100 % CPU</title>
		<link>http://hellosystemadmin.com/blog/mysql-takes-100-cpu/</link>
		<comments>http://hellosystemadmin.com/blog/mysql-takes-100-cpu/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 11:37:30 +0000</pubDate>
		<dc:creator>Aneesh</dc:creator>
				<category><![CDATA[Mysql]]></category>

		<guid isPermaLink="false">http://hellosystemadmin.com/?p=213</guid>
		<description><![CDATA[



I have seen that when executing a mysql query the cpu usage becomes 100 % and it takes a long time to execute the query.  I have executed the same query thorugh phpmyadmin and that time also it took a long time to execute also mysql consumes 100 % cpu .  I have done some [...]]]></description>
			<content:encoded><![CDATA[<p><code><script type="text/javascript"><!--
google_ad_client = "pub-2585810307670535";
/* 468x60, created 11/28/09 */
google_ad_slot = "9594852426";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></code></p>
<p>I have seen that when executing a mysql query the cpu usage becomes 100 % and it takes a long time to execute the query.  I have executed the same query thorugh phpmyadmin and that time also it took a long time to execute also mysql consumes 100 % cpu .  I have done some change to my.cnf file and restarted mysql and the problem wentaway.  You can also adjust your my.cnf values as follows.</p>
<p>[mysqld]<br />
max_allowed_packet = 128M<br />
sort_buffer_size = 512M<br />
max_connections=500<br />
query_cache_size = 512M<br />
query_cache_limit = 512M<br />
query-cache-type = 2<br />
table_cache = 80<br />
thread_cache_size=8<br />
key_buffer_size = 512M<br />
read_buffer_size=64M<br />
read_rnd_buffer_size=64M<br />
myisam_sort_buffer_size=64M<br />
innodb_flush_log_at_trx_commit=2<br />
innodb_buffer_pool_size=700M<br />
innodb_additional_mem_pool_size=20M</p>
<p>Once you made the changes in my.cnf do not forget to restart mysql server. Mysql can be restarted in any of the following methods</p>
<p>If you have installed mysql using RPM you can restart mysql using one of the following commands</p>
<p>service mysqld restart  OR /etc/init.d/mysqld restart</p>
<p>If you have installed mysql from source files you  can shutdown mysql and start it as follows</p>
<p>Stop Mysql : mysqladmin -uroot -p shutdown</p>
<p>Start msyql : /usr/local/mysql/bin/mysqld_safe &#8211;user=mysql &amp;   (assume mysql is installed at /usr/local/mysql)</p>
<p><code><script type="text/javascript"><!--
google_ad_client = "pub-2585810307670535";
/* 468x60, created 11/28/09 */
google_ad_slot = "9594852426";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></code></p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fhellosystemadmin.com%2Fblog%2Fmysql-takes-100-cpu%2F', 'Mysql+takes+100+%25+CPU')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fhellosystemadmin.com%2Fblog%2Fmysql-takes-100-cpu%2F', title: '+Mysql+takes+100+%25+CPU+' })"/></div>]]></content:encoded>
			<wfw:commentRss>http://hellosystemadmin.com/blog/mysql-takes-100-cpu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql database replication</title>
		<link>http://hellosystemadmin.com/blog/mysql-database-replication/</link>
		<comments>http://hellosystemadmin.com/blog/mysql-database-replication/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 07:24:54 +0000</pubDate>
		<dc:creator>Aneesh</dc:creator>
				<category><![CDATA[Mysql]]></category>

		<guid isPermaLink="false">http://www.hellosystemadmin.com/?p=130</guid>
		<description><![CDATA[



Install mysql server on both server and client machine
Settings in Server
Editi My.conf
log-bin = mysql-bin
server-id = 1
binlog-do-db=DBNAME1
binlog-do-db=DBNAME2
# Backing up Master Database
mysqldump -u root -p &#8211;routines &#8211;add-drop-table &#8211;master-data &#8211;databases DBNAME1 DBNAME2 &#62; master.sql
musql -uroot -p
CREATE USER &#8216;repluser&#8217;@'%&#8217; IDENTIFIED BY &#8216;password&#8217;;
GRANT PROCESS , SUPER , REPLICATION SLAVE , REPLICATION CLIENT ON * . * TO &#8216;repluser&#8217;@'%&#8217; IDENTIFIED BY [...]]]></description>
			<content:encoded><![CDATA[<pre><code><script type="text/javascript"><!--
google_ad_client = "pub-2585810307670535";
/* 468x60, created 11/28/09 */
google_ad_slot = "9594852426";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></code></pre>
<p>Install mysql server on both server and client machine</p>
<p><strong>Settings in Server</strong></p>
<p>Editi My.conf</p>
<p>log-bin = <span>mysql</span>-bin<br />
server-id = 1<br />
binlog-do-db=DBNAME1<br />
binlog-do-db=DBNAME2<br />
# Backing up Master Database</p>
<p>mysqldump -u root -p &#8211;routines &#8211;add-drop-table &#8211;master-data &#8211;databases DBNAME1 DBNAME2 &gt; master.sql</p>
<p>musql -uroot -p</p>
<p>CREATE USER &#8216;repluser&#8217;@'%&#8217; IDENTIFIED BY &#8216;password&#8217;;<br />
GRANT PROCESS , SUPER , <span>REPLICATION</span> SLAVE , <span>REPLICATION</span> CLIENT ON * . * TO &#8216;repluser&#8217;@'%&#8217; IDENTIFIED BY &#8216;password&#8217; WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;</p>
<p>grant <span>replication</span> slave on *.* to <a href="mailto:repluser@63.225.155.244" target="_blank">repluser@SLAVE_SERVER_IP_ADDRESS</a> identified by &#8216;password&#8217;;</p>
<p># Slave configuration</p>
<p>vi /etc/my.cnf</p>
<p>log-bin = <span>mysql</span>-bin<br />
server-id = 2<br />
master-host=MASTER SERVER IP<br />
master-user=repluser<br />
master-password=password;<br />
master-connect-retry=60<br />
replicate-do-db=DBNAME1<br />
replicate-do-db=DBNAME2</p>
<p># Copying the SQL file rom Master</p>
<p>scp root@master IP address : path to the sqlÂ  file</p>
<p># Create Database in SLAVE<br />
# dump database to new dbs</p>
<p># execute following queries in <span>mysql</span></p>
<p>change master to master_host=&#8217;Master IP address&#8217;;</p>
<p>change master to master_user=&#8217;repluser&#8217;;</p>
<p>change master to master_password=&#8217;Master user pass&#8217;;</p>
<p>change master to master_log_file=&#8217;<span>mysql</span>-bin.</p>
<div dir="ltr"><strong><span style="color: #ff0000">(the log file should be same as that displayed in master when executing the command &#8217;show master status;&#8217;</span></strong><br />
change master to MASTER_LOG_POS=98 ;Â  <strong><span style="color: #ff0000">(the NumbeÂ  should be same as that displayed in master when executing the command &#8217;show master status;&#8217;</span></strong></div>
<p>start slave<br />
show slave status</p>
<p><code><script type="text/javascript"><!--
google_ad_client = "pub-2585810307670535";
/* 468x60, created 11/28/09 */
google_ad_slot = "9594852426";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></code></p>
<p><strong> </strong><br />
 <script type="text/javascript"><!--
google_ad_client = "pub-2585810307670535";
/* 468x60, created 11/28/09 */
google_ad_slot = "9594852426";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fhellosystemadmin.com%2Fblog%2Fmysql-database-replication%2F', 'Mysql+database+replication')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fhellosystemadmin.com%2Fblog%2Fmysql-database-replication%2F', title: '+Mysql+database+replication+' })"/></div>]]></content:encoded>
			<wfw:commentRss>http://hellosystemadmin.com/blog/mysql-database-replication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
