DEV Community

Discussion on: Build a Rails App with TiDB and the ActiveRecord TiDB Adapter

Collapse
 
yahonda profile image
Yasuo Honda

Great introduction article.
Based on the document and show collation output from TiDB 5.1.1, TiDB does not support utf8mb4_general_ci.
Then this database.yml may need to be updated as follows?

  • Current
  collation: utf8mb4_general_ci
Enter fullscreen mode Exit fullscreen mode
  • To
  collation: utf8mb4_bin
Enter fullscreen mode Exit fullscreen mode
Server version: 5.7.25-TiDB-v5.1.1 TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> show collation;
+-------------+---------+------+---------+----------+---------+
| Collation   | Charset | Id   | Default | Compiled | Sortlen |
+-------------+---------+------+---------+----------+---------+
| utf8mb4_bin | utf8mb4 |   46 | Yes     | Yes      |       1 |
| latin1_bin  | latin1  |   47 | Yes     | Yes      |       1 |
| binary      | binary  |   63 | Yes     | Yes      |       1 |
| ascii_bin   | ascii   |   65 | Yes     | Yes      |       1 |
| utf8_bin    | utf8    |   83 | Yes     | Yes      |       1 |
+-------------+---------+------+---------+----------+---------+
5 rows in set (0.00 sec)

MySQL [(none)]>
Enter fullscreen mode Exit fullscreen mode
Collapse
 
hooopo profile image
hooopo wang

Yes. when new_collations_enabled_on_first_bootstrap = true is set, utf8mb4_general_ci is avaliable. I missed this tidb cluster setting.