I just had a bear of a time running apt-get update to upgrade mysql to version 5.7.13-0ubuntu0.16.04.2 (from what version, I do not know... any idea how to find out?).
I had to create a new /var/lib/mysql directory and run "mysqld --initialize" to initialize a new installation there, then change the root password so I could get in (through several steps), then create the debian stsyem user in the database with the expected password and permissions, THEN run the upgrade.
However, it is still running on that "fresh" database now, rather than my database specefied in my own "datadir" statement in my "local.cnf" file, which is in the "/etc/mysql/mysql.conf.d/" folder (and, yes, i've done "cat * | grep datadir" in both linked directories and this is the only uncommented datadir line).
When i ran mysqld with the strace command, i saw that is ended up also loading an "auto.cnf" "file" at the end. I wonder if this is what is overriding my datadir?
Also, I tried removing the /var/lib/mysql directory and creating a symlink to my custom path and I get an error that the system database doesn't exist and to initialize the database...
Also, i would like to point out that I checked my apparmour rules and they look correct (and have always worked before today and haven't changed) to allow access to those directories.
I'm exhausted from hours of this and hopefully someone can point out what easy step I'm missing in getting my database back up.
A million thanks will be sent in your direction if you can help!