when I use
CREATE TEMPORARY TABLE to create a temporary table, the collation of this table is
utf8_unicode_ci by default. why by default it is
utf8_unicode_ci? How can I change the default?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
The CREATE TABLE syntax allows for specifying the character set and collation
The MySQL Documentation for CREATE TABLE shows this syntax:
Therefore, your syntax should be something like this:
Give it a Try !!!
If you want to manipulate the default options for collation, you have the following:
These variables can be changed at the Global or Session Level.
If you want to set the collation permamnently, you could put it in
and restart mysql
If you only want this for an individual BB Connection, you would run this in the session
See my recent post Why are there different levels of MySQL collation/charsets? to see installed character sets and collations.
normally the temp table takes the default from server/database level. if you want to change it, then change at the sever/DB level and this will impact all your other objects as well.
if you want it only once for your current temp table, then declare it strongly at your temp table creation process.