久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <small id='Uwt7p'></small><noframes id='Uwt7p'>

    1. <tfoot id='Uwt7p'></tfoot>

    2. <i id='Uwt7p'><tr id='Uwt7p'><dt id='Uwt7p'><q id='Uwt7p'><span id='Uwt7p'><b id='Uwt7p'><form id='Uwt7p'><ins id='Uwt7p'></ins><ul id='Uwt7p'></ul><sub id='Uwt7p'></sub></form><legend id='Uwt7p'></legend><bdo id='Uwt7p'><pre id='Uwt7p'><center id='Uwt7p'></center></pre></bdo></b><th id='Uwt7p'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Uwt7p'><tfoot id='Uwt7p'></tfoot><dl id='Uwt7p'><fieldset id='Uwt7p'></fieldset></dl></div>

      1. <legend id='Uwt7p'><style id='Uwt7p'><dir id='Uwt7p'><q id='Uwt7p'></q></dir></style></legend>
          <bdo id='Uwt7p'></bdo><ul id='Uwt7p'></ul>

        為 DATE 或 DATETIME 設(shè)置默認(rèn)值時(shí) MySQL 中的錯(cuò)誤

        Error in MySQL when setting default value for DATE or DATETIME(為 DATE 或 DATETIME 設(shè)置默認(rèn)值時(shí) MySQL 中的錯(cuò)誤)

          • <tfoot id='0H3vO'></tfoot>
              <tbody id='0H3vO'></tbody>

              <bdo id='0H3vO'></bdo><ul id='0H3vO'></ul>
                <i id='0H3vO'><tr id='0H3vO'><dt id='0H3vO'><q id='0H3vO'><span id='0H3vO'><b id='0H3vO'><form id='0H3vO'><ins id='0H3vO'></ins><ul id='0H3vO'></ul><sub id='0H3vO'></sub></form><legend id='0H3vO'></legend><bdo id='0H3vO'><pre id='0H3vO'><center id='0H3vO'></center></pre></bdo></b><th id='0H3vO'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0H3vO'><tfoot id='0H3vO'></tfoot><dl id='0H3vO'><fieldset id='0H3vO'></fieldset></dl></div>
              • <legend id='0H3vO'><style id='0H3vO'><dir id='0H3vO'><q id='0H3vO'></q></dir></style></legend>

                  <small id='0H3vO'></small><noframes id='0H3vO'>

                  本文介紹了為 DATE 或 DATETIME 設(shè)置默認(rèn)值時(shí) MySQL 中的錯(cuò)誤的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  我運(yùn)行的是 MySql Server 5.7.11 和這句話:

                  I'm running MySql Server 5.7.11 and this sentence:

                  updated datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
                  

                  不起作用.給出錯(cuò)誤:

                  ERROR 1067 (42000): Invalid default value for 'updated'
                  

                  但是以下:

                  updated datetime NOT NULL DEFAULT '1000-01-01 00:00:00'
                  

                  剛剛好.

                  DATE 的情況相同.

                  The same case for DATE.

                  作為旁注,它在MySQL 文檔:

                  DATE 類型用于具有日期部分但沒(méi)有時(shí)間部分的值.MySQL 以 'YYYY-MM-DD' 格式檢索和顯示 DATE 值.支持的范圍是1000-01-01"到9999-12-31".

                  The DATE type is used for values with a date part but no time part. MySQL retrieves and displays DATE values in 'YYYY-MM-DD' format. The supported range is '1000-01-01' to '9999-12-31'.

                  即使他們也說(shuō):

                  無(wú)效的 DATE、DATETIME 或 TIMESTAMP 值將轉(zhuǎn)換為適當(dāng)類型的零"值('0000-00-00' 或 '0000-00-00 00:00:00').

                  Invalid DATE, DATETIME, or TIMESTAMP values are converted to the "zero" value of the appropriate type ('0000-00-00' or '0000-00-00 00:00:00').

                  還考慮到 MySQL 文檔中的第二個(gè)引用,誰(shuí)能告訴我為什么會(huì)出現(xiàn)該錯(cuò)誤?

                  Having also into account the second quote from MySQL documentation, could anyone let me know why it is giving that error?

                  推薦答案

                  該錯(cuò)誤是由于 sql 模式,根據(jù)最新的 MYSQL 5.7 文檔可以是嚴(yán)格模式

                  The error is because of the sql mode which can be strict mode as per latest MYSQL 5.7 documentation

                  MySQL 文檔 5.7 說(shuō):

                  嚴(yán)格模式會(huì)影響服務(wù)器是否允許0000-00-00"作為有效日期:如果未啟用嚴(yán)格模式,則允許使用 '0000-00-00' 并且插入不會(huì)產(chǎn)生警告.如果啟用了嚴(yán)格模式,則不允許使用 '0000-00-00' 并且插入會(huì)產(chǎn)生錯(cuò)誤,除非也給出了 IGNORE.對(duì)于 INSERT IGNORE 和 UPDATE IGNORE,允許使用0000-00-00"并且插入會(huì)產(chǎn)生警告.

                  Strict mode affects whether the server permits '0000-00-00' as a valid date: If strict mode is not enabled, '0000-00-00' is permitted and inserts produce no warning. If strict mode is enabled, '0000-00-00' is not permitted and inserts produce an error, unless IGNORE is given as well. For INSERT IGNORE and UPDATE IGNORE, '0000-00-00' is permitted and inserts produce a warning.

                  檢查MYSQL模式

                  SELECT @@GLOBAL.sql_mode 全局,@@SESSION.sql_mode 會(huì)話

                  禁用 STRICT_TRANS_TABLES 模式

                  但是要允許格式 0000-00-00 00:00:00您必須在 mysql 配置文件中或通過(guò)命令禁用 STRICT_TRANS_TABLES 模式

                  However to allow the format 0000-00-00 00:00:00you have to disable STRICT_TRANS_TABLES mode in mysql config file or by command

                  通過(guò)命令

                  SET sql_mode = '';

                  SET GLOBAL sql_mode = '';

                  使用關(guān)鍵字 GLOBAL 需要超級(jí)特權(quán),它會(huì)影響從那時(shí)起所有客戶端連接的操作

                  Using the keyword GLOBAL requires super previliges and it affects the operations all clients connect from that time on

                  如果以上不起作用,請(qǐng)轉(zhuǎn)到 /etc/mysql/my.cnf(根據(jù) ubuntu)并注釋掉 STRICT_TRANS_TABLES

                  if above is not working than go to /etc/mysql/my.cnf (as per ubuntu) and comment out STRICT_TRANS_TABLES

                  此外,如果您想在服務(wù)器啟動(dòng)時(shí)永久設(shè)置 sql 模式,請(qǐng)?jiān)?Linux 或 MacOS 上的 my.cnf 中包含 SET sql_mode=''.對(duì)于 Windows,這必須在 my.ini 文件中完成.

                  Also, if you want to permanently set the sql mode at server startup then include SET sql_mode='' in my.cnf on Linux or MacOS. For windows this has to be done in my.ini file.

                  注意

                  然而,在 MYSQL 5.6 中默認(rèn)沒(méi)有啟用嚴(yán)格模式.因此它不會(huì)按照 MYSQL 6 產(chǎn)生錯(cuò)誤文檔其中說(shuō)

                  However strict mode is not enabled by default in MYSQL 5.6. Hence it does not produce the error as per MYSQL 6 documentation which says

                  MySQL 允許您將0000-00-00"的零"值存儲(chǔ)為虛擬日期".這在某些情況下比使用 NULL 值更方便,并且使用更少的數(shù)據(jù)和索引空間.要禁止0000-00-00",請(qǐng)啟用 NO_ZERO_DATE SQL 模式.

                  MySQL permits you to store a "zero" value of '0000-00-00' as a "dummy date." This is in some cases more convenient than using NULL values, and uses less data and index space. To disallow '0000-00-00', enable the NO_ZERO_DATE SQL mode.

                  更新

                  關(guān)于@Dylan-Su 所說(shuō)的錯(cuò)誤問(wèn)題:

                  Regarding the bug matter as said by @Dylan-Su:

                  我不認(rèn)為這是 MYSQL 隨著時(shí)間的推移演變的方式的錯(cuò)誤,因?yàn)楦鶕?jù)產(chǎn)品的進(jìn)一步改進(jìn),某些事情發(fā)生了變化.

                  I don't think this is the bug it the way MYSQL is evolved over the time due to which some things are changed based on further improvement of the product.

                  但是我有另一個(gè)關(guān)于 NOW() 函數(shù)的相關(guān)錯(cuò)誤報(bào)告

                  However I have another related bug report regarding the NOW() function

                  日期時(shí)間字段不接受默認(rèn)的 NOW()

                  另一個(gè)有用的說(shuō)明 [參見(jiàn) TIMESTAMP 和 DATETIME 的自動(dòng)初始化和更新]

                  從 MySQL 5.6.5 開(kāi)始,TIMESTAMP 和 DATETIME 列可以自動(dòng)初始化并更新為當(dāng)前日期和時(shí)間(即當(dāng)前時(shí)間戳).在 5.6.5 之前,這僅適用于 TIMESTAMP,并且每個(gè)表最多有一個(gè) TIMESTAMP 列.下面的注釋首先描述了 MySQL 5.6.5 及更高版本的自動(dòng)初始化和更新,然后是 5.6.5 之前版本的差異.

                  As of MySQL 5.6.5, TIMESTAMP and DATETIME columns can be automatically initializated and updated to the current date and time (that is, the current timestamp). Before 5.6.5, this is true only for TIMESTAMP, and for at most one TIMESTAMP column per table. The following notes first describe automatic initialization and updating for MySQL 5.6.5 and up, then the differences for versions preceding 5.6.5.

                  關(guān)于 NO_ZERO_DATE 的更新

                  自 MySQL 5.7.4 起,此模式已棄用.對(duì)于以前的版本,您必須注釋掉配置文件中的相應(yīng)行.請(qǐng)參閱 關(guān)于 NO_ZERO_DATE 的 MySQL 5.7 文檔

                  As of MySQL as of 5.7.4 this mode is deprecated. For previous version you must comment out the respective line in the config file. Refer MySQL 5.7 documentation on NO_ZERO_DATE

                  這篇關(guān)于為 DATE 或 DATETIME 設(shè)置默認(rèn)值時(shí) MySQL 中的錯(cuò)誤的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數(shù)根據(jù) N 個(gè)先前值來(lái)決定接下來(lái)的 N 個(gè)行)
                  reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達(dá)式的結(jié)果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數(shù)的 ignore 選項(xiàng)是忽略整個(gè)事務(wù)還是只是有問(wèn)題的行?) - IT屋-程序員軟件開(kāi)發(fā)技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時(shí)出錯(cuò),使用 for 循環(huán)數(shù)組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調(diào)用 o23.load 時(shí)發(fā)生錯(cuò)誤 沒(méi)有合適的驅(qū)動(dòng)程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數(shù)據(jù)庫(kù)表作為 Spark 數(shù)據(jù)幀讀取?)

                  <small id='0huFW'></small><noframes id='0huFW'>

                  1. <tfoot id='0huFW'></tfoot>
                    <i id='0huFW'><tr id='0huFW'><dt id='0huFW'><q id='0huFW'><span id='0huFW'><b id='0huFW'><form id='0huFW'><ins id='0huFW'></ins><ul id='0huFW'></ul><sub id='0huFW'></sub></form><legend id='0huFW'></legend><bdo id='0huFW'><pre id='0huFW'><center id='0huFW'></center></pre></bdo></b><th id='0huFW'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0huFW'><tfoot id='0huFW'></tfoot><dl id='0huFW'><fieldset id='0huFW'></fieldset></dl></div>

                        <tbody id='0huFW'></tbody>
                      • <legend id='0huFW'><style id='0huFW'><dir id='0huFW'><q id='0huFW'></q></dir></style></legend>
                          <bdo id='0huFW'></bdo><ul id='0huFW'></ul>
                            主站蜘蛛池模板: 成在线人视频免费视频 | 国产一区二区免费 | 91亚洲欧美 | 欧美黄色一级毛片 | 2018中文字幕第一页 | 91欧美激情一区二区三区成人 | 久久久一区二区三区 | 天天天操操操 | 亚洲成人国产 | 亚洲精品久久久久中文字幕二区 | 欧美精品一区二区三区在线四季 | 日韩成人在线视频 | 精品久久久久久亚洲综合网站 | 国产伦精品一区二区三区照片91 | 不卡视频在线 | 欧美黑人国产人伦爽爽爽 | 亚洲国产精品人人爽夜夜爽 | a级在线免费视频 | 在线免费观看黄a | 国产成人a亚洲精品 | 狠狠久久 | 一级黄色录像毛片 | 最新国产精品视频 | 色视频www在线播放国产人成 | 99re在线视频 | 久久久久国产 | 日韩成人一区 | 亚洲精品久久久久中文字幕欢迎你 | 亚洲视频一区 | 免费一区二区三区 | 欧美日韩高清在线观看 | 久久成人人人人精品欧 | 亚洲夜射| 免费观看的av毛片的网站 | 中文字幕视频一区 | 亚洲国产第一页 | 另类 综合 日韩 欧美 亚洲 | 久久精品久久久久久 | 日本淫视频 | 日韩欧美在线视频 | 久久久久久国产精品免费免费狐狸 |