How to generate SQL create table script using phpMyAdmin

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.

  1. Log into phpMyAdmin
  2. Using the left hand menu, find and open the table you want to create the create table script for
  3. Take note of the table name, in this example it is wp_options
  4. Click on the ‘SQL’ tab at the top of the window
  5. In the box, enter the following SQL query, where tablename is the name of your table from step 4
  6. SHOW CREATE TABLE tablename
  7. Click on the ‘GO’ button to run the query
  8. Now click on the ‘Options’ link below, select ‘Full texts’ – this will make the full create script display below
  9. Click on the ‘GO’ button
  10. The full create script will be displayed below. This script can be ran on another SQL server to exactly recreate the table.

Related Articles

One comment on “How to generate SQL create table script using phpMyAdmin

Leave a Reply

Your email address will not be published.