How do I set default collation for all tables that are created in a database?

Viewed 19225

I have a database dump taken from a broken database that I need to import into a clean installation. However, the original database seem to have been set to use utf8_unicode_ci.

When importing this dump into clean database, all databases are created with the default utf8_general_ci which gives me duplicate entries for words including ß, because general makes 'ß' == 's', while as utf8_unicode_ci supposedly have 'ß' == 'ss'.

But, when importing mysql always seems to select the default utf8_general_ci when creating the table, even though I set the database (schema) default to utf8_unicode_ci.

Is there any way to force it to create tables with utf8_unicode_ci without having to inject alter table statements in my dump? It is several GB in size and is gonna be a pain to modify manually.

Configuring MySQL system wide is fine.

I tried setting:

collation-server=utf8_unicode_ci

in my.cnf but that doesn't seem to set the default collation for table creation.

3 Answers
Related