[wp-trac] [WordPress Trac] #8857: Make WP MySQL strict mode compliant

WordPress Trac noreply at wordpress.org
Tue Apr 8 06:28:37 UTC 2025


#8857: Make WP MySQL strict mode compliant
-------------------------+-----------------------
 Reporter:  ghostks      |       Owner:  (none)
     Type:  enhancement  |      Status:  reopened
 Priority:  lowest       |   Milestone:
Component:  Database     |     Version:  6.4.2
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+-----------------------

Comment (by tusharaddweb):

 Yes MySQL strick mode  leads to installation or upgrade failures,
 especially on newer MySQL versions (>= 5.7) or MariaDB.

 **Fix Schema: Replace Zero Dates**

 Instead of using DEFAULT '0000-00-00 00:00:00', either:

     Use DEFAULT CURRENT_TIMESTAMP, or

     Allow NULL and skip DEFAULT entirely.


 **-- Before**
 `post_date` datetime NOT NULL default '0000-00-00 00:00:00',
 **-- After**
 `post_date` datetime NOT NULL,

 **Reference**
 : https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sql-mode-strict
 : https://dev.mysql.com/doc/refman/8.0/en/datetime.html

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/8857#comment:24>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list