[debian-mysql] Bug#851878: mysql-server-5.6: cannot change mysql data dir due to hard coded script in "/usr/share/mysql/mysql-systemd-start"

Lv, Qi lvsoft at gmail.com
Thu Jan 19 14:48:39 UTC 2017


Package: mysql-server-5.6
Version: 5.6.30-1
Severity: important
Tags: newcomer

Dear Maintainer,

This bug can be reproduced by simply move the 'datadir' of mysql from '/var/lib/mysql' to other location.
After updated 'datadir' in '/etc/mysql/my.cnf' to the new location, mysql still failed to start (while success by run mysqld_safe manually).
According the log from 'systemctl status mysql.service':

● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled)
   Active: failed (Result: start-limit) since Thu 2017-01-19 22:34:49 CST; 1min 51s ago
  Process: 5029 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
 Main PID: 309 (code=exited, status=0/SUCCESS)

It is blocked by exit status of '/usr/share/mysql/mysql-systemd-start pre'. And I opened that script and find this:

... ...
  if [ ! -r /etc/mysql/my.cnf ]; then
    echo "MySQL configuration not found at /etc/mysql/my.cnf. Please create one."
    exit 1
  fi

  if [ ! -d /var/lib/mysql ] && [ ! -L /var/lib/mysql ]; then
    echo "MySQL data dir not found at /var/lib/mysql. Please create one."
    exit 1
  fi

  if [ ! -d /var/lib/mysql/mysql ] && [ ! -L /var/lib/mysql/mysql ]; then
    echo "MySQL system database not found. Please run mysql_install_db tool."
    exit 1
  fi
... ...

So basically this script will check the default mysql datadir by hard coded path, which is really bad from my point of view.
At least it should parse 'datadir' from the 'my.cnf'. Such behaviour just broken the meaning of 'datadir' field in 'my.cnf'.


-- System Information:
Debian Release: 8.6
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'stable-updates'), (500, 'proposed-updates'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages mysql-server-5.6 depends on:
ii  adduser                3.113+nmu3
ii  bsdutils               1:2.25.2-6
ii  debconf [debconf-2.0]  1.5.56
ii  init-system-helpers    1.22
ii  initscripts            2.88dsf-59
ii  libaio1                0.3.110-1
ii  libc6                  2.24-8
ii  libdbi-perl            1.636-1+b1
ii  libgcc1                1:4.9.2-10
ii  libstdc++6             6.2.1-5
ii  libwrap0               7.6.q-25
ii  lsb-base               4.1+Debian13+nmu1
ii  mysql-client-5.6       5.6.30-1
ii  mysql-common           5.8+1.0.1
ii  mysql-server-core-5.6  5.6.30-1
ii  passwd                 1:4.2-3+deb8u1
ii  perl                   5.24.1~rc4-1
ii  psmisc                 22.21-2
ii  zlib1g                 1:1.2.8.dfsg-2+b1

Versions of packages mysql-server-5.6 recommends:
ii  libhtml-template-perl  2.95-2

Versions of packages mysql-server-5.6 suggests:
ii  bsd-mailx [mailx]  8.1.2-0.20141216cvs-2
pn  tinyca             <none>

-- debconf information:
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/^(.*?)(\\)?\${ <-- HERE ([^{}]+)}(.*)$/ at /usr/share/perl5/Debconf/Question.pm line 72.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^}]+)}/ at /usr/share/perl5/Debconf/Config.pm line 30.
  mysql-server-5.6/really_downgrade: false
  mysql-server-5.6/start_on_boot: true
  mysql-server/no_upgrade_when_using_ndb:
  mysql-server/error_setting_password:
  mysql-server/password_mismatch:
  mysql-server-5.6/nis_warning:
  mysql-server-5.6/postrm_remove_databases: false


More information about the pkg-mysql-maint mailing list