> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-1800-to-1899/e1833.md).

# Error 1833: Cannot change column: used in a foreign key constraint of table

| Error Code | SQLSTATE | Error                                 | Description                                                                    |
| ---------- | -------- | ------------------------------------- | ------------------------------------------------------------------------------ |
| 1833       | HY000    | ER\_FK\_COLUMN\_CANNOT\_CHANGE\_CHILD | Cannot change column '%s': used in a foreign key constraint '%s' of table '%s' |

## Possible Causes and Solutions

An `ALTER TABLE` statement tried to change a column that another table references through a [foreign key](/docs/server/ha-and-performance/optimization-and-tuning/optimization-and-indexes/foreign-keys.md), in a way that would change how its values compare with the referencing column. Changing the column's type, length, character set, or collation all qualify. A common case is converting a table to a different collation, where the referencing table still uses the old one. The third name in the message is the table holding the constraint.

Setting `foreign_key_checks` to `0` does not lift this restriction, and neither does choosing a different `ALGORITHM`.

A referencing table's constraint cannot be dropped from within the referenced table's `ALTER TABLE` statement, so drop it on the referencing table first, then apply the change to both tables and re-create the constraint. For the full procedure, see [Changing the Character Set or Collation of a Foreign Key Column](/docs/server/ha-and-performance/optimization-and-tuning/optimization-and-indexes/foreign-keys.md#changing-the-character-set-or-collation-of-a-foreign-key-column).

If the table being altered is the one holding the constraint, the server reports [error 1832](/docs/server/reference/error-codes/mariadb-error-codes-1800-to-1899/e1832.md) instead.

{% hint style="success" %}
This article doesn't currently contain any content. [You can help!](/docs/general-resources/about/readme/contributing-documentation.md)
{% endhint %}

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
