Firefog Firefog - 1 month ago 13
MySQL Question

How to solve Data truncated for column issue

It works on localhost but not in cpanel
How can I get rid from this error-

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


here is the MySQL code to create the table:

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;


Full Database

JPG JPG
Answer

Try to change (line 1298 in your script)

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

to

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

One more thing if your column name is enum then in that case if u also have specified the default value then you need not to specify or give that column any values.

Comments