3

I have 2 devices, a server computer installed with SQL Server 2012, and a raspberry pi with MySQL installed. I have data in MySQL tables. How can I connect SQL Server 2012 to MySQL so I can save that data?

7
  • 1
    Linked Server via ODBC connection? sqlshack.com/…
    – SQLDevDBA
    Mar 12, 2018 at 17:18
  • i have to install the ODBC software in both devices? raspberry device its a Linux OS. Mar 12, 2018 at 17:20
  • Shouldn't have to install on the Pi as long as there is a port open on it. Research to see what the standard port is for MySql. Looks like it's 3306? dev.mysql.com/doc/workbench/en/… So the provider might just be IPAddress:3306\SID
    – SQLDevDBA
    Mar 12, 2018 at 17:52
  • the only way to do it, its using ODBC? or there are differents ways ? Mar 12, 2018 at 18:18
  • 1
    Thanks so much, i did the connection using ODBC... works really good! Mar 13, 2018 at 15:27

1 Answer 1

2

One easy way to do this is with HeidiSQL, which can connect to SQL Server and MySQL and is free and open source (https://www.heidisql.com/). Once you set up both connections, you can use the Export Database As SQL feature to transfer data directly between databases.

  • In the Session Manager, set up the connection to the MySQL and SQL Server computers
  • Connect to the MySQL server, right-click on the server in the browser on the left, and select "Export Database As SQL".
  • in the table list, select the table(s) you would like to export
  • in the Output: on the right, you will see a list of all servers you have configured in the Session Manager. Select the SQL Server 2012 instance.
  • You will probably want to keep the database the same so leave it as [Same as on source server]
  • You likely will want to check the create boxes for both database and tables if this is the 1st time you are transferring data
  • If you want to transfer the data and not just the table structure, in the Data: dropdown select the option that is best for you. I usually use Delete + insert (truncate existing data), but your needs may be different.
  • Click Export in the bottom right

That should do it.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.