该字符后的值被切断
为什么会这样?
create table tmp2(t1 varchar(100));
insert into tmp2 values('beforeafter');
mysql> select * from tmp2;
+--------+
| t1 |
+--------+
| before |
+--------+
1 row in set (0.01 sec)
我运行了以下命令并返回了一些有用的信息
mysql> SHOW FULL COLUMNS FROM tmp2;
+-------+--------------+-----------------+------+-----+---------+-------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-------+--------------+-----------------+------+-----+---------+-------+---------------------------------+---------+
| t1 | varchar(100) | utf8_general_ci | YES | | NULL | | select,insert,update,references | |
+-------+--------------+-----------------+------+-----+---------+-------+---------------------------------+---------+
1 row in set (0.00 sec)
这个,
mysql> SELECT character_set_name FROM information_schema.`COLUMNS` WHERE table_schema = "test" AND table_name = "tmp2" AND column_name = "t1";
+--------------------+
| character_set_name |
+--------------------+
| utf8 |
+--------------------+
1 row in set (0.00 sec)
我在ubuntu / mysql命令行上测试它。