{"id":169,"date":"2019-08-16T23:20:31","date_gmt":"2019-08-16T15:20:31","guid":{"rendered":"http:\/\/apps.badjoerichards.com\/apps\/developerhack\/?p=169"},"modified":"2021-12-20T14:44:00","modified_gmt":"2021-12-20T06:44:00","slug":"how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp","status":"publish","type":"post","link":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp\/","title":{"rendered":"How to solve and fix &#8220;Invalid default value&#8221; MySQL error for dates and timestamp?"},"content":{"rendered":"<p>Last updated: 20211220<\/p>\n<p>To avoid this issue, you need to remove NO_ZERO_DATE from the mysql mode configuration.<\/p>\n<ol>\n<li>Go to &#8216;phpmyadmin&#8217;. (in WHM not cPanel)<\/li>\n<li>Once phpmyadmin is loaded up, click on the &#8216;variables&#8217; tab.<\/li>\n<li>Scroll down and search for &#8216;sql mode&#8217;.<\/li>\n<li>Click on the Edit option and remove NO_ZERO_DATE (and its trailing comma) from the configuration line.<\/li>\n<li>Save (hit &#8216;save&#8217; on the left side) and that&#8217;s it!<\/li>\n<li>You will have to repeat this on every server upgrade\/reboot of your MYSQL.<\/li>\n<\/ol>\n<p>This is a very common issue in the local environment with wamp or xamp.<\/p>\n<p>This will allow you to use default &#8221; 0000-00-00 00:00:00&#8243; as a timestamp value.<\/p>\n<p>Reference:<\/p>\n<p>https:\/\/stackoverflow.com\/questions\/9192027\/invalid-default-value-for-create-date-timestamp-field<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last updated: 20211220 To avoid this issue, you need to remove NO_ZERO_DATE from the mysql mode configuration. Go to &#8216;phpmyadmin&#8217;. (in WHM not cPanel) Once phpmyadmin is loaded up, click on the &#8216;variables&#8217; tab. Scroll down and search for &#8216;sql mode&#8217;. Click on the Edit option and remove NO_ZERO_DATE (and its trailing comma) from the &hellip; <a href=\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to solve and fix &#8220;Invalid default value&#8221; MySQL error for dates and timestamp?&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[3],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to solve and fix &quot;Invalid default value&quot; MySQL error for dates and timestamp? - Developer Hack<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to solve and fix &quot;Invalid default value&quot; MySQL error for dates and timestamp? - Developer Hack\" \/>\n<meta property=\"og:description\" content=\"Last updated: 20211220 To avoid this issue, you need to remove NO_ZERO_DATE from the mysql mode configuration. Go to &#8216;phpmyadmin&#8217;. (in WHM not cPanel) Once phpmyadmin is loaded up, click on the &#8216;variables&#8217; tab. Scroll down and search for &#8216;sql mode&#8217;. Click on the Edit option and remove NO_ZERO_DATE (and its trailing comma) from the &hellip; Continue reading &quot;How to solve and fix &#8220;Invalid default value&#8221; MySQL error for dates and timestamp?&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp\/\" \/>\n<meta property=\"og:site_name\" content=\"Developer Hack\" \/>\n<meta property=\"article:published_time\" content=\"2019-08-16T15:20:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-20T06:44:00+00:00\" \/>\n<meta name=\"author\" content=\"Bad Joe\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bad Joe\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/#website\",\"url\":\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/\",\"name\":\"Developer Hack\",\"description\":\"Hacks, tips, tricks and best practices for developers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp\/\",\"url\":\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp\/\",\"name\":\"How to solve and fix \\\"Invalid default value\\\" MySQL error for dates and timestamp? - Developer Hack\",\"isPartOf\":{\"@id\":\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/#website\"},\"datePublished\":\"2019-08-16T15:20:31+00:00\",\"dateModified\":\"2021-12-20T06:44:00+00:00\",\"author\":{\"@id\":\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/#\/schema\/person\/01df012e94dd976ac49e50cdbf0e38d6\"},\"breadcrumb\":{\"@id\":\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to solve and fix &#8220;Invalid default value&#8221; MySQL error for dates and timestamp?\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/#\/schema\/person\/01df012e94dd976ac49e50cdbf0e38d6\",\"name\":\"Bad Joe\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5d413dbb6a01d82a56f2ceb6a82e8704?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5d413dbb6a01d82a56f2ceb6a82e8704?s=96&d=mm&r=g\",\"caption\":\"Bad Joe\"},\"url\":\"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to solve and fix \"Invalid default value\" MySQL error for dates and timestamp? - Developer Hack","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp\/","og_locale":"en_US","og_type":"article","og_title":"How to solve and fix \"Invalid default value\" MySQL error for dates and timestamp? - Developer Hack","og_description":"Last updated: 20211220 To avoid this issue, you need to remove NO_ZERO_DATE from the mysql mode configuration. Go to &#8216;phpmyadmin&#8217;. (in WHM not cPanel) Once phpmyadmin is loaded up, click on the &#8216;variables&#8217; tab. Scroll down and search for &#8216;sql mode&#8217;. Click on the Edit option and remove NO_ZERO_DATE (and its trailing comma) from the &hellip; Continue reading \"How to solve and fix &#8220;Invalid default value&#8221; MySQL error for dates and timestamp?\"","og_url":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp\/","og_site_name":"Developer Hack","article_published_time":"2019-08-16T15:20:31+00:00","article_modified_time":"2021-12-20T06:44:00+00:00","author":"Bad Joe","twitter_card":"summary","twitter_misc":{"Written by":"Bad Joe","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/#website","url":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/","name":"Developer Hack","description":"Hacks, tips, tricks and best practices for developers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp\/","url":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp\/","name":"How to solve and fix \"Invalid default value\" MySQL error for dates and timestamp? - Developer Hack","isPartOf":{"@id":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/#website"},"datePublished":"2019-08-16T15:20:31+00:00","dateModified":"2021-12-20T06:44:00+00:00","author":{"@id":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/#\/schema\/person\/01df012e94dd976ac49e50cdbf0e38d6"},"breadcrumb":{"@id":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/apps.badjoerichards.com\/apps\/developerhack\/how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/how-to-solve-and-fix-invalid-default-value-mysql-error-for-dates-and-timestamp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/"},{"@type":"ListItem","position":2,"name":"How to solve and fix &#8220;Invalid default value&#8221; MySQL error for dates and timestamp?"}]},{"@type":"Person","@id":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/#\/schema\/person\/01df012e94dd976ac49e50cdbf0e38d6","name":"Bad Joe","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5d413dbb6a01d82a56f2ceb6a82e8704?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5d413dbb6a01d82a56f2ceb6a82e8704?s=96&d=mm&r=g","caption":"Bad Joe"},"url":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/wp-json\/wp\/v2\/posts\/169"}],"collection":[{"href":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/wp-json\/wp\/v2\/comments?post=169"}],"version-history":[{"count":5,"href":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/wp-json\/wp\/v2\/posts\/169\/revisions"}],"predecessor-version":[{"id":475,"href":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/wp-json\/wp\/v2\/posts\/169\/revisions\/475"}],"wp:attachment":[{"href":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/wp-json\/wp\/v2\/media?parent=169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/wp-json\/wp\/v2\/categories?post=169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/apps.badjoerichards.com\/apps\/developerhack\/wp-json\/wp\/v2\/tags?post=169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}