I suppose I can reply directly.  I suppose I should post this...

I only recently found a solution to my problem.  First, some history:

When I installed Ubuntu and mysql, I needed to import databases from a 
previous installation on a Mac.  Nine years earlier I had moved the same 
database from Ubuntu to the Mac.  But my Mac had failed.  I had file 
backup, but not the *mysqldump* backup. So the easiest way to restore 
the Mac's DB to Ubuntu was to copy the entire mysql datadir to Ubuntu.  
I did the following:

1. I copied my backup to a more desirable location than in /var
2. After stopping the service, I moved /var/lib/mysql to 
/var/lib/altmysql to keep it around just in case.
3. I modified *datadir* in /etc/mysql/mysql.conf.d/mysqld.cnf to point 
to the new location.
4. After attempting to restart the server, I realized I needed to modify 
apparmor.d locations to enable access.
5. I updated character set changes to my desired *utf8* default.
6. I restarted mysql.  Everything worked.

I believe I also needed to run one process that I haven't documented to 
modify some system tables from 5.5 to 5.7.

It works except for the Ubuntu upgrades.  E.g...

> # Upgrade still fails on mysql...
>     $ sudo apt-get upgrade
>     Reading package lists... Done
>     Building dependency tree
>     Reading state information... Done
>     Calculating upgrade... Done
>     ...
>     Setting up mysql-server-5.7 (5.7.22-0ubuntu0.16.04.1) ...
>     mysql_upgrade: Got error: 1045: Access denied for user 
> 'debian-sys-maint'@'localhost' (using password: YES) while connecting 
> to the MySQL server
>     Upgrade process encountered error and will not continue.
>     mysql_upgrade failed with exit status 11
>     dpkg: error processing package mysql-server-5.7 (--configure):
>
I realized that Debian insists on mysql having a user for upgrade post 
processing, and that after copying wholesale the old Mac DB, that user 
was no longer on the system.  So, finally, a month later and a dollar 
short, I add the user...

> + Run the following, substituting password in /etc/mysql/debian.cnf 
> for PASSWORD
>
>     $ sudo su
>     root@myubuntu:/main/data/etc/mysql# mysql -u root -p
>     mysql> grant all privileges on *.* to 
> 'debian-sys-maint'@'localhost' identified by 'PASSWORD';
>     Query OK, 0 rows affected, 1 warning (0.00 sec)
>     mysql> show warnings;
> +---------+------+------------------------------------------------------------------------------------------------------------------------------------+
>     | Level   | Code | Message |
> +---------+------+------------------------------------------------------------------------------------------------------------------------------------+
>     | Warning | 1287 | Using GRANT for creating new user is deprecated 
> and will be removed in future release. Create new user with CREATE 
> USER statement. |
> +---------+------+------------------------------------------------------------------------------------------------------------------------------------+
>     1 row in set (0.00 sec)
>
Yes, apparently soon I'll need to add the user instead of merely adding 
the password.

I attempt another "sudo apt-get upgrade" and get some but not all of the 
same errors.  I run "sudo apt install -f".  Same thing.  I run 
"mysql_upgrade" directly.  Same errors.  But only one is fatal, and this 
was unique to my machine, which had an extra empty database subdirectory 
under the mysql datadir.  My bad!  Removed the offending directory.  
Rinse and repeat.  "mysql_upgrade" now works.  Running "sudo apt install 
-f" finishes the installation. It needs to set up the meta-package 
"mysql-server" now that the "mysql-server-5.7" is finally installed.  
Success!

Now updates work regularly.

I suppose when mysql requires a change to mysqld.cnf, it will complain 
that I've modified datadir, but I'll cross that bridge when I get to it.

Thanks

Kevin Markey


On 07/11/2018 05:34 AM, Paolo Montrasio wrote:
> Workaround:
>
> sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
>
> Add this line
>
> skip-grant-tables
>
> to the [mysqld] section
>
> sudo systemctl restart mysql.service
> sudo apt-get install mysql-server-5.7 # to fix the broken installation
>
> This will hang at
>
> Upgrade process completed successfully.
> Checking if update is needed.
>
> In another shell:
>
> sudo killall mysqld
>
> Or maybe I could have stopped mysql.service before installing mysql
> again
>
> sudo systemctl start mysql.service
>
> sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
>
> Remove
>
> skip-grant-tables
>
> from the [mysqld] section
>
> sudo systemctl restart mysql.service
>
> I still can't connect as debian-sys-maint so apt-get upgrade will fail
> again but at least I managed to complete this one.
>

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

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

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

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to