MySQL's current_timestamp pitfallReport an error
The answers on the Internet are basically as follows, but there is no specific solution The reason for the solution is that when you set a timestamp to on updatecurrent_timestamp, other timestamp fields need to explicitly set default values But if you have two timestamp fields, but only set the first one to current_timestamp and the second one has no default value, MySQL can successfully create the table, but not the other way around... My SolutionUninstall the current lower version of MySQL and install MySQL version 5.6 or higher. MySQL version 5.7 is recommended as it is relatively stable. mysql5.5.23 current_timestamp problemToday I created a new table with two fields: creation time and update time. Both default values are the current time. An error occurs when executing SQL.
I have used this SQL in other projects and it works fine. Why can't it be executed successfully today? After confirming that there were no syntax errors in the sql, I checked the information online. It turns out that MySQL 5.5 only supports one time field in a table using CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP. But in 5.6 it supports multiple. Original description
SolutionRemove the default creation time Check the MySQL version number using the status command The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
>>: CSS animation combined with SVG to create energy flow effect
1. Installation Tip: There is currently no offici...
Let's try out nginx's reverse proxy here....
principle The principle of anti-shake is: you can...
There is a requirement for a list containing mult...
The vue part is as follows: <template> <...
Limit input box to only pure numbers 1、onkeyup = ...
I have been relearning HTML recently, which can be...
As a required course for front-end developers, CS...
Table of contents 1. Introduction 2. Customize ta...
Deploy redis in docker First install Docker in Li...
Table of contents Array deduplication 1 Double-la...
1. Check the PHP version after entering the termi...
This article deploys Jenkins+Maven+SVN+Tomcat thr...
1. Check the MySQL database encoding mysql -u use...
Table of contents Solution: 1. IGNORE 2. REPLACE ...