How can I transfer data between 2 MySQL databases?

前端 未结 5 1975
误落风尘
误落风尘 2020-12-14 08:08

I want to do that using a code and not using a tool like \"MySQL Migration Toolkit\". The easiest way I know is to open a connection (using MySQL connectors) to DB1 and read

5条回答
  •  我在风中等你
    2020-12-14 08:20

    The FEDERATED storage engine? Not the fastest one in the bunch, but for one time, incidental, or small amounts of data it'll do. That is assuming you're talking about 2 SERVERS. With 2 databases on one and the same server it'll simply be:

    INSERT INTO databasename1.tablename SELECT * FROM databasename2.tablename;
    

提交回复
热议问题