Toolvito

Calculates on this device. File exports run online.

Database Collation Checker

Paste the CREATE TABLE statements of a MySQL or MariaDB database and see the character set and collation of every text column, worked out by MySQL’s own rules, with the mixes that cause “Illegal mix of collations”, foreign keys MySQL refuses and utf8mb3 columns. You can also look up what a collation name means, or find the values that a case- or accent-insensitive collation would treat as one.

Enter your values

The collation of every text column, and the mixes that break joins and foreign keys.

Your values

Paste SHOW CREATE TABLE output or a mysqldump --no-data file. Only CREATE DATABASE, USE and CREATE TABLE are read.

Used where neither the table nor a CREATE DATABASE states a collation. Find it with SHOW VARIABLES LIKE 'collation_server'.

Your values are worked out in this browser. They are not sent to a server.

Your result will show here

Fill in the values, then choose the button below them.

Find equal values in large exports

Find equal values in large exports

Choose up to 20 CSV exports (with a header row) or text files with one value on each line, of up to 1 GB each. Every column is read row by row, and you get the groups of different values that the chosen collation strength counts as equal, with the counts for each column, as CSV files.

Or drop files here. CSV, TSV, TXT or TAB, up to 20 files, 1 GB each at most.

    Names from the header row, separated by commas. Leave it empty to check every column.

    Everything above is worked out in your browser. When you use this box, the files you choose are sent to the Toolvito server. Download the result within one hour after the job finishes. Choose Delete files now to request earlier removal. The hourly cleanup normally removes files within one to two hours after completion.

    How to use it

    1. Run SHOW CREATE TABLE for your tables, or mysqldump --no-data, and paste the statements. Add the CREATE DATABASE statement, or type the server default collation, so tables without their own collation can be worked out.
    2. Press Check the statements and read the findings, then the table of every text column with its collation and where it comes from.
    3. Choose What a collation name means to read a name such as utf8mb4_0900_ai_ci or Latin1_General_100_CI_AS_SC.
    4. Choose Values a collation counts as equal and paste the values of a column before you add a UNIQUE index or change its collation. For millions of rows, use the box below with a CSV export.

    How the collation of a column is found

    • A column with CHARACTER SET and COLLATE uses those; with only CHARACTER SET, the default collation of that set; with only COLLATE, the set of that collation; with neither, the table’s. A table gets its defaults from the database the same way (MySQL 8.4 Reference Manual, 12.3).
    • Default collations and bytes per character are those of MySQL 8.4 (utf8mb4: utf8mb4_0900_ai_ci). MariaDB and older MySQL versions use other defaults for some sets; when in doubt, read the collation that SHOW CREATE TABLE prints.
    • String columns of a foreign key need the same character set and collation as the columns they reference (MySQL 8.4 Reference Manual, 15.1.20.5).
    • PAD SPACE collations ignore spaces at the end of a value when they compare; NO PAD collations (UCA 9.0.0 and later, such as utf8mb4_0900_ai_ci) count them.

    What this check does not do

    • It reads the statements you paste; it does not connect to your database. Collations set by ALTER TABLE or at connection time are not seen.
    • Equal values are an estimate made with Unicode normalization and case mapping. MySQL’s collation tables decide in the end: test the values that matter in your own database.

    Related tools