【MySQL8】Partitioned tables using engines with non native partitioning と出たときの対応方法

MySQL8.0に上げたら、Partitioned tables using engines with non native partitioning と出た

MySQL5.x系からMySQL8にアップグレードした際に、エラーが出てきました。

Partitioned tables using engines with non native partitioning
Error: In MySQL 8.0 storage engine is responsible for providing its own
partitioning handler, and the MySQL server no longer provides generic
partitioning support. InnoDB and NDB are the only storage engines that
provide a native partitioning handler that is supported in MySQL 8.0. A
partitioned table using any other storage engine must be altered—either to
convert it to InnoDB or NDB, or to remove its partitioning—before upgrading
the server, else it cannot be used afterwards.
More information:
https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-configuration-changes

読んでみると、ネイティブパーティションでないエンジンを使ったテーブルがあるため、エラーになったと書いてあります。ネイティブパーティションでないパーティションテーブルは、アップグレード前に、InnoDBまたはNDBに変えるか、パーティションを削除してくださいと書かれています。

Partitioned tables using engines with non native partitioning になる原因

MySQLのパーティショニングは、PARTITIONストレージエンジンとして実装されており、これがMySQL8.0から使えなくなってしまっています。ただ、InnoDBについては、MySQL5.7で、ネイティブパーティションというこれまでのPARTITIONストレージエンジンを使わない構成に変更になっていました。そのため、InnoDBについては、恐らく問題がないものの、MyISAMでパーティションを貼っているテーブルがあると、恐らくこのエラーが出ているはずです。この原因に該当していると、

[テーブル名] – MyISAM engine does not support native

と記載されており、MyISAMはネイティブストレージエンジンになってないよというエラーが出てきます。

対応方法

MyISAMでパーティションを貼っているテーブルがあるとアップグレードができないので、

  • MyISAMをInnoDBに変更する
  • MyISAMに貼っているパーティションを削除する

どちらかの対応をすることで解消することができます。