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. phpMyAdmin-ScriptCreate1
  4. Take note of the table name, in this example it is wp_options
  5. Click on the ‘SQL’ tab at the top of the window
  6. In the box, enter the following SQL query, where tablename is the name of your table from step 4
  7. SHOW CREATE TABLE tablename
  8. phpMyAdmin-ScriptCreate2
  9. Click on the ‘GO’ button to run the query
  10. Now click on the ‘Options’ link below, select ‘Full texts’ – this will make the full create script display below
  11. Click on the ‘GO’ button
  12. phpMyAdmin-ScriptCreate3
  13. The full create script will be displayed below. This script can be ran on another SQL server to exactly recreate the table.
  14. phpMyAdmin-ScriptCreate4

Related Articles

2 comments on “How to generate SQL create table script using phpMyAdmin

Leave a Reply

Your email address will not be published.