Creating a service to startup mysql 8.0 using generic binary tar and my.cnf in non-default location

Hi.

I have 5.7 installed using yum and need to install 8.0 on the same server.

I followed these steps. http://code.openark.org/blog/mysql/manually-installing-multiple-mysql-instances-on-linux-howto

I untarred the binary tarball in /usr/local/Percona-Server-8.0.13-3-Linux.x86_64.ssl100 and created a my.cnf file under that directory. I also created a softlink /usr/local/mysql80 → /usr/local/Percona-Server-8.0.13-3-Linux.x86_64.ssl100

I want to create a service called mysql80 and start it up.

I create a softlink under /etc/systemd/system to point to the 8.0 mysql.service

[root@dvlb7sanddb02 system]# ls -l mysql80.service

lrwxrwxrwx. 1 root root 45 Dec 24 14:26 mysql80.service → /usr/local/mysql80/support-files/mysql.server

If I start this it will by default look at /etc/my.cnf

How do I tell it to look at /usr/local/mysql80/my.cnf? Do I edit the /usr/local/mysql80/support-files/mysql.server?

Is there a different way to do it? What do I change in the mysql.server file to make it point to the my.cnf I want it to look at?

Thanks.

Here is what I use as a template for service, you can use your own install dir, your own datadir and your own my.cnf

[Unit]
Description=MySQL Server
After=syslog.target
After=network.target

[Service]
Type=simple
PermissionsStartOnly=true
LimitNOFILE = 100000
Environment=MYSQLD_PARENT_PID=1
ExecStartPre=/bin/mkdir -p "{{ mountdir }}/{{ mysqldir }}"
ExecStartPre=/bin/chown mysql:mysql -R "{{ mountdir }}/{{ mysqldir }}"
ExecStart=/usr/bin/numactl --interleave=all "{{ installdir }}/{{ mysqlbin[server] }}/bin/mysqld" --defaults-file="{{ installdir }}/my-{{ server }}.cnf" --basedir="{{ installdir }}/{{ mysqlbin[server] }}" --datadir="{{ mountdir }}/{{ mysqldir }}" $MYSQLD_OPTS
TimeoutSec=300

[Install]
WantedBy=multi-user.target

@vadimtk thanks. Let me try this out.

This is from my ansible scripts.

Instead of double curly braces use the real values for your pathes

@vadimtk ah thanks. Appreciate it.