how to migrate database from mysql to mssql? - mysql

I have a web server in php and my sql .Now I have to upgrade the same server from my php to asp and my sql to mssql.
I have to write the whole php code in asp but I think I can direct migrate the database from my sql to mssql to save much more time. in the my sql database there is no user input data as it the new totaly server.
Just I want to take whole structure of the database to the mssql.
After google some time there is a tool from microsoft called(Microsoft SQL Server Migration Assistant for MySQL) when I try to migrate the database I got an error that the destination table doesnot exit .
can some body help me to migrate the database including keys from mysql to mssql

Related

How to connect Azure Database for MySQL flexible server in Azure SQL Server Database

I am trying to set up a connection between Azure MySQL flexible server and Azure SQL database mainly to read data from MySQL and store it in the SQL Server periodically (multiple times a day).
I was thinking of creating a stored procedure inside my SQL Server database; however, I cannot seem to get a connection from the SQL Server into the MySQL database.
I know with ODBC you can connect MySQL to on-prem SQL Server, but unfortunately, there is nothing I have found for the same functionality for Azure SQL Server.
Has anyone done this? Is this possible?
I have tried to set up an ODBC connection, but it did not work as the SQL Server is on Azure.
I tried setting up a linked server inside SQL Server straight to MySQL, but it doesn't seem possible as the SQL Server is not on-prem.
I tried creating external database objects based on the following link.
With all these approaches, my expectation was to surface the MySQL tables from Azure SQL Server/SSMS.
Thank you for your help in advance!
MySql Workbench is the perfect option for connecting the azure database for mysql.
for that we need to create flexible server in azure portal. I created flexible server in azure portal.
Image for reference:
I created database in flexible server by clicking add in in database option. it crated successfully.
Image for refence:
I installed MySQL Workbench in my local system.
you can get your required fields to connect the server in connect tab.
Image for reference:
I connected to the server by filling required fields.
Image for reference:
Click on ok. It connected successfully.
Image for reference:
AFAIK Export the data from Azure mysql flexible server in the form of sql script through MySQL work bench and import that file in Azure sql database through SSMS. IN this we can write data into Azure Sql database.
I have had to create an Azure Function App that contains a Timer function that reads the data from the MySQL data and pushes it to SQL Server every 15 minutes (as were the requirements).
Thank you for everyone for commenting.
It seems you can use Data-in replication.

Link and export data from Azure SQL table to my SQL table

Is there any possibility to export and create a link between one of the table from Azure SQL DB to the table in MySQL DB?
Firstly, you can migrate data from SQL server to your MySQL database. And there are many ways can help you achieve that. You can reference this blog :How to migrate SQL Server database to MySQL?.
But for Azure, you could not copy or migrate data from Azure SQL database to your on-premise MySQL DB, even with Azure Data Factory. Azure Data Factory only support MySQL as source server.
Secondly, You want to sync the data between Azure SQL database and your MySQL database. Azure SQL Data Sync only support Azure SQL Database and on-premise SQL Server instance.
This means that Azure could not help you migrate or sync data from Azure SQL data base to MySQL DB. You have to use third-party tools.
One of the ways is you can use MySQL Workbench Migration tool. Database migrations - enables migrations from Microsoft SQL Server, Microsoft Access, PostgreSQL, Sybase ASE, Sybase SQL Anywhere, SQLite, and more.
There are many tools to perform the migration from MS SQL Server to MySQL like Amazon DMS or Data Integration (Kettle), but in this case, we’ll use the MySQL Workbench Migration tool.
Please reference this tutorial: How to Migrate from MSSQL to MySQL.
Hope this helps.

How to load data from MySql to MS SQL Server database?

I have similar schema in both MySQL and MSSQL Server databases. How can I migrate just the data from MySql to an empty (no data) MSSqlServer database? MSSqlServer DB is empty with just the schema. I could not configure the MySql DB as a linked server (through ODBC) since I don't have DB Admin rights on MSSqlServer. I just have previleges to add data. I explored Sql Server Migration Assistant for MySQL, but I just want to migrate data without touching the schema at the target.
I also noticed that there is a SqlBulkCopy class which helps to programatically migrate data in .NET.
But I need to write code for each table (there are more than 100 tables and 20 GB of data).
What is the most elegant way to do it?
SSMA might be the easiest. Since you don't wanna use that, you can try using mysqldump. You can use it to essentially dump a MySQL db to SQL Server.
Link to the SSMA blog, they update these tools regularly, so check for a later version. SQL Server Migration Assistant (SSMA) Team's Blog

How to access remote MicroSoft SQL Server database from a stored procedure in MySQL

I need to access a remote Microsoft SQL Server database from a stored procedure in MySQL database.
I googled and found that there is a way to access a remote MySQL using federated tables. But I couldn't find anyway to do access MS SQL Server. My exact requirement is, I need to write a stored procedure which can duplicate all the tables and data from a remote MS SQL server database to a local MYSQL database.
Please help..
In short this cannot be done with MySQL federated engine. However you can setup a link from the remote MSSQL server to a MySQL table using the linked server feature of the MSSQL server.
If you can set this up you can have a scheduled job populate the MySQL tables from the MSSQL server side.
I have done the above setup and it is not to difficult.
I would also investigate some ETL tool to do this as it sounds like a ETL job and not something you want to run via stored procedures.
Good Luck.

Migrating a wordpress site from azure sql to Mysql

I need to migrate a mysql db including data from ms azure to my regular hosting provider. I already have an empty db waiting there.
The db contains a wordpress+woocommerce and various plugin tables.
Plz help..
Everywhere i find migrating from Mysql to sql but not Sql to Mysql
You should try MySQL Workbench which can easily do a migration from SQL Server (and Azure DB) to MySQL. The migration can be on the fly or it can result in some .sql scripts that you have to load in you MySQL database using your regular client (phpMyAdmin, EMMA or of course, MySQL Workbench).
You can find additional information about the migration capabilities of MySQL Workbench here.