Extra instance of MariaDB or mysql in Debian Linux doesn't work when I change a name during the setup
0
votes
1
answer
67
views
**-- EDIT -- Complete setup in the answer below. -- EDIT --**
When I follow an article (link below) on how to setup a extra MariaDB or Mysql on Linux, and it works. However, I don't like the name "mysql1" & "mysql2" for instance names. But when I change just that aspect of the code, the server wont install when I run the start command.
I wrote both setups here below for easy comparison: The one that does work where 2 instances are being made, and the one that ultimately doesn't work.
I would very much love to figure how to make the one that doesn't work, work.
Your help is very much appreciated!
**- 1) Datadir (setup that works):**
sudo mkdir -p -v /var/lib/mysql{1..2}
sudo chown mysql:mysql -v /var/lib/mysql{1..2}
**- 1) Datadir (setup that ultimately doesn't work):**
sudo mkdir -p -v /var/lib/mysqlTest
sudo chown mysql:mysql -v /var/lib/mysqlTest
**- 2) Socket directory (setup that works):**
sudo mkdir -p -v /usr/local/mysql/mdb{1..2}
sudo chown -v -R mysql:mysql /usr/local/mysql/mdb{1..2}
**- 2) Socket directory(setup that ultimately doesn't work):**
sudo mkdir -p -v /usr/local/mysql/mdbTest
sudo chown -v -R mysql:mysql /usr/local/mysql/mdbTest
**- 3) Log directory (setup that works):**
sudo mkdir -p -v /var/log/mysql{1..2}
sudo chown -v -R mysql:mysql /var/log/mysql{1..2}
**- 3) Log directory(setup that ultimately doesn't work):**
sudo mkdir -p -v /var/log/mysqlTest
sudo chown -v -R mysql:mysql /var/log/mysqlTest
**- 4) I create the following file**
"mysqld_multi_cls.cnf"
Located at: /etc/mysql/
**- 5) content (setup that works):**
# Configuration Settings for mysqld_multi , as well as separate instances.
#
[mysqld_multi]
mysqld = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
[mysqld1]
socket = /tmp/mysql.sock1
port = 3307
pid-file = /usr/local/mysql/mdb1/ansible-host1.pid1
datadir = /var/lib/mysql1
log-error = /var/log/mysql1/error.log
log_bin = /var/lib/mysql1/mdb1-mysql-bin.log
server-id = 1
expire_logs_days = 72
sync_binlog = 1
innodb_flush_log_at_trx_commit = 1
innodb_flush_method = O_DIRECT
binlog_format = mixed
gtid_strict_mode = 1
[mysqld2]
socket = /tmp/mysql.sock2
port = 3308
pid-file = /usr/local/mysql/mdb2/ansible-host1.pid2
datadir = /var/lib/mysql2
log-error = /var/log/mysql2/error.log
log-bin = /var/lib/mysql2/mdb2-mysql-bin.log
server-id = 2
expire_logs_days = 64
sync_binlog = 1
innodb_flush_log_at_trx_commit = 1
innodb_flush_method = O_DIRECT
binlog_format = mixed
gtid_strict_mode = 1
**- 5) content(setup that ultimately doesn't work):**
# Configuration Settings for mysqld_multi , as well as separate instances.
#
[mysqld_multi]
mysqld = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
[mysqlTest]
socket = /tmp/mysql.sock3
port = 3309
pid-file = /usr/local/mysql/mdbTest/ansible-host1.pid3
datadir = /var/lib/mysqlTest
log-error = /var/log/mysqlTest/error.log
log_bin = /var/lib/mysqlTest/mdbTest-mysql-bin.log
server-id = 3
expire_logs_days = 72
sync_binlog = 1
innodb_flush_log_at_trx_commit = 1
innodb_flush_method = O_DIRECT
binlog_format = mixed
gtid_strict_mode = 1
**-6) And now we start the server:**
sudo mysqld_multi --defaults-file=/etc/mysql/mysqld_multi_cls.cnf --log=/etc/mysql/multi_ins.log start
- If done in the 1st manor, the database is now installing and everyone is happy.
- But if done in the 2nd manor where I only changed the name and made a single (extra) instance, nothing happens.
What am I missing?
Cheers and thank you very much!
Here is the article on Linkedin by Michael Amadi:
https://www.linkedin.com/pulse/running-multiple-instances-mariadb-single-server-different-amadi
Asked by Desert Wind
(43 rep)
Jan 16, 2025, 03:42 AM
Last activity: Feb 3, 2025, 04:40 AM
Last activity: Feb 3, 2025, 04:40 AM