Set default character during table definition
mysql>
mysql>
mysql> CREATE TABLE TABUTF8
-> (C1 CHAR(10) NOT NULL,
-> C2 VARCHAR(10))
-> DEFAULT CHARACTER SET utf8
-> ;
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT COLUMN_NAME, CHARACTER_SET_NAME
-> FROM INFORMATION_SCHEMA.COLUMNS
-> WHERE TABLE_NAME = 'TABUTF8';
+-------------+--------------------+
| COLUMN_NAME | CHARACTER_SET_NAME |
+-------------+--------------------+
| C1 | utf8 |
| C2 | utf8 |
+-------------+--------------------+
2 rows in set (0.00 sec)
mysql>
mysql> drop table TABUTF8;
Query OK, 0 rows affected (0.00 sec)
mysql>
Related examples in the same category