The following steps show how to create an SQL “create table” script – based on an existing table – using phpMyAdmin.
This can be helpful if you have a table in a development environment and need to recreate it in the production environment, or need to automate the creating table.
- Log into phpMyAdmin
- Using the left hand menu, find and open the table you want to create the create table script for
- Take note of the table name, in this example it is wp_options
- Click on the ‘SQL’ tab at the top of the window
- In the box, enter the following SQL query – making sure to replace tablename with the name of your table from step 4
SHOW CREATE TABLE tablename
- Click on the ‘GO’ button (bottom right corner) to run the query
- Now click on the ‘Options’ link below
- Select ‘Full Texts’
- Click on the ‘GO’ button
- The full “create table” script will be displayed below. This script can be ran on another SQL server to exactly recreate the table.