Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I import data into mysql database via mysql workbench?

I created a database in mysql. I have a .sql file. how can i import it into my database via mysql workbench ?

like image 317
Abhishek Avatar asked Apr 08 '13 16:04

Abhishek


People also ask

How do I import and export data from MySQL Workbench?

Use this wizard to either export or import SQL generated from MySQL Workbench or with the mysqldump command. Access these wizards from either the Navigator area of the sidebar, or by selecting Server from the main menu, and then either Data Import or Data Export.


2 Answers

  • 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).

like image 64
Vishy Avatar answered Sep 28 '22 19:09

Vishy


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.

like image 23
aunindo Avatar answered Sep 28 '22 19:09

aunindo