I have installed percona-xtradb-cluster-server-5.7 on an Ubuntu 16.04 server, and mysql is running fine with the default config our of the box. However, when i try edit the my.cnf file, i get errors that the variables are unknown, e.g.,:
mysql: [ERROR] unknown variable 'datadir=/var/mysql/mysql'
I have tried to locate different my.cnf file on the server and tried to add the variables in one after the other, but seem to be getting the same error.
So my question is, where is the appropriate my.cnf file for MySQL 5.7 on Ubuntu 16.04? I have even tried in this: /etc/mysql/conf.d/mysql.cnf localtion and get the following error:
[....] Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
failed!
Below is info related to possible MySQL 5.7 config files on my Ubuntu 16.04 server
ubuntu@db-test-1:~$ sudo find / -name my.cnf
/etc/mysql/my.cnf
/etc/alternatives/my.cnf
/var/lib/dpkg/alternatives/my.cnf
ubuntu@db-test-1:~$
ubuntu@db-test-1:~$ sudo ls -l /etc/mysql/
total 20
drwxr-xr-x 2 root root 4096 Oct 30 15:05 conf.d
-rw-r--r-- 1 root root 237 Oct 30 12:42 debian.cnf
-rw-r--r-- 1 root root 836 Oct 30 14:49 my.cnf
-rw-r--r-- 1 root root 380 Oct 24 01:18 percona-xtradb-cluster.cnf
drwxr-xr-x 2 root root 4096 Oct 30 11:51 percona-xtradb-cluster.conf.d
ubuntu@db-test-1:~$ sudo ls -l /etc/mysql/conf.d/
total 8
-rw-r--r-- 1 root root 8 Oct 30 15:05 mysql.cnf
-rw-r--r-- 1 root root 55 Jan 22 2017 mysqldump.cnf
ubuntu@db-test-1:~$ /usr/sbin/mysqld --verbose --help | grep -A 1 "Default options"^C
ubuntu@db-test-1:~$ sudo su
root@db-test-1:/home/ubuntu# /usr/sbin/mysqld --verbose --help | grep -A 1 "Default options"
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf
By the way, the debian.cnf file does not come with version 5.7, but i added it cos i need it for log rotate during flush logs.
Below is my galera config at added at the bottom of the /etc/mysql/conf.d/mysql.cnf config file:
server-id = 1010101
# Galera Config
wsrep_cluster_address = gcomm://10.1.0.101, 10.1.0.101
wsrep_cluster_name = db-hr
wsrep_provider = /usr/lib/libgalera_smm.so
wsrep_provider_options = "gcache.size=4G"
wsrep_slave_threads = 4
wsrep_sst_auth = "user:secret"
wsrep_sst_method = xtrabackup-v2
The my.cnf file is set in sections and this parameter should be set under the [mysqld] section. The error suggests that you might have it in the [mysql] or [client] section. There is a free online tool that might help you create the my.cnf correctly, you do have to register your email to access it though: https://tools.percona.com/
There is a step-by-step example for Ubuntu that may help you through here https://www.percona.com/doc/percona-xtradb-cluster/LATEST/howtos/ubuntu_howto.html