咨询热线:4006-75-4006
售前:9:00-23:30 备案:9:00-18:00 技术:7*24h
+--------------------------+----------------------------+
修改为utf8编码:修改/etc/my.cnf
在[client]下增加default-character-set=utf8
在[mysqld]下增加character_set_server=utf8
重新查看编码情况:
mysql> show variables like character%;
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
如此修改后,JDBC访问不会出现乱码。
注意JSP页面编码也要写成UTF-8.