The following article describes how to quickly create tables with the same structure in the MySQL database, the following articles describe how to quickly create a table with the same structure as a MySQL database from two aspects: indexing and not creating an index. The following is the main content of this article.
1. quickly create tables with the same MySQL structure, including indexes:
- mysql> SHOW CREATE TABLE a;
- CREATE TABLE `a` (
- `name` varchar(50) default NULL,
- KEY `name` (`name`)
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
- mysql> CREATE TABLE b LIKE a;
- mysql> SHOW CREATE TABLE b;
- CREATE TABLE `b` (
- `name` varchar(50) default NULL,
- KEY `name` (`name`)
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
2. quickly create a table with the same structure, but do not create a MySQL index:
- mysql> SHOW CREATE TABLE a;
- CREATE TABLE `a` (
- `name` varchar(50) default NULL,
- KEY `name` (`name`)
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
- mysql> CREATE TABLE c SELECT * FROM a LIMIT 0;
- mysql> SHOW CREATE TABLE c;
- CREATE TABLE `c` (
- `name` varchar(50) default NULL
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
The above content is an introduction to quickly creating tables with the same MySQL structure. I hope you will get some benefits.