63

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

2
  • Click on central login which has Import/Export labelled below it... Commented Apr 8, 2013 at 17:00
  • mysqlworkbench5.5 There's a separate option for import/export in Server Administration. Import doesn't allow the schema to be chosen Commented Apr 8, 2013 at 17:06

4 Answers 4

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

Sign up to request clarification or add additional context in comments.

9 Comments

Thanks I'm doing the same but it says no schema selected. I'm given an option to select schema while exporting but now while importing
How to select the schema while importing
Thanks so what's to be done next? Do you know a way via mysql client ?
As I mentioned I used "MySQL Administrator 1.2.17"... Oracle discontinued this Awesome product and replaced it with MySQL Workbench. You can either download MySQL Admin (from some old sources) or use mysqldump command line utility.
There are some sources who still offer it for download. Google for it - MySQL Administrator 1.2.17
|
17
  1. Open Connetion
  2. Select "Administration" tab
  3. Click on Data import

Upload sql file

enter image description here

Make sure to select your database in this award winning GUI:

enter image description here

Comments

9

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.

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.