如何设置mysql数据库为utf-8编码
1个回答
展开全部
方法一:
mysql> show variables like '%chara%';
+--------------------------+--------------------------+
| Variable_name | Value |
+--------------------------+--------------------------+
| character_set_client | gbk |
| character_set_connection | gbk |
| character_set_database | latin1|
| character_set_filesystem | binary |
| character_set_results | gbk |
| character_set_server | latin1|
| character_set_system | utf8 |
| character_sets_dir | d:\mysql\share\charsets\ |
+--------------------------+--------------------------+
8 rows in set (0.00 sec)
mysql> set character_set_client=utf8
-> ;
Query OK, 0 rows affected (0.00 sec)
mysql> set character_set_client=gbk;
Query OK, 0 rows affected (0.00 sec)
mysql>
方法二:
在my.ini或者my.cnf中改
mysql> show variables like '%chara%';
+--------------------------+--------------------------+
| Variable_name | Value |
+--------------------------+--------------------------+
| character_set_client | gbk |
| character_set_connection | gbk |
| character_set_database | latin1|
| character_set_filesystem | binary |
| character_set_results | gbk |
| character_set_server | latin1|
| character_set_system | utf8 |
| character_sets_dir | d:\mysql\share\charsets\ |
+--------------------------+--------------------------+
8 rows in set (0.00 sec)
mysql> set character_set_client=utf8
-> ;
Query OK, 0 rows affected (0.00 sec)
mysql> set character_set_client=gbk;
Query OK, 0 rows affected (0.00 sec)
mysql>
方法二:
在my.ini或者my.cnf中改
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询