+1 vote
in Programming by

I have a database in different server now I have to export table schema and also have to download it in my local .

If possible, please let me know the command for exporting table with data also.


1 Answer

+1 vote
by Expert (5.9k points)
selected by
Best answer

You can use  --no-data option with mysqldump see

mysqldump -u root -p --no-data dbname > schema.sql


For backup use :  mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql  


For restore use : mysql -u root -p[root_password] [database_name] < dumpfilename.sql


Now you can do scp to your local like this :


scp user@serverip:/home/user/schema.sql .     (If using windows so please execute these commands on putty.) 

I hope it helped you! 

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated