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

Bug #1623440 reported by ryzh
This bug affects 354 people
Affects Status Importance Assigned to Milestone
mysql-5.7 (Ubuntu)
Invalid
Undecided
santosh kshirsagar

Bug Description

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

ProblemType: Package
DistroRelease: Ubuntu 16.04
Package: mysql-server-5.7 5.7.15-0ubuntu0.16.04.1
ProcVersionSignature: Ubuntu 4.4.0-38.57-generic 4.4.19
Uname: Linux 4.4.0-38-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.1
Architecture: amd64
Date: Wed Sep 14 13:52:50 2016
ErrorMessage: subprocess installed post-installation script returned error exit status 1
InstallationDate: Installed on 2015-03-20 (544 days ago)
InstallationMedia: Ubuntu 14.04.2 LTS "Trusty Tahr" - Release amd64+mac (20150218.1)
Logs.var.log.daemon.log:

MySQLConf.etc.mysql.conf.d.mysql.cnf: [mysql]
MySQLConf.etc.mysql.conf.d.mysqld_safe_syslog.cnf:
 [mysqld_safe]
 syslog
MySQLConf.etc.mysql.conf.d.mysqldump.cnf:
 [mysqldump]
 quick
 quote-names
 max_allowed_packet = 16M
MySQLConf.etc.mysql.mysql.conf.d.mysqld_safe_syslog.cnf:
 [mysqld_safe]
 syslog
MySQLVarLibDirListing: ['ib_logfile1', 'debian-5.5.flag', 'sys', 'mysql_upgrade_info', 'mysql', 'ib_logfile0', 'performance_schema', 'debian-5.7.flag', 'test', 'ib_buffer_pool', 'ibdata1', 'auto.cnf', 'phpmyadmin']
ProcCmdline: BOOT_IMAGE=/boot/vmlinuz-4.4.0-38-generic root=UUID=8387c024-91e5-4197-8345-3c258980d6b6 ro quiet splash vt.handoff=7
RelatedPackageVersions:
 dpkg 1.18.4ubuntu1.1
 apt 1.2.14
SourcePackage: mysql-5.7
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
UpgradeStatus: No upgrade log present (probably fresh install)
modified.conffile..etc.mysql.debian-start: [modified]
mtime.conffile..etc.mysql.debian-start: 2015-04-29T16:16:32.688253

Revision history for this message
ryzh (ryzh) wrote :
tags: removed: need-duplicate-check
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mysql-5.7 (Ubuntu):
status: New → Confirmed
Revision history for this message
Thom Davis (thomdavis40) wrote :

The mysqld won't launch because it appears to see another process using port 3306 and the update to mysql-server-5.7 fails. - from mysql error log file:

2016-09-15T02:18:17.979012Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.13-0ubuntu0.16.04.2) starting as process 23533 ...
2016-09-15T02:18:17.983324Z 0 [Note] InnoDB: PUNCH HOLE support available
2016-09-15T02:18:17.983359Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-09-15T02:18:17.983369Z 0 [Note] InnoDB: Uses event mutexes
2016-09-15T02:18:17.983376Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-09-15T02:18:17.983383Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-09-15T02:18:17.983390Z 0 [Note] InnoDB: Using Linux native AIO
2016-09-15T02:18:17.983570Z 0 [Note] InnoDB: Number of pools: 1
2016-09-15T02:18:17.983656Z 0 [Note] InnoDB: Using CPU crc32 instructions
2016-09-15T02:18:17.984766Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-09-15T02:18:17.992421Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-09-15T02:18:17.994116Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2016-09-15T02:18:18.005405Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2016-09-15T02:18:18.618634Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2016-09-15T02:18:18.618709Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2016-09-15T02:18:20.536298Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2016-09-15T02:18:20.553687Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2016-09-15T02:18:20.553726Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2016-09-15T02:18:20.561468Z 0 [Note] InnoDB: 5.7.13 started; log sequence number 2640189
2016-09-15T02:18:20.561675Z 0 [Note] Plugin 'FEDERATED' is disabled.
2016-09-15T02:18:20.564973Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2016-09-15T02:18:20.565308Z 0 [Note] InnoDB: Buffer pool(s) load completed at 160914 22:18:20
2016-09-15T02:18:20.568395Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2016-09-15T02:18:20.568420Z 0 [Note] Server hostname (bind-address): '192.168.100.16'; port: 3306
2016-09-15T02:18:20.568434Z 0 [Note] - '192.168.100.16' resolves to '192.168.100.16';
2016-09-15T02:18:20.568460Z 0 [Note] Server socket created on IP: '192.168.100.16'.
2016-09-15T02:18:20.568478Z 0 [ERROR] Can't start server: Bind on TCP/IP port: Cannot assign requested address
2016-09-15T02:18:20.568483Z 0 [ERROR] Do you already have another mysqld server running on port: 3306 ?
2016-09-15T02:18:20.568497Z 0 [ERROR] Aborting

Revision history for this message
Robie Basak (racb) wrote :

hank you for your report.

This looks like a local configuration problem, rather than a bug in Ubuntu.

You can find pointers to get help for this sort of problem here: http://www.ubuntu.com/support/community

Since we use this bug tracker to track bugs in Ubuntu, rather than configuration problems, I'm marking this bug as Invalid. This helps us to focus on fixing bugs in Ubuntu.

If you believe that this is really a bug, then you may find it helpful to read "How to report bugs effectively" http://www.chiark.greenend.org.uk/~sgtatham/bugs.html. We'd be grateful if you would then provide a more complete description of the problem, explain why you believe this is a bug in Ubuntu rather than a problem specific to your system, and then change the bug status back to New.

Changed in mysql-5.7 (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Jonathan Pasquier (jonathan-pasquier) wrote :

Hi,

In my case it was indeed a kind of local configuration problem.

I used to have my mysql root account configured with a blank password.

When I upgraded some time ago (to 15.04 I guess, according to this bug report #1447808), the upgrade process decided to change the authentication plugin for my root account from mysql_native_password to auth_socket

I changed back the plugin to mysql_native_password and that was it, I was still able to connect as root with no password (I'm totally aware that's no good practice, but I'm on my dev machine and I'm lazy)

Earlier this month, another mysql server update "broke" again my root access, so I followed these instructions: http://askubuntu.com/a/784347/59479

Basically, it says to login from the command line as root using unix socket, to drop the root user and to create it back with a blank password. And it worked!

But the last time I tried to upgrade mysql-server, I found myself with the present bug, with the upgrade process hanging while configuring mysql-server-5.7 package

After some time, I found that the process was blocked on line 364 of /var/lib/dpkg/info/mysql-server-5.7.postinst
where it detect if the root password is blank, and if so it tries to set the authentication plugin back to auth_socket with the following query:
"ALTER USER 'root'@'localhost' IDENTIFIED WITH 'auth_socket';"

This query in my case was causing an error that the package manager was not able to recover from, which was causing it to hang.

My Workaround was the following:
(I did this while the upgrade process was hanging, which means the mysql server was up at that time)

1.- Connect from the command line to mysql, with mysql -u root -h 127.0.0.1
2.- Drop root user
In my case I had to issue the following queries:
DROP USER root@myhostname;
DROP USER root@127.0.0.1;
DROP USER root@'::1';
DROP USER root@'%';
3.- Flush privileges (just in case)
4.- Create back root user WITH password
CREATE USER 'root'@'%' IDENTIFIED BY 'SomeComplicatedPassword';
5.- Flush privileges

I then killed the upgrade process, removed the mysql server package with apt-get purge mysql-server-core-5.7
and installed it back with apt-get install mysql-server

This time, the upgrade process detected that the root account had a password and did not try to set back the auth_socket plugin

Now, everything is working again!

Hope this helps!

Revision history for this message
Jonathan Pasquier (jonathan-pasquier) wrote :

I forgot to add the following step between step 4 and 5 of the workaround:

Set back privileges for the root account with
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'SomeComplicatedPassword';

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for mysql-5.7 (Ubuntu) because there has been no activity for 60 days.]

Changed in mysql-5.7 (Ubuntu):
status: Incomplete → Expired
Changed in mysql-5.7 (Ubuntu):
assignee: nobody → santosh kshirsagar (santoshkshirsagar)
Revision history for this message
Malik Rumi (malik-a-rumi) wrote :

Excuse me, but this issue is not 'expired' for me. I just came across it this morning. Furthermore, when you say this is a 'configuration' issue, you could be a little more helpful / specific than just pointing the the community forum - assuming you have some idea what the alleged configuration issue is.

2. I decided to sudo apt-get install mysql because nothing else I was trying with 5.6 was working. I had errors like:

error-2002-hy000-can-t-connect-to-local-mysql-server-through-socket-var-run-mysqld-mysqld-sock

Only to find out I had no var/run/mysqld/mysqld.sock. In fact, I had no /var/run/mysqld !!!

I read about checking /etc/mysql/my.cnf. But the only uncommented line was

 !includedir /etc/mysql/conf.d/.

And all all conf.d/mysql.conf has in it is: [mysql]

By the way, I DID NOT configure any of this. This is how I got it from you.

Revision history for this message
Malik Rumi (malik-a-rumi) wrote :

p.s. -

/sbin/ldconfig.real: /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 is not a symbolic link

Setting up mysql-server-5.7 (5.7.18-0ubuntu0.16.04.1) ...
Renaming removed key_buffer and myisam-recover options (if present)
insserv: warning: script 'K01ampps' missing LSB tags and overrides
insserv: warning: script 'K01httpd' missing LSB tags and overrides
insserv: Script mongod is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:' entry: please add even if empty.
insserv: Script mongod is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:' entry: please add even if empty.
insserv: Script mongod is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:' entry: please add even if empty.
insserv: Script mongod is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:' entry: please add even if empty.
insserv: Script mongod is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:' entry: please add even if empty.
insserv: Script mongod is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:' entry: please add even if empty.
insserv: Script mongod is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:' entry: please add even if empty.
insserv: script mysql: service mysql already provided!
insserv: exiting now!
update-rc.d: error: insserv rejected the script header
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Revision history for this message
Malik Rumi (malik-a-rumi) wrote :

See this answer: https://serverfault.com/questions/471372/etc-my-cnf-what-i-am-missing

It did work for me, but all it did was return me to my original unsolved error:

malikarumi@Tetuoan2:~$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Which file, - which DIRECTORY - as I told you, does not exist.

Revision history for this message
rakudave (rakudave) wrote :

I found that issuing "sudo systemctl enable mysql.service" and then updating again fixes the issue for me (I have mysql.service disabled and only start it when needed).

Revision history for this message
Eduard Drenth (eduarddrenth) wrote :

for me this helped:

systemctl enable mysql
service mysql start
apt update
apt upgrade
systemctl disable mysql

Revision history for this message
Mahendra Singh (mahi14) wrote :

for me this was because of the "validate_password_policy" statement in my.cnf.
I had to remove that line from my.cnf and start mysql.

And as I did not need to force any password policy for my sql users, I just uninstalled the mysql password policy plugin.

Revision history for this message
Mahendra Singh (mahi14) wrote :

it is strange though that I did not face this issue since I installed mysql (a couple of months ago) and just observed this today.

The password validate plugin was just working fine until today. And mysql dev site has the same policy setting options as I had in my.cnf.

https://dev.mysql.com/doc/refman/5.7/en/validate-password-options-variables.html

Liste (listedegarde)
Changed in mysql-5.7 (Ubuntu):
status: Expired → New
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mysql-5.7 (Ubuntu):
status: New → Confirmed
Revision history for this message
Andy Walker (camtarn) wrote :

Affected me on Ubuntu for Windows. Reproduction steps:

- Start on Trusty LTS
- Install mysql-server
- Log in, create a database, but no tables
- Attempt to do an upgrade to Xenial LTS

Attempting to apt-get install mysql-server gives the following logs:

Unpacking mysql-server (5.7.20-0ubuntu0.16.04.1) ...
Setting up mysql-server-5.7 (5.7.20-0ubuntu0.16.04.1) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of stop.
Renaming removed key_buffer and myisam-recover options (if present)
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of stop.
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 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):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

Attempting to apt-get remove mysql-server gives the following logs:

Setting up mysql-server-5.7 (5.7.20-0ubuntu0.16.04.1) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of stop.
Renaming removed key_buffer and myisam-recover options (if present)
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of stop.
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 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):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 mysql-server-5.7

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

The locked /var/run/mysqld/mysqld.sock is a known issue and handled in https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1670629

But the rest of the bug is about concurrent servers on the port blocking it (so a different issue than yours Andy)

Revision history for this message
Robie Basak (racb) wrote :

This bug now contains too many conflicting statements for it to be useful to developers to fix any of the problems.

If you think you are affected by this bug, you probably aren't. Instead you're probably affected by the same *symptom* in that you see the same error message. This is not the same thing as being affected by the bug.

If you have to say "in my case ..." then you should be filing a separate bug report, not piling on to this bug, unless you know for certain that the *root cause* is the same.

If you can provide steps to reproduce a specific problem, please a separate bug with details for your case with a more helpful bug title. Then hopefully your report won't be piled on to by a bunch of other users affected by unrelated bugs, and then developers might be able to make progress with the underlying bug related to your specific case.

I'm changing the status of this report to Invalid, as the original report doesn't appear to related to a bug in Ubuntu.

Some subsequent comments from others do suggest that there may be a bug, but we need a separate report for each bug. Please do file these.

Changed in mysql-5.7 (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
K Markey (klmarkey) wrote :

I got here because of an automated upgrade that resulted in a crash report. I'm sure the root cause in my case is quite simple. I made several configuration changes to accommodate my particular installation -- using an old Mysql DB that has traveled with me from Ubuntu to MacOS and back again, and locating the DB files other than in /var/lib (which has always seemed to me to be an absurd place to locate something that may grow quite large). When making the configuration changes, I also needed to make AppArmor changes.

It seems that the particular combination of changes prevented debian-sys-maint@localhost access the Mysql server. The default DB configuration probably has debian-sys-maint as a user. My migratory DB does not, disabling its access to Mysql.

Hence...

 Setting up mysql-client-core-5.7 (5.7.22-0ubuntu0.16.04.1) ...^M
 Setting up mysql-client-5.7 (5.7.22-0ubuntu0.16.04.1) ...^M
 Setting up mysql-server-core-5.7 (5.7.22-0ubuntu0.16.04.1) ...^M
 Setting up mysql-server-5.7 (5.7.22-0ubuntu0.16.04.1) ...^M
 mysql_upgrade: Got error: 1045: Access denied for user 'debian-sys-maint'@'localhost' (using password: YES) while connecting to the MySQL server^M
 Upgrade process encountered error and will not continue.^M
 mysql_upgrade failed with exit status 11^M
 dpkg: error processing package mysql-server-5.7 (--configure):^M
  subprocess installed post-installation script returned error exit status 1^M

Revision history for this message
Paolo Montrasio (paolo-paolomontrasio) wrote :
Download full text (3.5 KiB)

I agree with #18, still this is the first bug returned by Google with this error message. I have the same symptom as #19

$ sudo tail /var/log/mysql/error.log

2018-07-11T08:34:27.647514Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180711 10:34:27
2018-07-11T08:34:27.647546Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2018-07-11T08:34:27.647559Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2018-07-11T08:34:27.647569Z 0 [Note] - '127.0.0.1' resolves to '127.0.0.1';
2018-07-11T08:34:27.647599Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2018-07-11T08:34:27.656279Z 0 [Note] Event Scheduler: Loaded 0 events
2018-07-11T08:34:27.656431Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.22-0ubuntu0.16.04.1' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu)
2018-07-11T08:34:28.342474Z 2 [Note] Access denied for user 'root'@'localhost' (using password: NO)
2018-07-11T08:34:28.348736Z 3 [Note] Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)

$ sudo cat /etc/mysql/debian.cnf

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = some password
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = the same password of the client section
socket = /var/run/mysqld/mysqld.sock

$ mysql -uroot -p

mysql> select User,Host from mysql.user;
mysql> select User,Host,authentication_string from mysql.user;
+--------------------+-----------+-------------------------------------------+
| User | Host | authentication_string |
+--------------------+-----------+-------------------------------------------+
| root | localhost | *hex random string |
| mysql.session | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| mysql.sys | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| debian-sys-maint | localhost | *different hex random string |
+--------------------+-----------+-------------------------------------------+

So the user is there, the password must be wrong.

mysql> alter user 'debian-sys-maint'@'localhost' identified by 'the password in debian.cnf';
Query OK, 0 rows affected (0.00 sec)

mysql> select User,Host,authentication_string from mysql.user where User = 'debian-sys-maint';
+------------------+-----------+-------------------------------------------+
| User | Host | authentication_string |
+------------------+-----------+-------------------------------------------+
| debian-sys-maint | localhost | *the same hex string, it didn't change |
+------------------+-----------+-------------------------------------------+

and the reason is that the password was already correct

mysql> select password('the password in debian.cnf');
+-------------------------------------------+
| password('the password in debian.cnf') |
+-------------------------------------------+
| *the hex string is both que...

Read more...

Revision history for this message
Paolo Montrasio (paolo-paolomontrasio) 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.

Revision history for this message
K Markey (klmarkey) wrote : Re: [Bug 1623440] Re: 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
Download full text (4.7 KiB)

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...

Read more...

Revision history for this message
Maris Nikos (nickmaris) wrote :

Appears also at mysql-server-5.7 5.7.24

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.