# Trying to setup Mutliple mysqld instances on same machine?

**URL:** <https://forums.percona.com/t/trying-to-setup-mutliple-mysqld-instances-on-same-machine/8092>\
**Category:** Percona Server for MySQL 8.0\
**Created:** [October 1, 2020, 5:42am UTC](https://forums.percona.com/t/trying-to-setup-mutliple-mysqld-instances-on-same-machine/8092 "2020-10-01T05:42:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lokesh123](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lokesh123/32/5519_2.png) [@lokesh123](https://forums.percona.com/u/lokesh123)\
**Post date:** [October 1, 2020, 5:42am UTC](https://forums.percona.com/t/trying-to-setup-mutliple-mysqld-instances-on-same-machine/8092/1 "2020-10-01T05:42:48Z")

</div>

I am trying to setup multi instance MySQL setup following official docs gettings issue.

[MySQL :: MySQL 8.0 Reference Manual :: 2.5.9 Managing MySQL Server with systemd](https://dev.mysql.com/doc/refman/8.0/en/using-systemd.html#systemd-multiple-mysql-instance)…

my.cnf

```auto
[mysqld@replica01]
datadir=/var/lib/mysql-replica01
socket=/var/lib/mysql-replica01/mysql.sock
port=3307
log-error=/var/log/mysqld-replica01.log

[mysqld@replica02]
datadir=/var/lib/mysql-replica02
socket=/var/lib/mysql-replica02/mysql.sock
port=3308
log-error=/var/log/mysqld-replica02.log

================end of file===============
=========================================

﻿mysqld-replica01.log

2020-10-01T10:58:48.704098Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20-11) starting as process 95995
2020-10-01T10:58:48.712881Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-10-01T10:58:49.098915Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-10-01T10:58:49.204241Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/var/lib/mysql/mysqlx.sock' failed, can't create lock file /var/lib/mysql/mysqlx.sock.lock'
2020-10-01T10:58:49.204652Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060
2020-10-01T10:58:49.276263Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-10-01T10:58:49.298709Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.20-11' socket: '/var/lib/mysql-replica01/mysql.sock' port: 3310 Percona Server (GPL), Release 11, Revision 5b5a5d2.
~

================================================================
mysqld-replica02.log

2020-10-01T10:58:53.589526Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20-11) starting as process 96080
2020-10-01T10:58:53.597853Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-10-01T10:58:53.882940Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-10-01T10:58:54.986742Z 0 [ERROR] [MY-011292] [Server] Plugin mysqlx reported: 'Preparation of I/O interfaces failed, X Protocol won't be accessible'
2020-10-01T10:58:54.986969Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of bind-address: '*' port: 33060 failed, `bind()` failed with error: Address already in use (98). Do you already have another mysqld server running with Mysqlx ?'
2020-10-01T10:58:54.987286Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/var/lib/mysql/mysqlx.sock' failed, can't create lock file /var/lib/mysql/mysqlx.sock.lock'
2020-10-01T10:58:55.050673Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-10-01T10:58:55.073122Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.20-11' socket: '/var/lib/mysql-replica02/mysql.sock' port: 3320 percona Server (GPL), Release 11, Revision 5b5a5d2.
=================================================

 service mysqld@replica01 status shows ---> active and running 
 service mysqld@replica01 status shows ----> active and running

How to repeat:
after configuration start service 

 service mysqld@replica01 start
 service mysqld@replica02 start

```

---

<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:** [October 1, 2020, 1:13pm UTC](https://forums.percona.com/t/trying-to-setup-mutliple-mysqld-instances-on-same-machine/8092/2 "2020-10-01T13:13:06Z")

</div>

Error shows the conflict on [mysqlx\_port](https://dev.mysql.com/doc/refman/8.0/en/x-plugin-options-system-variables.html#sysvar_mysqlx_port) , not on regular port.

Try to use different [mysqlx\_port](https://dev.mysql.com/doc/refman/8.0/en/x-plugin-options-system-variables.html#sysvar_mysqlx_port) for replica01 and replica02

---

<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:** [October 1, 2020, 1:14pm UTC](https://forums.percona.com/t/trying-to-setup-mutliple-mysqld-instances-on-same-machine/8092/3 "2020-10-01T13:14:36Z")

</div>

Similarly you need to configure [mysqlx\_socket](https://dev.mysql.com/doc/refman/8.0/en/x-plugin-options-system-variables.html#sysvar_mysqlx_socket) as you changed location for socker

---

<div class="post-metadata">

**Author:** ![lokesh123](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lokesh123/32/5519_2.png) [@lokesh123](https://forums.percona.com/u/lokesh123)\
**Post date:** [October 5, 2020, 12:32am UTC](https://forums.percona.com/t/trying-to-setup-mutliple-mysqld-instances-on-same-machine/8092/4 "2020-10-05T00:32:53Z")

</div>

Thanks for suggestions @vadimtk Which port and which path will work?

---

<div class="post-metadata">

**Author:** ![lokesh123](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lokesh123/32/5519_2.png) [@lokesh123](https://forums.percona.com/u/lokesh123)\
**Post date:** [October 5, 2020, 4:04am UTC](https://forums.percona.com/t/trying-to-setup-mutliple-mysqld-instances-on-same-machine/8092/5 "2020-10-05T04:04:11Z")

</div>

service starts well … but not able to get MySQL temporary password to login to mysql and also mysql.tables are not generated .

**logs**

**5T09:17:18.597757Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.20-11) Percona Server (GPL), Release 11, Revision 5b5a5d2.**

2020-10-05T09:17:34.954171Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20-11) starting as process 102029

2020-10-05T09:17:34.965764Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.

2020-10-05T09:17:35.267718Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.

2020-10-05T09:17:35.371795Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: ‘/var/lib/mysql-replica01/mysqlx.sock’ bind-address: ‘::’ port: 33061

2020-10-05T09:17:35.447142Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.

2020-10-05T09:17:35.470199Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: ‘8.0.20-11’ socket: ‘/var/lib/mysql-replica01/mysql.sock’ port: 3310 Percona Server (GPL), Release 11, Revision 5b5a5d2.
