mysql> select * from truncated_test; Empty set (0.00 sec)
mysql> show columns from truncated_test; +----------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | username | varchar(10) | YES | | NULL | | | password | varchar(10) | YES | | NULL | | +----------+-------------+------+-----+---------+----------------+ 3 rows in set (0.00 sec)
mysql> insert into truncated_test(`username`,`password`) values("admin","pass");
Query OK, 1 row affected (0.03 sec)
mysql> select * from truncated_test; +----+----------+----------+ | id | username | password | +----+----------+----------+ | 1 | admin | pass | +----+----------+----------+ 1 row in set (0.00 sec)
mysql> insert into truncated_test(`username`,`password`) values("admin x", "new_pass"); ERROR 1406 (22001): Data too long for column 'username' at row 1 mysql> select * from truncated_test; +----+----------+----------+ | id | username | password | +----+----------+----------+ | 1 | admin | pass | +----+----------+----------+ 1 row in set (0.00 sec)