The following steps show how to create an SQL create script using phpMyAdmin.
This can be helpful if you have a custom table in a development environment and need to recreate it in the producation environment, or need to automate the create 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, where tablename is the name of your table from step 4
SHOW CREATE TABLE tablename
- Click on the ‘GO’ button to run the query
- Now click on the ‘Options’ link below, select ‘Full texts’ – this will make the full create script display below
- Click on the ‘GO’ button
- The full create script will be displayed below. This script can be ran on another SQL server to exactly recreate the table.