Reputation: 4159
When create table, I have setted charset = utf8.
I create 1 store procedure to insert data to database.
The strange thing is insert UTF8 work fine in window, but when i deploy MySQL in linux, when insert data to database it insert wrong UTF8 value.
Thanks for help
Edit: Update more detail follow comment of @Col. Shrapnel
Upvotes: 1
Views: 7835
Reputation: 4159
I just found a solution for my problem: Edit file my.cnf under /etc/my.cnf as below:
[mysqld]
default-character-set=utf8
default-collation=utf8_general_ci
character-set-server=utf8
collation-server=utf8_general_ci
init-connect='SET NAMES utf8'
[client]
default-character-set=utf8
But i still confuse why this bug occur in Linux, not in Window.
Upvotes: 3
Reputation: 32094
You should start mysql console with --default-character-set=utf8:
mysql --default-character-set=utf8 -uyour_user -p
Upvotes: 11
Reputation: 157915
most probably you didn't specify client character set by issuing SET NAMES UTF8
query
but there can be other problems - your database or a web page may be not in the utf-8
Upvotes: 3