Every table has a table character set and a table collation.
The CREATE TABLE and ALTER
TABLE statements have optional clauses for
specifying the table character set and collation:
CREATE TABLEtbl_name(column_list) [[DEFAULT] CHARACTER SETcharset_name] [COLLATEcollation_name]] ALTER TABLEtbl_name[[DEFAULT] CHARACTER SETcharset_name] [COLLATEcollation_name]
Example:
CREATE TABLE t1 ( ... ) CHARACTER SET latin1 COLLATE latin1_danish_ci;
MySQL chooses the table character set and collation in the following manner:
If both CHARACTER SET
and
XCOLLATE
were specified, then character set
YX and collation
Y.
If CHARACTER SET
was specified
without XCOLLATE, then character set
X and its default collation.
If COLLATE
was specified without YCHARACTER SET,
then the character set associated with
Y and collation
Y.
Otherwise, the database character set and collation.
The table character set and collation are used as default values if the column character set and collation are not specified in individual column definitions. The table character set and collation are MySQL extensions; there are no such things in standard SQL.

User Comments
I noticed that my error log file was filled with the following messages (after upgrade to 4.1.12, though I don't look at log files often so it may have been there before). I found clues from other posts on the internet which helped me solve it, and I post my complete solution here in the hope it might help someone else.
050805 15:30:06 [Warning] './localpinprod/mytablename' had no or invalid character set, and default character set is multi-byte, so character column sizes may have changed
I performed a "FLUSH LOGS;" to try and be clear where the error was coming from.
The error occurs at times I'm not clear of, but to try and find an easily reproducible test, I performed a "REPAIR TABLE `mytablename`" just to try and force the error, and true enough, the error log added the same error.
I then did an "ALTER TABLE mytablename DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci"
Now when I do a "REPAIR TABLE `mytablename`" I do not get the error. I did another "FLUSH LOGS" first to make really sure that nothing was missed.
Hope this helps someone.
Add your own comment.