http://iotn.co.kr 연락처: gilho.kr@gmail.com [ The Japanese government should apologize to Japanese Military Sexual Slavery victim. / 日本政府は日本軍の性的奴隷?牲者に謝罪すべき. ]

사용자

ID:
PW:

INDEX
01.게시판
게시판 [69]
02.File Book
File 자료실 [95]
Site Link [18]
개인폴더 [194]
03.Field Book
Altibase [19]
Tibero [30]
MS-SQL [18]
MySQL [40]
DB2 [79]
ORACLE [2888]
PostgreSQL [103]
기타정보 [150]
운영체제 [577]
04.Q/A Book
Q/A [53]
05.방명록
방명록 [54]
레벨업 [37]
구인/구직 [2]

기념일
Search
LINK
+ 가족 Hompy
+ DNSEver
IOTN :: Work Book :: MySQL

 회원가입

ERROR 1067 (42000): Invalid default value for 'tablename' [ ENGINE=InnoDB / ENGINE=MyISAM 변경 ]
최길호 [LIST]   2020-07-02 17:01:02, 조회 : 216


select concat('alter table ',TABLE_SCHEMA,'.',TABLE_NAME,' ENGINE=InnoDB;') from information_schema.tables where TABLE_SCHEMA='webdb';

+----------------------------------------------------------------------+
| concat('alter table ',TABLE_SCHEMA,'.',TABLE_NAME,' ENGINE=InnoDB;') |
+----------------------------------------------------------------------+
| alter table webdb.auth ENGINE=InnoDB;                                |
| alter table webdb.board ENGINE=InnoDB;                               |
| alter table webdb.board_file ENGINE=InnoDB;                          |
| alter table webdb.board_good ENGINE=InnoDB;                          |
| alter table webdb.board_new ENGINE=InnoDB;                           |
| alter table webdb.config ENGINE=InnoDB;                              |


mysql> show create table memo;
... ENGINE=MyISAM
mysql> alter table memo ENGINE=innodb;
ERROR 1067 (42000): Invalid default value for 'memo'

mysql> show global VARIABLES like 'sql_mode';
+---------------+-----------------------------------------------------------------------------------------------------------------------+
| Variable_name | Value                                                                                                                 |
+---------------+-----------------------------------------------------------------------------------------------------------------------+
| sql_mode      | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION |
+---------------+-----------------------------------------------------------------------------------------------------------------------+

mysql> SET sql_mode = '';
Query OK, 0 rows affected (0.00 sec)

mysql> show global VARIABLES like 'sql_mode';
+---------------+-----------------------------------------------------------------------------------------------------------------------+
| Variable_name | Value                                                                                                                 |
+---------------+-----------------------------------------------------------------------------------------------------------------------+
| sql_mode      | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION |
+---------------+-----------------------------------------------------------------------------------------------------------------------+

mysql> select @@global.sql_mode;
+-----------------------------------------------------------------------------------------------------------------------+
| @@global.sql_mode                                                                                                     |
+-----------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION |
+-----------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select @@sql_mode;
+------------+
| @@sql_mode |
+------------+
|            |
+------------+

세션에만 적용해서 하면 문제는 최소할수 있겠다.

mysql> alter table memo ENGINE=myisam;
Query OK, 42 rows affected (0.10 sec)
Records: 42  Duplicates: 0  Warnings: 0

mysql> alter table memo ENGINE=innodb;
Query OK, 42 rows affected (0.13 sec)
Records: 42  Duplicates: 0  Warnings: 0


출처: https://stackoverflow.com/questions/36882149/error-1067-42000-invalid-default-value-for-created-at


  LIST

Copyright 1999-2022 Zeroboard / skin by 최길호(gilho.kr@gmail.com)
최근 댓글
2008/12/15
MySQL이 안좋은건가? 장애도 쉽게 나고,...
by 최길호
최근 게시물
06/29
[ORACLE]
DDE: Problem Key 'ORA 600 [133....
by 최길호
06/25
[ORACLE]
Replication may not be valid i....
by 최길호
06/22
[운영체제]
CentOS7 홈페이지 Migration 메모.
by 최길호