Error Code: 1406. Data too long for column - MySQL

前端 未结 8 1616
抹茶落季
抹茶落季 2020-11-27 05:26

Error Code: 1406. Data too long for column

CREATE  TABLE `TEST` 
(

  `idTEST` INT NOT NULL ,

  `TESTcol` VARCHAR(45) NULL ,

  PRIMARY KEY (`idTEST`) 
);
         


        
8条回答
  •  情话喂你
    2020-11-27 06:03

    This is a step I use with ubuntu. It will allow you to insert more than 45 characters from your input but MySQL will cut your text to 45 characters to insert into the database.

    1. Run command

      sudo nano /etc/mysql/my.cnf

    2. Then paste this code

      [mysqld] sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

    3. restart MySQL

      sudo service mysql restart;

提交回复
热议问题