<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Tech-Recipes - Latest Comments in Copy an existing MySQL table to a new table</title><link>http://tech-recipes.disqus.com/</link><description>Cookbook of Tech Tutorials</description><atom:link href="https://tech-recipes.disqus.com/copy_an_existing_mysql_table_to_a_new_table_mysql_tech_recipes/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 14 Jul 2011 00:39:56 -0000</lastBuildDate><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-251814137</link><description>&lt;p&gt;Outstanding...&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ranggi Putra</dc:creator><pubDate>Thu, 14 Jul 2011 00:39:56 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-218902608</link><description>&lt;p&gt;HI to all, i agree with all the above possibilities to copy the table, with data, and structure, but all the above queries wont copy the key constraints ( relations). Is there  any query that copy index, key fields in mysql&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gopinathkarangula</dc:creator><pubDate>Mon, 06 Jun 2011 01:38:43 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-218500828</link><description>&lt;p&gt;Its working dear.............. &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Yunususmani</dc:creator><pubDate>Sun, 05 Jun 2011 08:18:52 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-190092520</link><description>&lt;p&gt;Great! I am a beginner of mysql. That's is very useful for me. Thank you very much.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Oscar</dc:creator><pubDate>Fri, 22 Apr 2011 13:01:28 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-169978321</link><description>&lt;p&gt; perfect. Thanks.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Amilaudana</dc:creator><pubDate>Wed, 23 Mar 2011 02:27:28 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-161701284</link><description>&lt;p&gt;Thanx, it definitely works.&lt;br&gt;However, I tried to do this on a 15 million record table, &lt;br&gt;The INSERT INTO statement, being a logged operation, combined with the possibility for the existence of indexes, possibly even clustered ones, makes this an all around inapplicable solution.&lt;br&gt;Can you think of any alternative.    &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">singletony</dc:creator><pubDate>Mon, 07 Mar 2011 05:51:41 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-144147534</link><description>&lt;p&gt;You are my hero&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Adrian Emmott</dc:creator><pubDate>Thu, 10 Feb 2011 12:20:01 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-121040103</link><description>&lt;p&gt;Thanks so much!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jdssarmiento</dc:creator><pubDate>Thu, 30 Dec 2010 04:16:32 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-94661180</link><description>&lt;p&gt;How to copy table to different host ? please !!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nana juhana</dc:creator><pubDate>Sat, 06 Nov 2010 23:01:02 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-64002136</link><description>&lt;p&gt;create table raj as&lt;br&gt;select * from employees where 1=0;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rajeevmcadeveloper</dc:creator><pubDate>Fri, 23 Jul 2010 21:56:41 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-61784694</link><description>&lt;p&gt;On 5.1 this method copied all my indexes between tables (they were MyISAM ones).&lt;/p&gt;&lt;p&gt;Also, it can all be done in one command:&lt;/p&gt;&lt;p&gt;CREATE TABLE recipes_new SELECT * FROM &lt;a href="http://production.recipes" rel="nofollow noopener" target="_blank" title="production.recipes"&gt;production.recipes&lt;/a&gt;;&lt;/p&gt;&lt;p&gt;as explained in the MySQL help - &lt;a href="http://dev.mysql.com/doc/refman/5.1/en/create-table.html" rel="nofollow noopener" target="_blank" title="http://dev.mysql.com/doc/refman/5.1/en/create-table.html"&gt;http://dev.mysql.com/doc/re...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jtes0111</dc:creator><pubDate>Mon, 12 Jul 2010 17:58:23 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-45628250</link><description>&lt;p&gt;simply superb...............&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">manjunathpuru</dc:creator><pubDate>Tue, 20 Apr 2010 03:44:15 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-44658581</link><description>&lt;p&gt;Doesn't work on a MySQL 4.x server.  Might work on MySQL 5.x.  This will also supposedly not copy indexes or foreign key constraints.  Makes this approach fairly limited.&lt;/p&gt;&lt;p&gt;What most people don't realize is that MySQL stores each table in its own set of flat files.  MyISAM, for instance, creates tablename.MYD, tablename.MYI, and tablename.frm files.  D = Data, I = Index(es), frm = structure.  I've found you can clone a table VERY quickly - even on a heavily-used live production system with millions of rows - by using the file system to copy these files to new names and then running the "FLUSH TABLES", "FLUSH QUERY CACHE", and "RESET QUERY CACHE" MySQL commands.  Although, it is best to temporarily take the database offline before cloning, it can be done on a live system.  If the destination table/index gets corrupted during the copy, a "REPAIR TABLE" command usually fixes the problem (or re-running the whole process).&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Better MySQL</dc:creator><pubDate>Tue, 13 Apr 2010 18:03:28 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-42065729</link><description>&lt;p&gt;Thank you. &lt;br&gt;This helped me a lot&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">coco</dc:creator><pubDate>Sun, 28 Mar 2010 23:13:57 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-41506547</link><description>&lt;p&gt;hey it worked for me :) thanks &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">chandan</dc:creator><pubDate>Thu, 25 Mar 2010 06:25:49 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-39731241</link><description>&lt;p&gt;thanks .. &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">sandarminaye</dc:creator><pubDate>Mon, 15 Mar 2010 05:55:08 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-37538321</link><description>&lt;p&gt;Nice, it works&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Cheap</dc:creator><pubDate>Mon, 01 Mar 2010 21:50:51 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-16167891</link><description>&lt;p&gt;yeah the single-line command is a bad scene.  Even the two-line command will have issues in some cases, eg if you have foreign key restraints or are inserting rows with autoincrement keys that equal 0 (they get incremented to 1).  I wrapped the statements in code used by mysqldump.&lt;br&gt;Also doing a mysqldump, replacing the table names in the statements, and then loading the resulting dump is another way to do this.  It's actually probably more robust than doing it with insert..select, but will be slower and a bit tricky.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">intuited</dc:creator><pubDate>Tue, 08 Sep 2009 00:16:23 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-15735941</link><description>&lt;p&gt;It creates a duplicate table but does not copy the constraints and other meta details of a table &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">viralpatel</dc:creator><pubDate>Tue, 01 Sep 2009 17:42:18 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-15523328</link><description>&lt;p&gt;I was just looking for this!&lt;br&gt;thanks&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">raptor8908</dc:creator><pubDate>Fri, 28 Aug 2009 09:08:44 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-14950944</link><description>&lt;p&gt;This could also be done in one step with the following:&lt;/p&gt;&lt;p&gt;   create table recipies_new select * from production.recipies;&lt;/p&gt;&lt;p&gt;Be aware that this method doesn't seem to duplicate any of the indexes from the original table into the new table. [Using MySQL 5.1]&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">bryonbean</dc:creator><pubDate>Mon, 17 Aug 2009 04:55:46 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-14837530</link><description>&lt;p&gt;The simplest solutions are the best. Thanks!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Name</dc:creator><pubDate>Fri, 14 Aug 2009 11:58:08 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-12721404</link><description>&lt;p&gt;Thanks a lot, this saved me a lot of time!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Brandon</dc:creator><pubDate>Wed, 15 Jul 2009 21:30:15 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-8100200</link><description>&lt;p&gt;Very helpful! thank you :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Chris</dc:creator><pubDate>Sun, 12 Apr 2009 16:18:56 -0000</pubDate></item><item><title>Re: Copy an existing MySQL table to a new table</title><link>http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/#comment-4326840</link><description>&lt;p&gt;It's working!!! Thank you very much! :-)&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alfredas</dc:creator><pubDate>Thu, 11 Dec 2008 07:59:53 -0000</pubDate></item></channel></rss>