I created a database in mysql. I have a .sql file. how can i import it into my database via mysql workbench ?
This question is related to
mysql
mysql-workbench
For MySQL Workbench 6.1: in the home window click on the server instance(connection)/ or create a new one. In the thus opened 'connection' tab click on 'server' -> 'data import'. The rest of the steps remain as in Vishy's answer.
For MySQL Workbench 8.0 navigate to:
Server > Data Import
A new tab called Administration - Data Import/Restore appears. There you can choose to import a Dump Project Folder or use a specific SQL file according to your needs. Then you must select a schema where the data will be imported to, or you have to click the New... button to type a name for the new schema.
Then you can select the database objects to be imported or just click the Start Import button in the lower right part of the tab area.
Having done that and if the import was successful, you'll need to update the Schema Navigator by clicking the arrow circle icon.
That's it!
For more detailed info, check the MySQL Workbench Manual: 6.5.2 SQL Data Export and Import Wizard
Source: Stackoverflow.com