Create new table in MySQL

Posted on 2012-09-05
Last Modified: 2012-09-05

We have a MySQL database on a web server; we want to split it into an "archive" portion & a "current" portion. The name of the original table is resv. Using phpMySQL, here are the steps I tried:

(1) Selected all the rows I want to split off.

(2) Exported the result to my local (Windows 7) machine. I exported data & structure. The file is about 29MB

(3) Edited the file in notepad, replacing all resv with resva.

(4) Created a gz zip file using 7-Zip. The gz file is about 4.7 MB.

(5) Using phpMySQL, tried to upload the file into a test database; note, the table resva DOES NOT exist in the test database.

(6) It runs for about 10 minutes; then just stops with no error message or anything.

What's wrong?

Question by:Richard Korts
    LVL 15

    Accepted Solution

    CREATE TABLE resva LIKE resv;
    INSERT resva SELECT * FROM resv;

    Author Closing Comment

    by:Richard Korts
    You da MAN. Not only does it work but almost instantly with about 86,000 rows!!

    Amazing, AND a simple solution.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
    Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now