user595234
user595234

Reputation: 6259

mysql utf-8 support

when I create a new table, it always is 'latin-swedish-ci' by default. my goal is that this table can store utf-8 text. I tried this way, give me error .

cd C:\mysql-5.5.14-winx64\bin
mysqld --standalone --console --default-storage-engine=InnoDB --default-character-set=utf8
 [ERROR] mysqld: unknown variable 'default-character-set=utf8'

Upvotes: 0

Views: 3218

Answers (2)

Your Database probably has the default charset on latin1 and default collation set to latin1-swedish-ci and so altering the table should help

http://dev.mysql.com/doc/refman/5.1/en/alter-database.html

ALTER DATABASE `MyDatabaseName` 
CHARACTER SET utf8
COLLATE utf8_general_ci;

Upvotes: 3

Mchl
Mchl

Reputation: 62395

You can always specify column encodings/collations within CREATE TABLE statement. This has additional benefit of making your data structure more portable in case you ever need to move it to another server.

Upvotes: 0

Related Questions