标签: 编码

linux下mysql编码配置

1 修改/etc/mysql/my.cnf配置文件 增加default-character-set=utf8

配置文件如下

[java]
[client]

port = 3306
socket = /var/run/mysqld/mysqld.sock
default-character-set=utf8
# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
#
# * Basic Settings
#
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
[/java]

2 重启mysql

sudo service mysql restart

MyEclipse修改Properties文件编码方式

 

Window ->Perferences ->General ->Context Types 展开右边的Text节点,选中Java Properties File。把下面的Default Character Set的值:ISO-8859-1改成UTF-8

MyEclipse设置编码

 

每次都记不住,放着存下

全局编码设置:编码设置的方法:Window–>Preferences–>General–>Workspace–>Text file encoding,设置合适的编码。

局部编码设置:在源码按右键–>General–>Editors–>Test Editors–>Spelling–>Encoding,这里是设置单个文件的编码。