> 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/e1832.md).

# Error 1832: Cannot change column: used in a foreign key constraint

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

## Possible Causes and Solutions

An `ALTER TABLE` statement tried to change a column that the table uses as 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 referenced 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 referenced table still uses the old one.

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

To make the change, drop the constraint in the same `ALTER TABLE` statement as the column change, apply the matching change to the referenced table, then 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 referenced table is the one being altered, the server reports [error 1833](/docs/server/reference/error-codes/mariadb-error-codes-1800-to-1899/e1833.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" %}
