[{"data":1,"prerenderedAt":652},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fintegration\u002Fmysql-writer":3},{"id":4,"title":5,"body":6,"description":643,"extension":644,"meta":645,"navigation":646,"path":647,"redirect":648,"seo":649,"stem":650,"__hash__":651},"docs\u002Fdocs\u002Fintegration\u002Fmysql-writer\u002Findex.md","MySQL Target Configuration",{"type":7,"value":8,"toc":630},"minimark",[9,13,17,20,25,28,111,114,137,151,155,158,216,234,238,245,253,257,264,269,296,397,408,419,452,456,459,468,472,479,483,490,497,559,569,573,596,600,626],[10,11,5],"h1",{"id":12},"mysql-target-configuration",[14,15,16],"p",{},"Use this page when MySQL is the target for a DBConvert Streams workflow.",[14,18,19],{},"MySQL targets receive data from both Load and CDC streams. The source can be MySQL, PostgreSQL, local files, or S3-compatible storage.",[21,22,24],"h2",{"id":23},"target-privileges","Target privileges",[14,26,27],{},"The target user needs write access to the target database. The exact privileges depend on the stream configuration:",[29,30,31,44],"table",{},[32,33,34],"thead",{},[35,36,37,41],"tr",{},[38,39,40],"th",{},"Privilege",[38,42,43],{},"When needed",[45,46,47,59,69,79,96],"tbody",{},[35,48,49,56],{},[50,51,52],"td",{},[53,54,55],"code",{},"INSERT",[50,57,58],{},"Always — all streams write rows",[35,60,61,66],{},[50,62,63],{},[53,64,65],{},"CREATE",[50,67,68],{},"When structure options allow table\u002Findex creation",[35,70,71,76],{},[50,72,73],{},[53,74,75],{},"ALTER",[50,77,78],{},"When structure options create indexes or constraints on existing tables",[35,80,81,86],{},[50,82,83],{},[53,84,85],{},"DROP",[50,87,88,89,92,93],{},"When ",[53,90,91],{},"schemaPolicy"," is ",[53,94,95],{},"drop_and_recreate",[35,97,98,103],{},[50,99,100],{},[53,101,102],{},"TRUNCATE",[50,104,88,105,92,108],{},[53,106,107],{},"writeMode",[53,109,110],{},"truncate_and_load",[14,112,113],{},"Example grant for a target user that can create and write:",[115,116,121],"pre",{"className":117,"code":118,"language":119,"meta":120,"style":120},"language-sql shiki shiki-themes github-light github-dark","GRANT INSERT, CREATE, ALTER, DROP ON target_db.* TO 'target_user'@'%';\nFLUSH PRIVILEGES;\n","sql","",[53,122,123,131],{"__ignoreMap":120},[124,125,128],"span",{"class":126,"line":127},"line",1,[124,129,130],{},"GRANT INSERT, CREATE, ALTER, DROP ON target_db.* TO 'target_user'@'%';\n",[124,132,134],{"class":126,"line":133},2,[124,135,136],{},"FLUSH PRIVILEGES;\n",[14,138,139,140,145,146,150],{},"For connection and network setup, see ",[141,142,144],"a",{"href":143},"\u002Fdocs\u002Fconnections\u002Fmysql-server","MySQL Server Configuration",". To verify visible tables and schemas, open the connection in ",[141,147,149],{"href":148},"\u002Fdocs\u002Fdatabase-explorer\u002F","Data Explorer",".",[21,152,154],{"id":153},"target-behavior","Target behavior",[14,156,157],{},"Two settings control what the stream does with existing target tables and data:",[29,159,160,176],{},[32,161,162],{},[35,163,164,167,170,173],{},[38,165,166],{},"Setting",[38,168,169],{},"What it controls",[38,171,172],{},"Default (Load)",[38,174,175],{},"Default (CDC)",[45,177,178,197],{},[35,179,180,184,187,192],{},[50,181,182],{},[53,183,91],{},[50,185,186],{},"What to do if target tables already exist",[50,188,189],{},[53,190,191],{},"fail_if_exists",[50,193,194],{},[53,195,196],{},"validate_existing",[35,198,199,203,206,211],{},[50,200,201],{},[53,202,107],{},[50,204,205],{},"What to do if target tables contain rows",[50,207,208],{},[53,209,210],{},"fail_if_not_empty",[50,212,213],{},[53,214,215],{},"upsert",[14,217,218,219,221,222,225,226,228,229,233],{},"CDC mode supports ",[53,220,215],{}," (default, recommended) and ",[53,223,224],{},"append",". Use ",[53,227,224],{}," for insert-only workloads where you want maximum write throughput. See ",[141,230,232],{"href":231},"\u002Fdocs\u002Fstreams\u002Ftarget-data-policies","Target Schema and Data Policies"," for all values and decision guidance.",[21,235,237],{"id":236},"structure-creation","Structure creation",[14,239,240,241,150],{},"By default, the stream creates missing tables, indexes, foreign keys, and check constraints on the target. Disable any of these with ",[141,242,244],{"href":243},"\u002Fdocs\u002Fstreams\u002Fdatabase-structure-options","structure options",[14,246,247,248,252],{},"When the source is PostgreSQL, data types are converted automatically. See ",[141,249,251],{"href":250},"\u002Fdocs\u002Fintegration\u002Ftranslate-ddl","Table Structure Conversion"," for the full mapping.",[21,254,256],{"id":255},"performance-tuning","Performance tuning",[14,258,259,260,263],{},"For high-volume streams (millions of rows), MySQL server settings have a significant impact on write throughput. The defaults prioritize durability over speed — every transaction commit triggers an ",[53,261,262],{},"fsync"," to disk. Relaxing these settings can improve write performance by 2–5x.",[265,266,268],"h3",{"id":267},"recommended-settings-for-bulk-loads-and-cdc","Recommended settings for bulk loads and CDC",[115,270,272],{"className":117,"code":271,"language":119,"meta":120,"style":120},"SET GLOBAL innodb_flush_log_at_trx_commit = 2;\nSET GLOBAL sync_binlog = 0;\nSET GLOBAL innodb_io_capacity = 2000;\nSET GLOBAL innodb_io_capacity_max = 4000;\n",[53,273,274,279,284,290],{"__ignoreMap":120},[124,275,276],{"class":126,"line":127},[124,277,278],{},"SET GLOBAL innodb_flush_log_at_trx_commit = 2;\n",[124,280,281],{"class":126,"line":133},[124,282,283],{},"SET GLOBAL sync_binlog = 0;\n",[124,285,287],{"class":126,"line":286},3,[124,288,289],{},"SET GLOBAL innodb_io_capacity = 2000;\n",[124,291,293],{"class":126,"line":292},4,[124,294,295],{},"SET GLOBAL innodb_io_capacity_max = 4000;\n",[29,297,298,313],{},[32,299,300],{},[35,301,302,304,307,310],{},[38,303,166],{},[38,305,306],{},"Default",[38,308,309],{},"Recommended",[38,311,312],{},"Effect",[45,314,315,337,358,378],{},[35,316,317,322,328,334],{},[50,318,319],{},[53,320,321],{},"innodb_flush_log_at_trx_commit",[50,323,324,327],{},[53,325,326],{},"1"," (fsync every commit)",[50,329,330,333],{},[53,331,332],{},"2"," (fsync once per second)",[50,335,336],{},"Largest single improvement. Reduces disk I\u002FO per transaction.",[35,338,339,344,349,355],{},[50,340,341],{},[53,342,343],{},"sync_binlog",[50,345,346,348],{},[53,347,326],{}," (fsync every binlog event)",[50,350,351,354],{},[53,352,353],{},"0"," (OS-managed flush)",[50,356,357],{},"Reduces binlog write overhead.",[35,359,360,365,370,375],{},[50,361,362],{},[53,363,364],{},"innodb_io_capacity",[50,366,367],{},[53,368,369],{},"200",[50,371,372],{},[53,373,374],{},"2000",[50,376,377],{},"Allows InnoDB to flush dirty pages faster.",[35,379,380,385,389,394],{},[50,381,382],{},[53,383,384],{},"innodb_io_capacity_max",[50,386,387],{},[53,388,374],{},[50,390,391],{},[53,392,393],{},"4000",[50,395,396],{},"Upper bound for background flushing.",[14,398,399,403,404,407],{},[400,401,402],"strong",{},"Trade-off:"," With ",[53,405,406],{},"innodb_flush_log_at_trx_commit = 2",", up to one second of committed transactions can be lost if the MySQL process crashes (not the OS — only the mysqld process). For CDC workflows this is safe because the source replication slot retains unacknowledged data, so the stream can be restarted without data loss.",[14,409,410,411,414,415,418],{},"To make these settings persistent across MySQL restarts, add them to your MySQL configuration file (",[53,412,413],{},"my.cnf"," or ",[53,416,417],{},"my.ini","):",[115,420,424],{"className":421,"code":422,"language":423,"meta":120,"style":120},"language-ini shiki shiki-themes github-light github-dark","[mysqld]\ninnodb_flush_log_at_trx_commit = 2\nsync_binlog = 0\ninnodb_io_capacity = 2000\ninnodb_io_capacity_max = 4000\n","ini",[53,425,426,431,436,441,446],{"__ignoreMap":120},[124,427,428],{"class":126,"line":127},[124,429,430],{},"[mysqld]\n",[124,432,433],{"class":126,"line":133},[124,434,435],{},"innodb_flush_log_at_trx_commit = 2\n",[124,437,438],{"class":126,"line":286},[124,439,440],{},"sync_binlog = 0\n",[124,442,443],{"class":126,"line":292},[124,444,445],{},"innodb_io_capacity = 2000\n",[124,447,449],{"class":126,"line":448},5,[124,450,451],{},"innodb_io_capacity_max = 4000\n",[265,453,455],{"id":454},"buffer-pool-sizing","Buffer pool sizing",[14,457,458],{},"For large transfers, increase the InnoDB buffer pool to at least 50% of available RAM:",[115,460,462],{"className":117,"code":461,"language":119,"meta":120,"style":120},"SET GLOBAL innodb_buffer_pool_size = 1073741824;  -- 1 GB\n",[53,463,464],{"__ignoreMap":120},[124,465,466],{"class":126,"line":127},[124,467,461],{},[265,469,471],{"id":470},"cloud-hosted-mysql","Cloud-hosted MySQL",[14,473,474,475,478],{},"Managed MySQL services (AWS RDS, Google Cloud SQL, Azure Database for MySQL) may not expose all InnoDB settings. Check your provider's documentation for available parameters. Most providers default to ",[53,476,477],{},"innodb_flush_log_at_trx_commit = 1",", which can be changed through parameter groups (RDS) or database flags (Cloud SQL).",[21,480,482],{"id":481},"benchmark-10-million-rows-postgresql-cdc-mysql","Benchmark: 10 million rows, PostgreSQL CDC → MySQL",[14,484,485,486,489],{},"A real-world CDC stream migrating ",[400,487,488],{},"10,000,000 rows"," (1.14 GB) from PostgreSQL to MySQL with 2× target writers and the tuning settings above:",[14,491,492],{},[493,494],"img",{"alt":495,"src":496},"10M row PostgreSQL CDC to MySQL benchmark — 1.14 GB transferred in 2.36 minutes","\u002Fimages\u002Fdocs\u002Fstreams\u002Fbenchmark-10m-pg-to-mysql-dark.png",[29,498,499,509],{},[32,500,501],{},[35,502,503,506],{},[38,504,505],{},"Metric",[38,507,508],{},"Value",[45,510,511,519,527,535,543,551],{},[35,512,513,516],{},[50,514,515],{},"Rows transferred",[50,517,518],{},"10,000,000",[35,520,521,524],{},[50,522,523],{},"Data size",[50,525,526],{},"1.14 GB",[35,528,529,532],{},[50,530,531],{},"Source read rate",[50,533,534],{},"8.47 MB\u002Fs",[35,536,537,540],{},[50,538,539],{},"Target write rate (avg)",[50,541,542],{},"10.30 MB\u002Fs",[35,544,545,548],{},[50,546,547],{},"Elapsed time",[50,549,550],{},"2.36 min",[35,552,553,556],{},[50,554,555],{},"Target writers",[50,557,558],{},"2×",[14,560,561,562,564,565,568],{},"The stream used the recommended ",[53,563,406],{}," and ",[53,566,567],{},"sync_binlog = 0"," settings on the MySQL target. With default MySQL settings, the same transfer takes significantly longer due to per-transaction disk flushes.",[21,570,572],{"id":571},"validation-checklist","Validation checklist",[574,575,576,587,590,593],"ol",{},[577,578,579,580,582,583,586],"li",{},"Test the target connection from the ",[141,581,149],{"href":148}," sidebar (right-click → ",[400,584,585],{},"Test connection",") or from the connection editor.",[577,588,589],{},"Open the target database in Data Explorer and confirm the expected database is reachable.",[577,591,592],{},"Verify the target user has the required privileges for your chosen schema policy and write mode.",[577,594,595],{},"Run a small validation stream (one or two tables) before scaling up.",[21,597,599],{"id":598},"related-docs","Related docs",[601,602,603,607,611,616,620],"ul",{},[577,604,605],{},[141,606,144],{"href":143},[577,608,609],{},[141,610,232],{"href":231},[577,612,613],{},[141,614,615],{"href":243},"Database Structure Options",[577,617,618],{},[141,619,251],{"href":250},[577,621,622],{},[141,623,625],{"href":624},"\u002Fdocs\u002Fstreams\u002Fstream-configuration-guide","Stream Configuration Guide",[627,628,629],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":120,"searchDepth":133,"depth":133,"links":631},[632,633,634,635,640,641,642],{"id":23,"depth":133,"text":24},{"id":153,"depth":133,"text":154},{"id":236,"depth":133,"text":237},{"id":255,"depth":133,"text":256,"children":636},[637,638,639],{"id":267,"depth":286,"text":268},{"id":454,"depth":286,"text":455},{"id":470,"depth":286,"text":471},{"id":481,"depth":133,"text":482},{"id":571,"depth":133,"text":572},{"id":598,"depth":133,"text":599},"Configure MySQL as a target in DBConvert Streams Load and CDC workflows.","md",{},false,"\u002Fdocs\u002Fintegration\u002Fmysql-writer",null,{"title":5,"description":643},"docs\u002Fintegration\u002Fmysql-writer\u002Findex","NwJfDNyyKZwPQSX9NAScpFYcnKSXWsp5gID-ntAd2So",1783896285209]