2017-06-28 15:40 UTC

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0007802CentOS-7mariadbpublic2017-06-15 11:45
Reporterrgafonso 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformVMWareOSCentOSOS Version7.0.1406
Product Version7.0-1406 
Target VersionFixed in Version 
Summary0007802: mariadb service ignores /etc/my.cnf
DescriptionI have tried to change mariadb collation to utf8 by editing /etc/my.cnf and setting collation-server and character-set-server options, but those are ignored when I start the service.
If started via command line like 'mysqld_safe --defaults-file=/etc/my.cnf', then all is ok.
Also, '/usr/libexec/mysqld --help --verbose' shows desired configuration.
It seems that somehow, mysqld_safe without parameters simply ignores any configuration.
Steps To ReproduceEdited /etc/my.cnf:

--

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
collation-server = utf8_general_ci
character-set-server = utf8

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

--

Run:
$ service mariadb start

And then:
$ mysqladmin variables | grep -E 'character|collation' | tr -s ' '

| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| collation_connection | latin1_swedish_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |

TagsNo tags attached.
abrt_hash
URL
Attached Files

-Relationships
+Relationships

-Notes

~0021471

rgafonso (reporter)

I have identified the problem.
Basically /etc/my.cnf must be owned by mysql user.
Nevertheless, this shouldn't be silently ignored.

~0021589

HFalch (reporter)

Same problem here. Files in /etc/my.cnf.d have correct permissions, but different SElinux context from /etc/my.cnf (etc_t vs. mysqld_etc_t). Still they would be read, if not for the include statement being in /etc/my.cnf which can't be accessed.

Minimal force solution/workaround:
chown :mysql /etc/my.cnf
chmod g+r /etc/my.cnf

~0024289

choules@wycomco.de (reporter)

Just ran into this issue as well. Permissions and/or owner of the file /etc/my.cnf need to be fixed.

I would suggest to fix the permissions of the file to be readable by user "mysql". Is this the case the provided include paths would be read by mariadb – the default files in "/etc/my.cnf.d/" are world readable.

~0029469

chongma (reporter)

i am having the same problem. changing anything in /etc/my.cnf has no effect. i even changed the permissions on the configuration files and it makes no difference. i was running in a multi configuration and now the daemon only starts in default single instance configuration. selinux is disabled

~0029470

TrevorH (developer)

The correct permissions are as follows:

-rw-r--r--. 1 root root 901 Jun 14 12:29 /etc/my.cnf

and selinux context

-rw-r--r--. root root system_u:object_r:mysqld_etc_t:s0 /etc/my.cnf

The file should definitely NOT be owned by mysql as that would give the daemon the ability to change it, thus if someone can find a vulnerability in mariadb they could then proceed to alter the config file. See https://access.redhat.com/security/cve/cve-2016-6662 for a reason why.

~0029471

chongma (reporter)

i have tried everything and mariadb does NOT read any updates made to /etc/my.cnf.

[root@ns1 ~]# /usr/libexec/mysqld --verbose --help | grep -A 1 "Default options"
170614 13:16:23 [Note] Plugin 'FEEDBACK' is disabled.
Default options are read from the following files in the given order:
/etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf

there is no file /etc/mysql/my.cnf. the user mysql home directory is /var/lib/mysql and there is no file my.cnf in there

i run SHOW VARIABLES; in mysql CLI and the variables show no change.

i restart mariadb between changes using
systemctl stop mariadb
systemctl start mariadb

~0029472

TrevorH (developer)

What version?

# rpm -qa mariadb\*
mariadb-5.5.52-1.el7.x86_64
mariadb-libs-5.5.52-1.el7.x86_64
mariadb-server-5.5.52-1.el7.x86_64

~0029473

chongma (reporter)

FYI system info
mariadb-server-5.5.52-1.el7.x86_64
centos-release-7-3.1611.el7.centos.x86_64

~0029474

chongma (reporter)

Yes exactly the same

[root@ns1 etc]# rpm -qa mariadb\*
mariadb-server-5.5.52-1.el7.x86_64
mariadb-libs-5.5.52-1.el7.x86_64
mariadb-5.5.52-1.el7.x86_64

~0029475

TrevorH (developer)

Show the output from

ls -la /etc/mysql/my.cnf /etc/my.cnf
ls -laZ /etc/mysql/my.cnf /etc/my.cnf

~0029476

chongma (reporter)

[root@ns1 etc]# ls -la /etc/mysql/my.cnf /etc/my.cnf
ls: cannot access /etc/mysql/my.cnf: No such file or directory
-rw-r--r-- 1 root root 943 Jun 14 11:29 /etc/my.cnf
[root@ns1 etc]# ls -laZ /etc/mysql/my.cnf /etc/my.cnf
ls: cannot access /etc/mysql/my.cnf: No such file or directory
-rw-r--r-- root root ? /etc/my.cnf

~0029477

TrevorH (developer)

Then sorry, no idea, I tested here and it works for me.

~0029478

chongma (reporter)

this is the server.cnf file i was using. it worked perfectly before but now any changes i make are completely ignored. maybe you spot something that i am missing that may have changed during the last update?

it is supposed to be loaded from /etc/my.cnf. my.cnf only contains
[client-server]
!includedir /etc/my.cnf.d/multi

~0029483

chongma (reporter)

will i need to take it to mariadb support? seems strange that it has been working perfectly and then after a recent restart it isn't working any more

~0029486

TrevorH (developer)

Yes, it looks that way to me. I'm not aware that it respects what you've done in your server.cnf file - I run parallel instances of mysqld on a box and they have separate cnf files and both have a [mysqld] section. I have no idea if [mysqld1] is a supported way of working. For that you need a mysql/mariadb person.

~0029491

chongma (reporter)

yes i was thinking i might have to change to that method. these are some of the references i have been looking at;

this one explains using mysql multi:
https://unix.stackexchange.com/questions/256285/run-multiple-instances-of-mysql-centos7

this is for multiple mysql instances:
http://sharadchhetri.com/2013/12/02/create-multiple-mysql-instance-centos-6-4-red-hat-6-4/

maybe an update of mariadb has overwritten my configuration in /usr/lib/systemd/system/mariadb.service and caused the problem?

~0029492

TrevorH (developer)

Very possible. If you want to change the supplied unit files, do not edit them in place as they are not defined as config files so will be overwritten on package update. You need to copy them to /etc/systemd/system and modify them there.

~0029493

chongma (reporter)

thanks. i am reading this now as mentioned in the top of the unit file.
http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F

and also this for configuring systemd with multi
https://forums.mysql.com/read.php?10,627016,627016

i will let you know if it doesn't solve the problem
+Notes

-Issue History
Date Modified Username Field Change
2014-10-29 18:22 rgafonso New Issue
2014-10-30 15:52 rgafonso Note Added: 0021471
2014-11-07 13:46 HFalch Note Added: 0021589
2015-09-07 12:07 choules@wycomco.de Note Added: 0024289
2017-06-14 07:12 chongma Note Added: 0029469
2017-06-14 11:33 TrevorH Note Added: 0029470
2017-06-14 12:19 chongma Note Added: 0029471
2017-06-14 12:20 TrevorH Note Added: 0029472
2017-06-14 12:23 chongma Note Added: 0029473
2017-06-14 12:24 chongma Note Added: 0029474
2017-06-14 12:24 TrevorH Note Added: 0029475
2017-06-14 12:33 chongma Note Added: 0029476
2017-06-14 12:36 TrevorH Note Added: 0029477
2017-06-14 12:49 chongma File Added: server.cnf
2017-06-14 12:49 chongma Note Added: 0029478
2017-06-14 18:32 chongma Note Added: 0029483
2017-06-14 21:27 TrevorH Note Added: 0029486
2017-06-15 11:28 chongma Note Added: 0029491
2017-06-15 11:30 TrevorH Note Added: 0029492
2017-06-15 11:45 chongma Note Added: 0029493
+Issue History