mysql Warning
今天重啟mysql錯誤日誌顯示有如下警告:
2016-06-24 09:20:07 0 [Warning] option 'general_log': boolean value '/data/DB/mysql/select.log' wasn't recognized. Set to OFF.
2016-06-24 09:20:07 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
第一個警告是查詢日誌檔案沒有找到,系統選擇關閉查詢日誌功能:
[root@trcloud-gtt-dw ~]# ls -l /data/DB/mysql/select.log
ls: cannot access /data/DB/mysql/select.log: No such file or directory
[root@trcloud-gtt-dw ~]# touch /data/DB/mysql/select.log
[root@trcloud-gtt-dw ~]# chown mysql:mysql /data/DB/mysql/select.log
透過建立檔案解決
第二個警告是要關掉這種非標準行為,得在啟動服務前開啟系統變數explicit_defaults_for_timestamp! 如此,系統方能按如下的方式處理timestamp:
timestamp欖沒有顯式宣告為not null的將會允許null值。設定為null就會是null,而不是當前timestamp!
沒有timestamp欖會被自動賦值為default current_timestamp或on update current_timestamp。而是要顯式去賦值!
timestamp欖宣告為not null並且沒有顯式宣告一個預設值將被認定為沒有預設值。向這樣的欖插入記錄將完全看SQL模式的心情。如果是strict模式,就報錯!
如果不是,將被賦值為'00-00-00 00:00:00'並給一個警告。處理DATETIME也是這樣!
透過在mysql.cnf,mysqld下面加explicit_defaults_for_timestamp=true解決
2016-06-24 09:20:07 0 [Warning] option 'general_log': boolean value '/data/DB/mysql/select.log' wasn't recognized. Set to OFF.
2016-06-24 09:20:07 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
第一個警告是查詢日誌檔案沒有找到,系統選擇關閉查詢日誌功能:
[root@trcloud-gtt-dw ~]# ls -l /data/DB/mysql/select.log
ls: cannot access /data/DB/mysql/select.log: No such file or directory
[root@trcloud-gtt-dw ~]# touch /data/DB/mysql/select.log
[root@trcloud-gtt-dw ~]# chown mysql:mysql /data/DB/mysql/select.log
透過建立檔案解決
第二個警告是要關掉這種非標準行為,得在啟動服務前開啟系統變數explicit_defaults_for_timestamp! 如此,系統方能按如下的方式處理timestamp:
timestamp欖沒有顯式宣告為not null的將會允許null值。設定為null就會是null,而不是當前timestamp!
沒有timestamp欖會被自動賦值為default current_timestamp或on update current_timestamp。而是要顯式去賦值!
timestamp欖宣告為not null並且沒有顯式宣告一個預設值將被認定為沒有預設值。向這樣的欖插入記錄將完全看SQL模式的心情。如果是strict模式,就報錯!
如果不是,將被賦值為'00-00-00 00:00:00'並給一個警告。處理DATETIME也是這樣!
透過在mysql.cnf,mysqld下面加explicit_defaults_for_timestamp=true解決
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29989552/viewspace-2120908/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Warning:The /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql'MySql
- MySQL日誌警告'[Warning] Unsafe statement written to the binary log'MySql
- [WARNING] warning: Class com.google.protobuf.Descriptors not found - continuing with a stub.GoUI
- Warning: RPMDB altered outside of yumIDE
- webstorm(二):拼寫warningWebORM
- warning: already initialized constant FileUtils::VERSIONZed
- Warning: Cannot redeclare function_name()Function
- Mysql 錯誤日誌出現大量[Warning] Aborted connection to db user host的解決思路MySql
- dedecms 搬家 / dedecms error warning!錯誤Error
- warning: React does not recognize the xxx prop on a DOM elementReact
- Warning: Received `false` for a non-boolean attribute `xxx`.FalseBoolean
- 關閉VS警告 warning C4996996
- lightdb WARNING: could not establish connection after 30000 ms
- PHP Warning:fopen出錯如何解決?PHP
- NMAKE : warning U4006: special macro undefined : '$MacUndefined
- WARNING: Heavy swapping observed on system in last 5 minsAPPAST
- Python怎樣忽略warning警告錯誤?Python
- [git]warning: LF will be replaced by CRLF in 解決辦法Git
- SSH登入:WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!REMIDE
- redhat linux核心資訊 warning:many lost ticksRedhatLinux
- vc6 link warning 4089 discarded by /OPT:REF
- [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.explicit_defaults_for_timestamp
- Git:warning: CALF wilL be replaced by LF in xxxx 問題解決Git
- Warning: ORA-16792: configurable property value is inconsistent with member sett
- WARNING: Logging before InitGoogleLogging() is written to STDERR 解決辦法Go
- antD——Warning: `callback` is deprecated. Please return a promise instead.Promise
- VM warning: INFO: OS::commit_memory Cannot allocate memoryMIT
- Warning!阿里的技術小姐姐要“發電”了阿里
- 關於Warning: setState(...): Can only update a mounted or mounting component. This
- Redis Cluster [WARNING] Node 127.0.0.1:7003 has slots in migrating state (15495).Redis127.0.0.1
- WARNING: inbound connection timed out (ORA-3136)錯誤分析
- 關於git提示“warning: LF will be replaced by CRLF”終極解答Git
- warning: LF will be replaced by CRLF in ** 的原因及解決辦法
- 消除Warning: Using a password on the command line interface can be insecure的提示
- rails 5.2 啟動警告 warning: previous definition of VERSION was here和bootsnapAIboot
- warning: CRLF will be replaced by LF in 出現的原因和解決辦法
- 記錄 warning: CRLF will be replaced LF by in XXX 的解決辦法
- 織夢提示dedecms error warning錯誤的解決方法Error
- pbootcms模板報錯提示PHP Warning: Unknown: open_basedir restrictionbootPHPREST