mysql-systemd-start script does not work with datadir other than /var/lib/mysql

Bug #1680115 reported by Henri Schomaecker
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Server Guide
Invalid
Undecided
Unassigned
mysql-8.0 (Ubuntu)
Invalid
Undecided
Unassigned
Xenial
New
Undecided
Unassigned

Bug Description

The /usr/share/mysql/mysql-systemd-start script does not work with datadir other than /var/lib/mysql because the datadir path is hardcoded in the script.

Fix:

Replace...

sanity () {
  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 /srv/data/mysql/mysql ] && [ ! -L /srv/data/mysql/mysql ]; then
    echo "MySQL system database not found. Please run mysql_install_db tool."
    exit 1
  fi
}

...with...

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

  _DATADIR="$(mysqld --verbose --help | grep -i '^datadir' | awk '{print $2}' | sed 's|/$||')"

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

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

Revision history for this message
Bryce Harrington (bryce) wrote :

There is no reference to this script in the mysql section of the server guide. Presuming this bug was mis-filed maybe?

Changed in serverguide:
status: New → Invalid
Revision history for this message
Paride Legovini (paride) wrote :

Hello Henri, thanks for taking the time to file a bug report. What you describe is certainly not happening in the latest versions of Ubuntu. Could you please specify which release of Ubuntu and which exact version of the mysql-server you are using?

I'm marking this report as Incomplete for the moment; please change its status back to New after replying and we'll look at it again. Thanks!

Changed in mysql-8.0 (Ubuntu):
status: New → Incomplete
Revision history for this message
Henri Schomaecker (henri.schomaecker) wrote : Re: [Bug 1680115] Re: mysql-systemd-start script does not work with datadir other than /var/lib/mysql

Dear Paride,

I tried to log into my UbuntuOne Account but unfortunately UbuntuOne
doesn't know me/my e-mail-address any more.

So I hope, you'll receive this answer anyway.

I do not know the exact version of MySql any more because we have
updated msince then and maybe the minor version changed.

But I took a look into our Puppet Setup for MySql and I fixed it for
Ubuntu 16.04 LTS.

I hope, that's what you would like to know.

Yours Henri Schomäcker

--
---------------------------------------------------
  GLAMUS
  Gesellschaft fuer moderne Kommunikation mbH
  Gartenstraße 24, 53229 Bonn
  http://www.glamus.de/ mailto:<email address hidden>
  Tel: +49 228 97617-71 Fax: +49 228 97617-55

  HRB: Bonn 6287
  Geschaeftsfuehrer: Ulrich Santo - Gerhard Loosch

Am 30.04.2020 um 16:23 schrieb Paride Legovini:
> Hello Henri, thanks for taking the time to file a bug report. What you
> describe is certainly not happening in the latest versions of Ubuntu.
> Could you please specify which release of Ubuntu and which exact version
> of the mysql-server you are using?
>
> I'm marking this report as Incomplete for the moment; please change its
> status back to New after replying and we'll look at it again. Thanks!
>
>
> ** Changed in: mysql-8.0 (Ubuntu)
> Status: New => Incomplete
>

Changed in mysql-8.0 (Ubuntu):
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.