Bug #82417 [Debian Jessie] Issue with systemd and custom directory installation
Submitted: 3 Aug 2016 7:51 Modified: 7 Jun 2017 13:45
Reporter: oran geade Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S2 (Serious)
Version:5.7.14 OS:Debian (Jessie)
Assigned to: Lars Tangvald CPU Architecture:Any
Tags: systemd debian jessie mysql 5.7.14

[3 Aug 2016 7:51] oran geade
Description:
Hello,

When you want a custom directory installation (ex: /my_rep_mysql/mysql) and not /var/lib/mysql, the systemd stop/start script does not work correctly. The instance start with a tmp directory and tmp init-file (not with my init-file).

Exemple :
2016-08-02T12:36:04.405867+01:00 0 [Note] Execution of init_file '/var/lib/mysql-files/tmp.tOJUD6F2j6' started.
2016-08-02T12:36:04.411336+01:00 0 [Note] Execution of init_file '/var/lib/mysql-files/tmp.tOJUD6F2j6' ended.
2016-08-02T12:36:04.411464+01:00 0 [Note] mysqld: ready for connections.
Version: '5.7.14-log'  socket: '/tmp/tmp.179U9LIpoi/mysqld.sock'  port: 3306  MySQL Community Server (GPL)

How to repeat:
You can do a custom directory installation, ex : /my_rep_mysql/mysql

Suggested fix:
File /usr/share/mysql/mysql-systemd-start :

        < MYSQLDATA=/var/lib/mysql
        > MYSQLDATA=$(get_path datadir)
[3 Aug 2016 10:39] Lars Tangvald
Thanks for the report.

Suggested fix should do the job, though there may be other, similar issues in the service and installation scripts (i.e. using hardcoded default values instead of fetching from config), so we should go through all of it.
[7 Jun 2017 13:45] Paul DuBois
Posted by developer:
 
Noted in 5.7.19, 8.0.2 changelogs.

systemd support scripts in Debian packages contained hardcoded
references to the data directory, making it difficult to change the
data directory using --datadir.