{"id":25363607,"url":"https://github.com/tcd93/mysql-to-mssql","last_synced_at":"2026-05-09T15:14:34.759Z","repository":{"id":137012168,"uuid":"322457219","full_name":"tcd93/mysql-to-mssql","owner":"tcd93","description":"A tool written in pure Go to synchronize changes from MySQL to MSSQL in real-time","archived":false,"fork":false,"pushed_at":"2021-01-18T10:06:02.000Z","size":161,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T22:38:52.955Z","etag":null,"topics":["binlog","golang","mssql","mysql","synchronization","synchronize-changes"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tcd93.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-18T01:35:13.000Z","updated_at":"2024-12-11T15:18:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"0d4e0337-f6e7-4bab-9bd8-9ab124f9f53c","html_url":"https://github.com/tcd93/mysql-to-mssql","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcd93%2Fmysql-to-mssql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcd93%2Fmysql-to-mssql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcd93%2Fmysql-to-mssql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcd93%2Fmysql-to-mssql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tcd93","download_url":"https://codeload.github.com/tcd93/mysql-to-mssql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247975323,"owners_count":21026851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binlog","golang","mssql","mysql","synchronization","synchronize-changes"],"created_at":"2025-02-14T22:35:32.811Z","updated_at":"2026-05-09T15:14:29.729Z","avatar_url":"https://github.com/tcd93.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MySQL-to-MSSQL\nThis is a simple server for synchronizing changes (CUD operations) from MySQL source database to MSSQL target database.   \n\nThe architecture is simple:\n1. parser: listen to changes from source db (via binlog)\n2. changes will be logged into an embedded database\n3. syncer: scan the log store \u0026 sync logged events to target db on a fixed interval\n## DEMO:\n**MYSQL**\n1. Set up local MYSQL instance with user **root/root**\n2. Use the `staff` table in `sakila` schema that comes with MySQL 8.0 installation package (demo db)  \n\n**MSSQL**\n1. Set up local MSSQL instance (2008+)\n2. \u003cdetails\u003e\n    \u003csummary\u003eEnable TCP/IP in Configuration Manager\u003c/summary\u003e\n\n    ![](img/1.Sql_Server_Configuration_Manager.png)   \n    \u003c/details\u003e\n3. \u003cdetails\u003e\n        \u003csummary\u003eCreate table \u003cb\u003eStaff\u003c/b\u003e with same column names as MYSQL\u003c/summary\u003e\n\n    ```sql\n    CREATE TABLE [dbo].[Staff](\n        [staff_id] int NOT NULL primary key,\n        [first_name] varchar(50) NOT NULL,\n        [last_name] varchar(50) NOT NULL,\n        [address_id] smallint NOT NULL,\n        [picture] varbinary(max) NULL,\n        [email] varchar(50) NULL,\n        [store_id] smallint NOT NULL,\n        [active] bit NOT NULL,\n        [username] varchar(50) NULL,\n        [password] varchar(50) NULL,\n        [last_update] [datetime] NOT NULL,\n    )\n    ALTER TABLE [dbo].[Staff] SET (LOCK_ESCALATION = AUTO)\n    ```\n    \u003c/details\u003e\n    \n**GO**\n1. Install [go 1.14 amd64](https://golang.org/dl/go1.14.12.windows-amd64.msi). **Note that this library has not work with go \u003e=1.15 yet, and it does not support 32-bit platforms** :warning:\n2. Clone this repo to local machine, example: `d:\\demo`\n3. CD into directory (`cd d:\\demo`)\n4. Execute `go run .` It should start the Echo server\n5. \u003cdetails\u003e\n    \u003csummary\u003e\n        Send a POST request to \u003ccode\u003e/struct/put\u003c/code\u003e to let server knows about the table structure. \n        For details about type enum, see \u003ca href=\"./db/types.go\"\u003edb/types.go\u003c/a\u003e\n    \u003c/summary\u003e\n    \n    ```json\n    //deliberately removed \"username\" \u0026 \"password\" from the request, so these 2 fields won't be synced\n    {\n        \"table\":\"staff\",\n        \"columns\": [\n            {\n                \"name\": \"staff_id\",\n                \"type\": 1,\n                \"is_primary\": true // currently a PK must be defined, otherwise server won't know how to handle update/delete\n            },\n            {\n                \"name\": \"first_name\",\n                \"type\": 5\n            },\n            {\n                \"name\": \"last_name\",\n                \"type\": 5\n            },\n            {\n                \"name\": \"picture\",\n                \"type\": 18\n            },\n            {\n                \"name\": \"address_id\",\n                \"type\": 1\n            },\n            {\n                \"name\": \"store_id\",\n                \"type\": 1\n            },\n            {\n                \"name\": \"email\",\n                \"type\": 6\n            },\n            {\n                \"name\": \"last_update\",\n                \"type\": 9\n            },\n            {\n                \"name\": \"active\",\n                \"type\": 7\n            }\n        ]\n    }\n    ``` \n    \u003c/details\u003e\n6. \u003cdetails\u003e\n    \u003csummary\u003e\n        Send a POST request with MySQL db info to \u003ccode\u003e/parser/start\u003c/code\u003e to start listening for changes\n    \u003c/summary\u003e\n    \n    ```json\n    {\n\t    \"server_id\": 1,\n\t    \"addr\": \"127.0.0.1:3306\",\n\t    \"user\": \"root\",\n\t    \"password\": \"root\",\n\t    \"use_decimal\": true,\n\t    \"include_table_regex\": [\"sakila\\\\.staff\"] //listen to changes from sakila.staff table only!\n    }\n    ```\n    \u003c/details\u003e\n7. \u003cdetails\u003e\n    \u003csummary\u003e\n        Send another POST request with MSSQL db info to \u003ccode\u003e/syncer/start\u003c/code\u003e to start syncing changes received from \u003ci\u003eparser\u003c/i\u003e\n    \u003c/summary\u003e\n    \n    ```json\n    {\n        \"server\": \"127.0.0.1\",\n        \"database\": \"master\", //where Staff table is\n        \"log\": 63, //full logging\n        \"appname\": \"mysql-to-mssql\" //the programe_name in dm_exec_sessions\n    }\n    ```\n    \u003c/details\u003e\n##### :fire: Make changes \u0026 see sync :fire:\n## FAQ:\n#### 1. Why not SSIS?\n- No real time support\n- Incremental load requires something like `lastupdated` column from source table\n\n#### 2. Why not trigger?\n- Hard to maintain, you may not have full control to this trigger\n- SQL Developers might be unaware of this side effect\n- Slower performance (for example, trigger fires whenever a row is updated, whereas binlog only capture the final commited data once)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftcd93%2Fmysql-to-mssql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftcd93%2Fmysql-to-mssql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftcd93%2Fmysql-to-mssql/lists"}