user9644796
user9644796

Reputation:

Import data to MySQL Workbench

I have a database with 6 tables, and I want to import these tables to an existing database within MySQL Workbench.

I used phpMyAdmin to export the database to a .sql file, and imported it to MySQL Workbench using "Data Import/Restore" button, but nothing happened(I don't know where this file is now in MySQL Workbench, I did get an import success message, but where exactly did this database go?). Then I tried a .CSV file, but it doesn't seem to work because it also saved the entire database, and MySQL Workbench expects only separate tables(Or not?)

Do I have to create each table separately and import data to each table individually?

Or, there is a better way to copy database content to an existing database in MySQL Workbench?

Thanks

Upvotes: 4

Views: 10762

Answers (3)

novice2ninja
novice2ninja

Reputation: 471

  1. Check whether your exported file has only data or both structure and data. If your exported file only contain data, then check the point 3
    In MySQL Workbench, we can easily export with both Structure and Data. Check the attached screenshot:

how to export database using workbench

  1. If you have already exported your database with proper format, then here's few point you need to consider before you import a file using MySQL Workbench
  • If you want to import to a new database, then you have to create a new database inside your database connection or workbench connection.
  • If you want to use an already existing database, then no need to create a new one.
  • In workbench select the database, please check attached the screenshot

how to import database using workbench

  1. If you exported database only contains data, then you have to create all the tables inside your new database.

Upvotes: 1

benson Njung'e
benson Njung'e

Reputation: 159

while exporting your phpmyadmin database use the Custom - display all possible options

Upvotes: 0

Jagrut Sharma
Jagrut Sharma

Reputation: 4754

You can use MySQL Workbench to import into an existing schema.

Server -> Data Import -> Import from self-contained file -> Default Target Schema

enter image description here

Upvotes: 8

Related Questions