How to Copy Table in MySQL CLI
Sometimes I had a problem in repopulating ‘fresh’ tables in MySQL, how to duplicate the table and start it from id 1? Here is ‘serial’ command line to copy tables with an empty data in it, and start the counting from 1 again.
Execute this SQL queries (via PhpMyAdmin or MySQL command line interface):
create table groups2 like groups; drop table groups; create table groups like groups2; drop table groups2;
Done, and you’l get a fresh table with the same field as the source.
