In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the mysql current_timestamp will encounter what pit, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
Mysql's current_timestamp pit reported an error.
Incorrect table definition;there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
The answer on the Internet is 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, the other timestamp fields need to explicitly set the default value.
But if you have two timestamp fields, but only set the first to current_timestamp and the second does not set the default value, MySQL can successfully build the table, but not vice versa.
My plan.
Uninstall the current lower version of mysql and install mysql above version 5.6. it is recommended that the mysql5.7 version is relatively stable.
Mysql5.5.23 current_timestamp problem
Create a new table today with two fields: creation time and update time. Both default values are the current time. As soon as sql is executed, an error will be reported.
ERROR 1293 (HY000): Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
I use sql in this way in other projects, and it works well, so why didn't it succeed today? After confirming that there are no grammatical errors in sql, I looked up the information on the Internet. It turns out that mysql5.5 supports only one time field in a table using CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP. But more than one is supported in 5.6.
Original description
It is not possible to have the current timestamp be the default value for one column and the auto-update value for another column.
Solution.
Remove the default value of creation time
Check the mysql version number with the status command
Thank you for reading this article carefully. I hope the article "what pits will be encountered in current_timestamp in mysql" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.