> 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-1500-to-1599/e1558.md).

# Error 1558: Column count of mysql table is wrong. Please use mariadb-upgrade

| Error Code | SQLSTATE | Error                                         | Description                                                                                                                                     |
| ---------- | -------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| 1558       | HY000    | ER\_COL\_COUNT\_DOESNT\_MATCH\_PLEASE\_UPDATE | Column count of mysql.%s is wrong. Expected %d, found %d. Created with MariaDB %d, now running %d. Please use mariadb-upgrade to fix this error |

## Possible Causes and Solutions

The server returns this error when a table in the `mysql` system database has a different number of columns than the running server expects, and the table was created by an older MariaDB version. The message names the table and both versions, as six-digit version numbers. For example, `110402` is MariaDB 11.4.2:

```
ERROR 1558 (HY000): Column count of mysql.proc is wrong. Expected 22, found 21. Created with MariaDB 110402, now running 130002. Please use mariadb-upgrade to fix this error
```

Newer versions change the structure of some system tables, and [mariadb-upgrade](/docs/server/clients-and-utilities/deployment-tools/mariadb-upgrade.md) updates them. The error usually means that this step didn't happen, for example:

* The server binaries were upgraded, but `mariadb-upgrade` wasn't run, or it failed.
* A dump of the `mysql` database from an older version was restored into a newer server.

To solve the error, run `mariadb-upgrade` as a user who has all privileges. On many installations, `root@localhost` uses [unix\_socket](/docs/server/reference/plugins/authentication-plugins/authentication-plugin-unix-socket.md) authentication, so run it as `sudo mariadb-upgrade`, or name another account with `--user`. If `mariadb-upgrade` says that the server is already upgraded, add `--force`. See [Upgrading Between Major MariaDB Versions](/docs/server/server-management/install-and-upgrade-mariadb/upgrading/platform-specific-upgrade-guides/upgrading-on-linux/upgrading-between-major-mariadb-versions.md).

If the table was created by the running version and still has the wrong number of columns, the server returns [error 1805](/docs/server/reference/error-codes/mariadb-error-codes-1800-to-1899/e1805.md) instead: `Column count of mysql.proc is wrong. Expected 22, found 21. The table is probably corrupted`. That usually means that the table was changed by hand or damaged. `mariadb-upgrade --force` can also repair the structure in that case.

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

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