1,可以直接在建表时添加ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_german2_ci
2,修改默认的COLLATE
mysql> SHOW VARIABLES LIKE 'collation_%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_german2_ci |
| collation_server | utf8_german2_ci |
mysql> set collation_connection=utf8_german2_ci;
Query OK, 0 rows affected (0.00 sec)
mysql> SHOW VARIABLES LIKE 'collation_%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_german2_ci |
| collation_database | utf8_german2_ci |
| collation_server | utf8_german2_ci |
+----------------------+-----------------+
3 rows in set, 1 warning (0.00 sec)
这样建表默认使用utf8_german2_ci