enumag
enumag

Reputation: 916

MySQL different behaviour on windows and linux

I've this little SQL script:

CREATE TABLE `aaaa` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`text` varchar(100),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO `aaaa` (`text`) VALUES (NULL);

ALTER TABLE `aaaa` CHANGE `text` `text` TEXT NOT NULL;

It fails when trying on MySQL 5.5 on Windows 7 with error "Data truncated for column 'text' at row 1" but works on MySQL 5.5 on Debian.

Why is the behaviour different?

Upvotes: 0

Views: 546

Answers (2)

peterm
peterm

Reputation: 92795

I see consistent behavior both on Windows

mysql> ALTER TABLE `aaaa` CHANGE `text` `text` TEXT NOT NULL;
ERROR 1265 (01000): Data truncated for column 'text' at row 1

and on Mac OS X

mysql> ALTER TABLE `aaaa` CHANGE `text` `text` TEXT NOT NULL;
ERROR 1265 (01000): Data truncated for column 'text' at row 1

In your case you may have different sql_mode settings for Windows and Debian installations of MySQL.

Upvotes: 1

rsanchez
rsanchez

Reputation: 14657

They are probably configured to run in different SQL Modes. Compare the results of:

SELECT @@GLOBAL.sql_mode;

on both servers.

Upvotes: 1

Related Questions