标签:style io ar os sp 文件 数据 on art
MySQL设置编码 版本mysql-5.6.21-winx64
mysql> SHOW VARIABLES LIKE ‘character%‘; +--------------------------+---------------------------------------------+ | 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:\soft\mysql-5.6.21-winx64\share\charsets\ | +--------------------------+---------------------------------------------+ 8 rows in set (0.00 sec) mysql>
SET character_set_client = utf8;
SET character_set_connection = utf8;
SET character_set_database = utf8;
SET character_set_results = utf8;
SET character_set_server = utf8;
mysql> SET character_set_client = utf8; Query OK, 0 rows affected (0.00 sec) mysql> SET character_set_connection = utf8; Query OK, 0 rows affected (0.00 sec) mysql> SET character_set_database = utf8; Query OK, 0 rows affected (0.00 sec) mysql> SET character_set_results = utf8; Query OK, 0 rows affected (0.00 sec) mysql> SET character_set_server = utf8; Query OK, 0 rows affected (0.00 sec) mysql>
此种方式只在当前状态下有效,当重启数据库服务后失效。所以如果想要不出现乱码只有修改my.ini文件。
[client] default-character-set=utf8 [mysql] default-character-set=utf8 [mysqld] character-set-server=utf8
在对应的标签下添加如下配置:
重启mysql服务器:
C:\Users\Lenovo>net stop mysql MySQL 服务正在停止. MySQL 服务已成功停止。 C:\Users\Lenovo>net start mysql MySQL 服务正在启动 . MySQL 服务已经启动成功。 C:\Users\Lenovo>
===========END===========
标签:style io ar os sp 文件 数据 on art
原文地址:http://my.oschina.net/xinxingegeya/blog/342109