To generate a script from a diagram in MySQL Workbench:
- Select File > Export > Forward Engineer SQL CREATE Script...
- Enter a location to save the file (optional) and set options to include on the script (such as DROP statements etc), then click Continue
- Exclude any objects by deselecting them, otherwise leave them as is, then click Continue
- The script is generated. You can copy it to your clipboard or click Finish to save it to a file
Below are screenshots for the above steps.
Start the Process
Select File > Export > Forward Engineer SQL CREATE Script...:

SQL Export Options
Enter a location to save the file (optional) and set options to include on the script (such as DROP statements etc), then click Continue:

SQL Object Export Filter
Exclude any objects by deselecting them, otherwise leave them as is, then click Continue:

The Script
The script is generated. You can copy it to your clipboard or click Finish to save it to a file:
