20 | | (Edit: This is a flawed test and can be ignored. [http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_character_set_database Documentation] states: ''You should not set the value of this variable manually.'' But ''checking'' the variable could still be useful. |
21 | | |
22 | | As described on MySqlDb#Collationfromwhatevertoutf8_bin I should have used `ALTER DATABASE` instead.) |
| 20 | (Edit: The above was flawed and can be ignored. [http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_character_set_database Documentation] states: ''You should not set the value of this variable manually.'' As described on MySqlDb#Collationfromwhatevertoutf8_bin use `ALTER DATABASE` (and `ALTER TABLE`) instead: |
| 21 | {{{ |
| 22 | mysql> CREATE DATABASE trac; |
| 23 | mysql> USE trac; |
| 24 | mysql> SHOW VARIABLES LIKE 'collation_database'; |
| 25 | | collation_database | utf8_general_ci | |
| 26 | mysql> ALTER DATABASE `trac` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; |
| 27 | mysql> SHOW VARIABLES LIKE 'collation_database'; |
| 28 | | collation_database | utf8_bin | |
| 29 | mysql> CREATE TABLE test (a TEXT); |
| 30 | mysql> SHOW FULL COLUMNS FROM test; |
| 31 | +-------+------+-----------+.... |
| 32 | | Field | Type | Collation |.... |
| 33 | +-------+------+-----------+.... |
| 34 | | a | text | utf8_bin |.... |
| 35 | +-------+------+-----------+.... |
| 36 | }}} |
| 37 | So ''checking'' the variables could still be useful.) |