{"id":15173824,"url":"https://github.com/spithash/mysql-mariadb-skip-replication-errors","last_synced_at":"2026-02-06T10:02:26.900Z","repository":{"id":247532703,"uuid":"826116951","full_name":"spithash/MySQL-MariaDB-skip-replication-errors","owner":"spithash","description":"Skip / ignore certain errors on your SLAVE so replication continues","archived":false,"fork":false,"pushed_at":"2025-01-31T11:03:45.000Z","size":102,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-10T21:27:35.551Z","etag":null,"topics":["bash-script","database-management","mariadb","mysql","slave-master"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spithash.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,"zenodo":null}},"created_at":"2024-07-09T06:07:22.000Z","updated_at":"2025-01-31T11:03:48.000Z","dependencies_parsed_at":"2024-10-11T02:40:58.269Z","dependency_job_id":"493e118b-595d-4c3d-a00d-0214ae3e2030","html_url":"https://github.com/spithash/MySQL-MariaDB-skip-replication-errors","commit_stats":{"total_commits":25,"total_committers":1,"mean_commits":25.0,"dds":0.0,"last_synced_commit":"15871eab5dd3878e1ef0d55a13b4cd269c44637c"},"previous_names":["spithash/mysql-mariadb-skip-replication-errors"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/spithash/MySQL-MariaDB-skip-replication-errors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spithash%2FMySQL-MariaDB-skip-replication-errors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spithash%2FMySQL-MariaDB-skip-replication-errors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spithash%2FMySQL-MariaDB-skip-replication-errors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spithash%2FMySQL-MariaDB-skip-replication-errors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spithash","download_url":"https://codeload.github.com/spithash/MySQL-MariaDB-skip-replication-errors/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spithash%2FMySQL-MariaDB-skip-replication-errors/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29157471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T07:18:23.844Z","status":"ssl_error","status_checked_at":"2026-02-06T07:13:32.659Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bash-script","database-management","mariadb","mysql","slave-master"],"created_at":"2024-09-27T11:03:03.413Z","updated_at":"2026-02-06T10:02:26.872Z","avatar_url":"https://github.com/spithash.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MySQL/MariaDB skip replication errors\nSkip Last_SQL_Error of your slave so replication continues\n\nSometimes replication on the slave stops due to error(s) and they're printed out in `Last_SQL_Error`  \nThese errors can be viewed by either using this query:\n````\nSHOW SLAVE STATUS \\G;\n````\nOr in the terminal like so:  \n````\nsudo mysql -e \"SHOW SLAVE STATUS\\G\" \n````\n\nThis script handles two error codes, `1032` and `1062`\n\n![MySQL-MariaDB-skip-replication-errors](https://github.com/spithash/MySQL-MariaDB-skip-replication-errors/assets/3981730/d49a7339-5197-41cc-a456-3cc84912462f)\n\n### Error Code 1032: Can't find record in 'table_name'\n\nThis error occurs when a replication slave attempts to execute a statement that affects a row that does not exist on the slave. This is typically a problem with DELETE or UPDATE statements. In a replication setup, this usually indicates a discrepancy between the master and the slave databases.  \n**Common Causes:**\n        Data inconsistency between master and slave due to missed transactions.\n        Manual changes to the data on the slave that were not replicated from the master.\n        Network issues causing loss of replication data.\n\n### Error Code 1062: Duplicate entry 'key_value' for key 'PRIMARY'\n\nThis error occurs when a replication slave tries to insert a row with a primary key that already exists in the table. This typically happens with INSERT or INSERT ... ON DUPLICATE KEY UPDATE statements.  \n\n**Common Causes:** Data duplication due to re-running transactions or inserting data manually on the slave. The same row being inserted on both the master and slave independently. Incorrect or incomplete handling of unique constraints during data replication.\n\n# Skipping errors\nThese errors can be skipped with:\n````\nSET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;\n````\nNumber 1 means skip/ignore one error at a time. This value can be increased.  \nOfficial mysql documentation:\n\u003eThis statement skips the next N events from the master. This is useful for recovering from replication stops caused by a statement.  \n\u003eThis statement is valid only when the slave threads are not running. Otherwise, it produces an error.  \n\u003eWhen using this statement, it is important to understand that the binary log is actually organized as a sequence of groups known as event groups. Each event group consists of a sequence of events.  \n\n### Why These Errors Occur in Replication\n\n**Data Inconsistency:** These errors often arise from data inconsistencies between the master and the slave. If the data on the slave is not an exact copy of the master, operations like updates and deletions can fail.  \n**Manual Interventions:** Manual updates or deletions on the slave can lead to these errors if those changes are not reflected on the master.  \n**Network Issues:** Intermittent network issues can cause the slave to miss some of the replication events from the master, leading to inconsistencies.  \n\n## Using\nRun the script as `sudo` (assuming root can connect locally). There are cases where mariadb and/or mysql commands are not available to users with no super user privileges (sudoers).  \nOtherwise, use something like `.my.cnf` in your home folder.\n````\nsudo bash mysql-mariadb-skip-errors.sh\n````\nOR\n````\nbash forloop.sh\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspithash%2Fmysql-mariadb-skip-replication-errors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspithash%2Fmysql-mariadb-skip-replication-errors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspithash%2Fmysql-mariadb-skip-replication-errors/lists"}