简体   繁体   English

在MYSQL Workbench中将数据从一个mysql数据库访问到另一个数据库

[英]Accesing data from one mysql database to another in MYSQL Workbench

I have two different databases. 我有两个不同的数据库。 I have to access data from one database and insert them into another ( with some data processing included, it is not only to copy data ) Also, the schema is really complex and each table has many rows, so copying data into schema in the second database is not an option. 我必须从一个数据库访问数据并将其插入到另一个数据库中(包括一些数据处理,不仅要复制数据)而且,该架构真的很复杂,每个表都有很多行,因此在第二个数据库中将数据复制到架构中数据库不是一种选择。 I have to do that using MySQL Workbench, so I have to do it using SQL queries. 我必须使用MySQL Workbench来做到这一点,所以我必须使用SQL查询来做到这一点。 Is there a way to create a connection from one database to another and access its data? 有没有一种方法可以创建从一个数据库到另一个数据库的连接并访问其数据?

While MySQL Workbench can be used to transfer data between servers (eg as part of a migration process) it is not useful when you have to process the data first. 尽管可以使用MySQL Workbench在服务器之间传输数据(例如,作为迁移过程的一部分),但在必须首先处理数据时它没有用。 Instead you have 2 other options: 相反,您有2个其他选择:

  1. Use a dedicated tool you write yourself to do that (as eddwinpaz mentioned). 使用您自己编写的专用工具来做到这一点(如eddwinpaz所述)。
  2. Use the capabilities of your server. 使用服务器的功能。 That is, copy the data to the target server, into a temporary table (using dump and restore). 也就是说,将数据复制到目标服务器,并复制到临时表中(使用转储和还原)。 Then use queries to modify the data as you need it. 然后使用查询根据需要修改数据。 Finally copy it to the target table. 最后将其复制到目标表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM