본문 바로가기
MySql

MySQL 열 문제로 잘린 데이터를 해결하는 방법

by 베이스 공부 2020. 11. 5.
반응형

localhost에서는 작동하지만 cpanel에서는 작동하지 않습니다. 이 오류를 어떻게 제거 할 수 있습니까?

SQLSTATE[01000]: Warning: 1265 Data truncated for column 'connectionMethod' at row 1

다음은 테이블을 만드는 MySQL 코드입니다.

DROP TABLE IF EXISTS `file_server`;
CREATE TABLE `file_server` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `serverLabel` varchar(100) NOT NULL,
  `serverType` enum('remote','local') DEFAULT NULL,
  `ipAddress` varchar(15) NOT NULL,
  `connectionMethod` enum('ftp') NOT NULL DEFAULT 'ftp',
  `ftpPort` int(11) NOT NULL DEFAULT '21',
  `ftpUsername` varchar(50) NOT NULL,
  `ftpPassword` varchar(50) DEFAULT NULL,
  `statusId` int(11) NOT NULL DEFAULT '1',
  `storagePath` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `statusId` (`statusId`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;


 

해결 방법

 

변경 시도 (스크립트의 1298 행)

`INSERT INTO `file_server` VALUES ('1', 'Local Default', 'local', '', '', '0', '', null, '2', null);`

`INSERT INTO `file_server` VALUES ('1', 'Local Default', 'local', '', 'ftp', '0', '', null, '2', null);`

열 이름이 enum이면 한 가지 더,이 경우 u도 기본값을 지정한 경우 해당 열에 값을 지정하거나 제공 할 필요가 없습니다.

 

참조 페이지 https://stackoverflow.com/questions/38049942

 

 

반응형

댓글