No Directory, Logging in with HOME=/ After MySQL 5.7 Upgrade

I had this appearing when attempting to restart an the MySQL service after upgrading to MySQL 5.7 from 5.5 on Ubuntu.

 * Stopping MySQL Community Server 5.7.17
 * No Directory, Logging in with HOME=/
 ..

 * MySQL Community Server 5.7.17 is stopped
 * Re-starting MySQL Community Server 5.7.17
 ..
 * MySQL Community Server 5.7.17 is started


After some research, it was the system /etc/passwd file had ultimately changed after the install.

mysql:x:119:129:MySQL Server,,,:/nonexistent:/bin/false

Whereas :/nonexistent should appear the path to the MySQL library :/var/lib/mysql

mysql:x:119:129:MySQL Server,,,:/var/lib/mysql:/bin/false

So now when we attempt to restart the MySQL Service:


> sudo service mysql restart

 * Stopping MySQL Community Server 5.7.17
 ..
 * MySQL Community Server 5.7.17 is stopped
 * Re-starting MySQL Community Server 5.7.17
 ..
 * MySQL Community Server 5.7.17 is started

MySQL is now able to locate the correct Directory rather than defaulting to the ~/!