0 votes
59 views
in MySQL by

How to dump mysql table structure without data with a SQL query?

I want to export a mysql table by using mysql command. Only export table the structure not data.

1 Answer

0 votes
by (5k points)

If you want to export a mysql table by using mysql command (mysqldump). 

mysqldump:- Mysqldump is a backup program originally written by "Igor Romanenko". It can be used to dump a database or a collection of databases for backup or transfer to another database server (not necessarily MariaDB or MySQL). The dump typically contains SQL statements to create the table, populate it, or both. However, mysqldump can also be used to generate files in CSV, other delimited text, or XML format.

mysqldump doesn't usually consume much CPU resources on modern hardware as by default it uses a single thread. This method is good for a heavily loaded server.

See the following command to export mysql table structure without data by using command:-

mysqldump -d -h localhost -u root -p database_name > dump_file.sql

Share:- Whatsapp Facebook Facebook


Welcome to Developerhelpway Q&A, where you can ask questions and receive answers from other members of the community.

Categories

...