How to full copy mysql table to different host/database with data and all keys?

Answered

I do right click on the source table in the list of database tables. Then select "Copy table to..." in context menu.

In popup window i choose the target database, then press <OK>

In result I see table and data, but no keys and indexes in target database.

 

How to full copy mysql table to different host/database with data and all keys?

2
11 comments

If you're trying to backup and restore a database from one host to another, you may have better luck using mysqldump. You can learn more about this here:

 

Backup: https://www.jetbrains.com/help/datagrip/export-data.html#create-a-full-data-dump-for-mysql-and-postgresql

Restore: https://www.jetbrains.com/help/datagrip/import-data.html#restore-a-full-dump-for-mysql-and-postgresql

 

0

Why we can not copy tables with indexes?

3

@... will this ever be fixed? It not only drops the indexes, primary keys but also changes the column types...

1

Up vote for the issue https://youtrack.jetbrains.com/issue/DBE-4516

But for backup / restore it's better to use native tools as mentioned earlier

0

Same problem. I dont need backup. I need just copy tables, indexes and data from production to local server.

In HeidiSQL its fast and simple task...

1

If you create two data sources for prod and local server you can select desired tables copy them via F5


0
Avatar
Permanently deleted user

Yes, but as mentioned before this does not copy indexes, primary keys etc.

0

So, then it could be done in a bit different way:

  1. Generate DDL to Query Console / to Clipboard
  2. Execute DDL script in target database
  3. Import data from Files

 

0

Do you guys have a plan to fix the bug?

0

This feature need be fixed because it doesn’t match user expectations.

0
There's currently no ETA on the fix implementation. Please follow this issue to stay updated on the progress

https://youtrack.jetbrains.com/issue/DBE-4516/Copy-Table-Support-copying-constraints-and-indexes-too
0

Please sign in to leave a comment.