Reputation:
I want to copy a Database without copying its data, I mean I just want to copy the stucture and tables and foreign key and ... not the data in it. The answer is here but I do not know where should I copy it ? In shell? In workbench? In query? I entered it in query in workbenck and it has error ! Thank you in advance!
Edit
When I run it in my mysql shell I get this:
MySQL JS > mysqldump -u myusername -pmypassword -d olddb | mysql -u myusername -pmypassword -D newdb
SyntaxError: Unexpected identifier.
Upvotes: 0
Views: 97
Reputation: 1077
You'll need to run it on the command line for your OS (not the shell for MySQL as you tried earlier).
Under Linux (including Macs) it would look something like:
smm@smm-HP-ZBook-15-G2:~/$ mysqldump -u myusername -pmypassword -d olddb | mysql -u myusername -pmypassword -D newdb
Under Windows:
C:\> mysqldump -u myusername -pmypassword -d olddb | mysql -u myusername -pmypassword -D newdb
This is assuming mysqldump is in the PATH for your command line (it isn't if you get a command not found error). How to use a command line and set up the PATH depends on the OS and is beyond the scope of this answer.
Upvotes: 1