Upgrading MySQL from 5.7 to 8.0
Upgrading MySQL from 5.7 to 8.0 was mostly uneventful.
Here are the steps I did.
- Stop the running 5.7 instance.
- Make ZFS snapshots of these three filesystems:
zfs snap enterprise_zdata/var/db/mysql@pre-8.0
zfs snap enterprise_zdata/var/db/mysql_secure@pre-8.0
zfs snap enterprise_zdata/var/db/mysql_tmpdir@pre-8.0
- Upgrade to 8.0.
- Review the new
my.cnf.sample
in/usr/local/etc/mysql
. In my case, mymy.cnf
differs from the stock version in a couple of areas. See below. - Start the 8.0 instance. Remember, the server will now automatically run the steps previously done using
mysql_upgrade
. This first start will be significantly slower than the subsequent ones. - I noticed “mysqlx” defaults to listening on
[::]
and on TCP port33060
, which may be undesired. I adjustedmy.cnf
accordingly and restarted MySQL.
--- /usr/local/etc/mysql/my.cnf.sample 2023-03-13 13:26:55.000000000 +0100 +++ /usr/local/etc/mysql/my.cnf 2023-03-13 14:29:50.000000000 +0100 @@ -11,6 +14,8 @@ port = 3306 socket = /tmp/mysql.sock bind-address = 127.0.0.1 +mysqlx-port = 33060 +mysqlx-bind-address = 127.0.0.1 basedir = /usr/local datadir = /var/db/mysql tmpdir = /var/db/mysql_tmpdir @@ -50,6 +55,7 @@ innodb_write_io_threads = 8 innodb_read_io_threads = 8 innodb_autoinc_lock_mode = 2 +innodb_file_per_table = ON [mysqldump] max_allowed_packet = 256M