I found that this error could be consistently reproduced on bionic.  The
problem occurs if /var/lib/mysql already exists before installing the
packages.

Steps to reproduce, from a bare install of Ubuntu server:

  1) sudo mkdir /var/lib/mysql
  2) sudo apt install mysql-server

The annoying thing is that even if you then run "sudo chown mysql:mysql
/var/lib/mysql" (after the first attempt created the user and group),
and re-run the install, it still doesn't work even though it creates
some files in /var/lib/mysql .

The use case for why you would want to pre-create /var/lib/mysql is when
you want it on a separate filesystem.  The required steps to achieve
this are as follows; if necessary, ensure you purge the package and
delete the contents of /var/lib/mysql (except lost+found) first.

    sudo umount /var/lib/mysql
    sudo rmdir /var/lib/mysql
    sudo apt install mysql-server
    sudo service mysql stop
    sudo mv /var/lib/mysql /var/lib/mysql.tmp
    sudo install -m 0 -d /var/lib/mysql   # Create mount point with no 
permissions
    sudo mount /var/lib/mysql             # Assumes filesystem is created and 
listed in /etc/fstab
    sudo sh -c 'mv /var/lib/mysql.tmp/* /var/lib/mysql'
    sudo rmdir /var/lib/mysql.tmp/
    sudo service mysql start

** Changed in: mysql-5.7 (Ubuntu)
       Status: Expired => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1785693

Title:
  package mysql-server-5.7 5.7.23-0ubuntu0.18.04.1 failed to
  install/upgrade: installed mysql-server-5.7 package post-installation
  script subprocess returned error exit status 1

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1785693/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to