62

Is there some way to get phpMyAdmin to spit out the SQL needed to duplicate the table in another DB?

I saved it when I initially made the table but I've changed it quite a bit since then. It's a pretty big table and this would really help.

1
  • 2
    Alternatively, the straight MySQL syntax to get that would be: SHOW CREATE TABLE table_name;
    – fideloper
    Nov 3, 2012 at 15:31

2 Answers 2

105

Yes, you can navigate to the table you want and then go to (tab) Operations > Copy table to (database.table):, which is a box on the right hand side. There you can define into which database and under what name you'd like to copy your table. After having done than you get the SQL "spat out".

As I'm not completely sure about your question, if you'd like to have the table in a dump file, you could alternatively click the tab Export, where you can get the SQL as well, or download the dump file straight away.

1
  • Yes, indeed :) And Import does the opposite, just there would be a limitation to the size of the dump file, due to the php.ini's settings.
    – Havelock
    Nov 3, 2012 at 15:39
3

You can use the Export tab to select which table to export. In the diagram below,

  • the album table is specified
  • Structure is checked
  • Data is unchecked - to not generate data with the export
  • SQL radio button is checked
  • ...
  • Click on the Go button at the bottom to have the generated SQL

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.