Karthik Malla
Karthik Malla

Reputation: 5800

How to generate SQL queries

I am using phpMyAdmin to create database tables and fields. I have 100's of tables in a single database. Now I need to make the same on few more servers.

I feel it's too hard to write SQL queries to create that database. Is there any reverse process to generate an SQL query file from phpMyAdmin or anyother tool? I want to create a database in a GUI, and I need the SQL query for my database. Is there any tool to generate it automatically?

Upvotes: 0

Views: 2621

Answers (2)

Marko Aleksić
Marko Aleksić

Reputation: 1591

If I understood you correctly, you want to export a database (with many tables) using phpMyAdmin, and then import it and use it on another server.

Yes. You can do that.

Select the database on the left-hand side in phpMyAdmin and then: Export -> Select All Tables -> Adjust Options -> Go.

You are going to get <youdatabasename>.sql file, with all the table definitions inside. Then you can import it in another phpMyAdmin or other database handler.

Upvotes: 4

Ocaso Protal
Ocaso Protal

Reputation: 20237

You can use mysqldump to do this. Then --nodata switch should do what you want.

Upvotes: 0

Related Questions