MySQL 5.7 No directory, logging in with HOME=/

Solution 1:

Having same issue to get rid of this error i did the following

  1. Stop MYSQL service:

    sudo service mysql stop

  2. Change home directory of mysql from nonexistent to original directory where it is supposed to be:

    sudo usermod -d /var/lib/mysql/ mysql

Now start mysql server again with:

sudo service mysql start

The error message has disappeared. Still why this happen is unknown.