How to generate SQL create table script using phpMyAdmin

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.

  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 – making sure to replace tablename with the name of your table from step 4
  7. SHOW CREATE TABLE tablename
  8. phpMyAdmin-ScriptCreate2
  9. Click on the ‘GO’ button (bottom right corner) to run the query
  10. Now click on the ‘Options’ link below
  11. Select ‘Full Texts’
  12. Click on the ‘GO’ button
  13. phpMyAdmin-ScriptCreate3
  14. The full “create table” script will be displayed below. This script can be ran on another SQL server to exactly recreate the table.
  15. phpMyAdmin-ScriptCreate4

Related Articles

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

Leave a Reply

Your email address will not be published.