Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import database schema

I am having a mysqldump file which contains schema as well as data dump.

I need to import only database schema from my sqldump. I tried with following command:

mysql -uUSER -pPASSWORD < filename.sql

but of no help. it imports both schema as well as data.

How can I do it?

like image 643
Rahul Shelke Avatar asked Feb 24 '23 21:02

Rahul Shelke


1 Answers

Just in case you don't want to dump everything again and you just need it for some quick tests you could also cheat very dirty by using

grep -ve '^INSERT' dump.sql > dump-no-data.sql

Don't use this for production environments though.

like image 93
COMMANDER CAPSLOCK Avatar answered Feb 26 '23 21:02

COMMANDER CAPSLOCK