mysql不支持中文
我用的mysql版本是mysql-essential-5.0.87-win32感觉安装和配置都和以前一样,没有问题,但是它不支持中文了,已重装多次,还是没有效果,而且以前是好用的,支持中文的。
databases中的tables:
mysql> show tables;
+----------------+
| Tables_in_htzy |
+----------------+
| message |
| person |
+----------------+
2 rows in set (0.00 sec)
表的属性
mysql> describe person;
+-------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+-------+
| Name | char(20) | NO | PRI | NULL | |
| Paw | char(6) | YES | | NULL | |
| Email | char(30) | YES | | NULL | |
+-------+----------+------+-----+---------+-------+
3 rows in set (0.02 sec)
mysql> describe message;
+-------+-----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-----------+------+-----+---------+-------+
| Name | char(20) | YES | MUL | NULL | |
| Time | char(25) | NO | PRI | NULL | |
| Text | char(140) | YES | | NULL | |
+-------+-----------+------+-----+---------+-------+
3 rows in set (0.01 sec)
查看已有的数据
mysql> select * from person;
+--------+--------+--------------+
| Name | Paw | Email |
+--------+--------+--------------+
| 012345 | 123456 | sd |
| 111 | 222 | 123 |
| 123 | 123456 | 123@123.htzy |
| 456 | 111 | 2355465 |
| htzy | 123456 | sdgfd |
+--------+--------+--------------+
5 rows in set (0.00 sec)
mysql> select * from person;
+---------+--------+--------------+
| Name | Paw | Email |
+---------+--------+--------------+
| 012345 | 123456 | sd |
| 111 | 222 | 123 |
| 123 | 123456 | 123@123.htzy |
| 456 | 111 | 2355465 |
| ?????× | 111111 | ??????111111 |
| htzy | 123456 | sdgfd |
+---------+--------+--------------+
6 rows in set (0.00 sec)
对汉字输入测试:
mysql> insert into Person (name,paw,email) values('测试','123456','邮箱yo');
Query OK, 1 row affected, 2 warnings (0.08 sec)
mysql> select * from person;
+---------+--------+--------------+
| Name | Paw | Email |
+---------+--------+--------------+
| 012345 | 123456 | sd |
| 111 | 222 | 123 |
| 123 | 123456 | 123@123.htzy |
| 456 | 111 | 2355465 |
| ?? | 123456 | ??youxiang |
| ?????× | 111111 | ??????111111 |
| htzy | 123456 | sdgfd |
+---------+--------+--------------+
7 rows in set (0.00 sec)
查看编码方式确实没有问题啊。
mysql> show variables like 'character%';
+--------------------------+-----------------------------------+
| Variable_name | Value |
+--------------------------+-----------------------------------+
| character_set_client | gbk |
| character_set_connection | gbk |
| character_set_database | gbk |
| character_set_filesystem | binary |
| character_set_results | gbk |
| character_set_server | gbk |
| character_set_system | utf8 |
| character_sets_dir | D:\javaweb\mysql5\share\charsets\ |
+--------------------------+-----------------------------------+
8 rows in set (0.00 sec)
求解
!
[解决办法]
会存储中文的数据类型,修改为nchar 或者nvarchar类型吧
[解决办法]
用Unicode的类型比如nchar/nvarchar,插入的时候使用insert into xxx values(N'xxx')这样的格式