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

**URL:** <https://forums.percona.com/t/creating-a-service-to-startup-mysql-8-0-using-generic-binary-tar-and-my-cnf-in-non-default-location/8440>\
**Category:** Percona Server for MySQL 5.7\
**Created:** [December 24, 2020, 2:08pm UTC](https://forums.percona.com/t/creating-a-service-to-startup-mysql-8-0-using-generic-binary-tar-and-my-cnf-in-non-default-location/8440 "2020-12-24T14:08:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ipcmlr](https://avatars.discourse-cdn.com/v4/letter/i/df705f/32.png) [@ipcmlr](https://forums.percona.com/u/ipcmlr)\
**Post date:** [December 24, 2020, 2:08pm UTC](https://forums.percona.com/t/creating-a-service-to-startup-mysql-8-0-using-generic-binary-tar-and-my-cnf-in-non-default-location/8440/1 "2020-12-24T14:08:38Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![vadimtk](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vadimtk/32/9528_2.png) [@vadimtk](https://forums.percona.com/u/vadimtk)\
**Post date:** [December 24, 2020, 2:48pm UTC](https://forums.percona.com/t/creating-a-service-to-startup-mysql-8-0-using-generic-binary-tar-and-my-cnf-in-non-default-location/8440/2 "2020-12-24T14:48:50Z")

</div>

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

```

---

<div class="post-metadata">

**Author:** ![ipcmlr](https://avatars.discourse-cdn.com/v4/letter/i/df705f/32.png) [@ipcmlr](https://forums.percona.com/u/ipcmlr)\
**Post date:** [December 28, 2020, 9:34am UTC](https://forums.percona.com/t/creating-a-service-to-startup-mysql-8-0-using-generic-binary-tar-and-my-cnf-in-non-default-location/8440/3 "2020-12-28T09:34:33Z")

</div>

@vadimtk thanks. Let me try this out.

---

<div class="post-metadata">

**Author:** ![ipcmlr](https://avatars.discourse-cdn.com/v4/letter/i/df705f/32.png) [@ipcmlr](https://forums.percona.com/u/ipcmlr)\
**Post date:** [December 28, 2020, 9:38am UTC](https://forums.percona.com/t/creating-a-service-to-startup-mysql-8-0-using-generic-binary-tar-and-my-cnf-in-non-default-location/8440/4 "2020-12-28T09:38:44Z")

</div>



---

<div class="post-metadata">

**Author:** ![vadimtk](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vadimtk/32/9528_2.png) [@vadimtk](https://forums.percona.com/u/vadimtk)\
**Post date:** [December 28, 2020, 9:41am UTC](https://forums.percona.com/t/creating-a-service-to-startup-mysql-8-0-using-generic-binary-tar-and-my-cnf-in-non-default-location/8440/5 "2020-12-28T09:41:29Z")

</div>

This is from my ansible scripts.

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

---

<div class="post-metadata">

**Author:** ![ipcmlr](https://avatars.discourse-cdn.com/v4/letter/i/df705f/32.png) [@ipcmlr](https://forums.percona.com/u/ipcmlr)\
**Post date:** [December 28, 2020, 9:50am UTC](https://forums.percona.com/t/creating-a-service-to-startup-mysql-8-0-using-generic-binary-tar-and-my-cnf-in-non-default-location/8440/6 "2020-12-28T09:50:18Z")

</div>

@vadimtk ah thanks. Appreciate it.
