How to import a specific table from a .sql file in DataGrip?

645 Views Asked by At

I accidentally DROP a column from a table in a database. I want to restore that column, luckily I have an .sql file of a backup this morning. I use DataGrip.

Is there a way to import only that table from the .sql file? That way I will not have to reset all other tables too (that other people are working on).

1

There are 1 best solutions below

0
On

What I ended up doing was

  • create a temporary database: mysqladmin -u root -p create temp
  • restore the .sql into it mysql -u root -p restore < mydump.sql
  • dump the specific table mysqldump -u root -p restore mytable > mytable.sql

Import the file in DataGrip, right-click the tab and press 'Run...' and set your database as target.