用MySQL連結到myeclipse 會遇到亂碼問題,我想這也是很多人遇到的問題,下面我來講解一下到底如何解決這些亂碼問題,
首先在MySQL能夠正常顯示,但是卻連結到myeclipse中建立好dbbrowser後,右鍵connected to mysql 後,單擊New SQL editor 出來之後,查看錶裡的內容,出現的是亂碼,這有可能是mysql編碼配置的問題,應該作如下更改,找到mysql的設定檔夾my.ini,作如下修改 。
[client]
port=3306
[mysql]
default-character-set=GBK //這是需要更改的地方,有人可能會是latin1
# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3306
#Path to installation directory. All paths are usually resolved relative to this.
basedir="E:/Mysql/mysql sever/"
#Path to the database root
datadir="E:/Mysql/mysql sever/Data/"
# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=utf8 //這是mysql本地的字元存取,需要更改 有人可能會是latin1
改好之後,去控制台服務裡面 先把mysql的服務關掉然後再重新啟動(這很重要),然後再刪掉原有舊編碼的表,這樣建立的新表,在myeclipse中就不會有亂碼的問題