I have just installed Ubuntu 17.10 and I want to run MySQL with multiple instances.
I’ve read the MySQL documentation about this (https://dev.mysql.com/doc/refman/5.7/en/using-systemd.html) but I still don’t understand.
I have disabled the apparmor profile for mysql and added these lines to
[mysqld@replica01] datadir=/var/lib/mysql-replica01 socket=/var/lib/mysql-replica01/mysql.sock port=3307 log-error=/var/log/mysql/replica01.log [mysqld@replica02] datadir=/var/lib/mysql-replica02 socket=/var/lib/mysql-replica02/mysql.sock port=3308 log-error=/var/log/mysql/replica02.log
Is it enough to copy /lib/systemd/system/mysql.service to /lib/systemd/system/mysql@.service or do I need to modify it somehow?
Because if I just copy it and run
systemctl start mysql@replica01
It will just start the default MySQL instance on port 3306.
And if I start mysql@replica02 it won’t start since it tries to start the same instance and I just get a bunch of
Unable to lock ./ibdata1 error: 11
What am I missing here? The only thing I can find online about this are old posts before this was supported in .deb-files. But since version 5.7.19 this should work and as of writing this the version is 5.7.21 that gets installed from Ubuntus repo.
I have an old installation on a Debian machine that is using the mysqld_multi but that’s not supported anymore if I understand the documentation right.