Can't create file /var/lib/mysql/user.lower-test MySQL database has been problem free for a few months. Today when I checked for upgradeable packages using the Synaptic Package Manager it came up with the various MySQL components (-common,  -client, -server, etc). I therefore decided to upgrade (I forgot to note the installed version but think it was 5.6.21) to 5.6.25-1-ubuntu2.0.Afterwards when I went to query the database I got the message:-

Error occured: Can't connect to MySQL server on '127.0.0.1' (111)


I then found the server was not running. In the log file I fond that the message:-

Can't create file /var/lib/mysql/user.lower-test


I have spent an hour or so searching on line and although the issue has been reported previously I have not seen it in the context of a 'post-update' issue so unsure of my next step.
This problems seems to permission issues or change the mysql data direcory to other location then /var/lib/mysql. 


  Try to run with sudo


Looks like /var/lib/mysql is owned by the mysql user and the group is set to mysql as well. 

$ sudo chown -R mysql /var/lib/mysql
$ sudo chgrp -R mysql /var/lib/mysql
$ sudo chmod 755 /var/lib/mysql


Have you checked that the directory /var/lib/mysql does actually exist and corresponds to your data directory? If it does not, then you probably must specify otherwise the datadir parameter under the mysqld section

[mysqld]
datadir=/var/lib/mysql


Then you can chose between configuring apparmor to allow MySQL to read\execute\modify the new data directory and sub directories or, at your very own risk, you can remove apparmor. You may need to be root to do the following:

/etc/init.d/apparmor stop
/etc/init.d/apparmor teardown
update-rc.d -f apparmor remove
apt-get purge apparmor
reboot