Bug #77357 mysql-systemd-start script error when using option datadir or similar
Submitted: 15 Jun 2015 9:10 Modified: 29 Jun 2015 15:28
Reporter: Thomas Mack Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Packaging Severity:S3 (Non-critical)
Version:5.5.43 OS:Linux (Centos 7)
Assigned to: Balasubramanian Kandasamy CPU Architecture:Any

[15 Jun 2015 9:10] Thomas Mack
Description:
File /usr/bin/mysql-systemd-start has to quote $ret in line 16, as $ret may contain spaces, e.g., when datadir is set to some different value in /etc/my.cnf.

How to repeat:
Installed mysql on CentOS 7 via:

rpm -Uhv http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
yum -y install mysql-community-server

and changed the datadir path to some other directory in /etc/my.cnf.

Starting mysql with

systemctl start mysql

will give a (non-critical) error:

Jun 15 09:54:10 is246.ifis.cs.tu-bs.de mysql-systemd-start[17949]: /usr/bin/mysql-systemd-start: Zeile 16: [: /var/lib/mysql: Zweistelliger (binärer) Operator erwartet.

(line 16: [: /var/lib/mysql: expected binary operator)

when seen with

systemctl status mysql

Line 16 in /usr/bin/mysql-systemd-start $ret has to be quoted, as $ret may contain spaces, in my case with changed datadir, it contains

/var/lib/mysql /home/mysql

[ -z $ret ] && ret=$default

doesn't work.

Suggested fix:
Change line 16 in /usr/bin/mysql-systemd-start to [ -z "$ret" ] ...
[16 Jun 2015 11:56] Terje Røsten
Thanks for report!
[29 Jun 2015 15:28] Paul Dubois
Noted in 5.5.45, 5.6.26, 5.7.8, 5.8.0 changelogs.

mysql-systemd-start failed if datadir was set in /etc/my.cnf.