0

Possible Duplicate:
How to make MySQL handle UTF-8 properly

  • I already created my database.
  • I don't want to do this in my.cfg.

    I want to run an SQL query to set utf-8 as my default on this database.

Community
  • 1
  • 1
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080
  • ALTER TABLE `database`.`table` CHARACTER SET utf8 COLLATE utf8_general_ci; will alter a tables encoding. This was taken from MySql administrator. Not sure about a DB with 1 command. – Nick Maroulis Jul 08 '12 at 21:45

1 Answers1

0

Once you start creating tables, it is no longer a single ALTER DATABASE statement. You need:

ALTER TABLE `foo`.`bar` CHARACTER SET utf8 COLLATION utf8_general_ci

as already hinted in the comment. This changes the collation of all columns in the table to the specified one. However, it is also possible to control character set and collation also on column by column basis if desired.

Jirka Hanika
  • 13,301
  • 3
  • 46
  • 75