My inefficient approach:
Create from a local PHP script:
<?PHP//0-63Header("Content-type:text/html;charset=utf-8");$conn=mysql_connect(' localhost ', ' root ', ') or die(Mysql_error());$db=mysql_select_db(' Test ',$conn) or die(Mysql_error()); for($i= 10;$i<64;$i++){ $sql=<<<SQL CREATE TABLE karate_final_{$i}(
Xxxx
XXXX) ENGINE InnoDB auto_increment73DEFAULTCharset=utf8 comment= ' stored everyones info list '; SQL; mysql_query($sql,$conn) or die(Mysql_error($conn));}Mysql_close($conn);?>
Discovery efficiency is low, and because the dev connection speed is not stable, create to 9 is over.
New method:
Create the karate_final_tmp in the database of the dev machine and generate the SQL statements locally from the script.
CREATE TABLE like karate_final_tmp;
Paste into Workbench, a total of 64, executed.
Like keyword: Creates a table that completely replicates the structure of the tables behind the like
You can also refer to the differences between the like and select keywords used here
1<?PHP2 //0-633 Header("Content-type:text/html;charset=utf-8");4 $conn=mysql_connect(' localhost ', ' root ', ') or die(Mysql_error());5 $db=mysql_select_db(' Test ',$conn) or die(Mysql_error());6 7 for($i= 0;$i<64;$i++){8 $sql. = <<<SQL9CREATE TABLE karate_final_{$i} like Karate_final_tmp;<br/>Ten SQL; One } A Mysql_close($conn); - Echo $sql; -?>
Batch generation of table on dev machine database