0

I have two Mysql databases on different servers.

I need to update the Server 2 database from Server 1, but both database tables structure is different. I have to create a stored procedure to connect both servers so I can make changes in the database.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Rahul
  • 223
  • 1
  • 2
  • 10

1 Answers1

0

I am not a MySQL expert, so I can't tell you exact specifics. I looked through guides and other questions to see how it can be done and it appears that exact same principle I used in other databases applies to MySQL.

  • You need to Setup a remote database connection. Usually in doing so you will specify a name for that database. This is the only tricky thing in your question because of few reasons. One of them being not all platforms, that the database is installed onto, seem to support external connections and the other is that you need to set the 2nd database up for remote connections. I found this guide/article explaining how to set it up, but you might need to look for another one that fits your setup.
  • When forming your query specify database name (that you specified in previous step) before table name. The rest of the query structure is the same, but bare in mind that large/complex joins across 2 servers might be slow without manual optimization. This answer shows what your queries should look like when you setup a remote database connection.
Zero
  • 1,562
  • 1
  • 13
  • 29