I created a database in mysql. I have a .sql file. how can i import it into my database via mysql workbench ?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
- Under Server Administration on the Home window select the server instance you want to restore database to (Create New Server Instance if doing it first time).
- Click on Manage Import/Export
- Click on Data Import/Restore on the left side of the screen.
- Select Import from Self-Contained File radio button (right side of screen)
- Select the path of .sql
- Click Start Import button at the right bottom corner of window.
Hope it helps.
---Edited answer---
Regarding selection of the schema. MySQL Workbench (5.2.47 CE Rev1039) does not yet support exporting to the user defined schema. It will create only the schema for which you exported the .sql... In 5.2.47 we see "New" target schema. But it does not work. I use MySQL Administrator (the old pre-Oracle MySQL Admin beauty) for my work for backup/restore. You can still download it from Googled trustable sources (search MySQL Administrator 1.2.17).
回答2:
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.