MySQL Forums
Forum List  »  Newbie

How to copy table to another database ?
Posted by: user norm
Date: August 08, 2018 03:25AM

This operation is so basic and is offered by all other databases db_link function.

However in MySQL this seems impossible.

I have a connection to `mySQL` on `redShift` as follows:


in `setA` I have table called: `Orders` in schema called: `onlineStore`

I want to copy this table with data to:


into schema called : `onlineStoreProduction`

the `conn` is the same for both meaning both databases are on the same cluster.

The code should be something like:

CREATE TABLE `onlineStoreProduction.Orders` LIKE `onlineStore.Orders`;
INSERT INTO `onlineStoreProduction.Orders` SELECT * FROM `onlineStore.Orders`;

However this code won't create the table in `setB`. it will create it in `setA`.

How can I solve this?

Options: ReplyQuote

Written By
How to copy table to another database ?
August 08, 2018 03:25AM

Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.