Convert ext/mysql to HNI

Part of #1480

Also includes the commit in #2024