Mysql was working, then I tried to move the MySql database directory as in this question which I already successfully used several times, but this time something went wrong and I got the error:
$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
so I re-installed mysql (several times as I kept getting that error), mainly with the following commands:
# ** uninstall:
sudo su
rm -r /var/lib/mysql # delete the database
aptitude remove mysql-server mysql-client mysql-common
apt-get autoremove
apt-get autoclean
# ** reinstall
apt-get install mysql-server mysql-client mysql-common
apt-get update
The disk is not full and I think think the problem is that at some point somehow I managed to get /etc/apparmor.d/usr.sbin.mysqld
deleted and now I have the previous problem and also
$ service mysql status
mysql: unrecognized service
The disk is not full and if I reinstall mysql the file is not added. So, thanks to @AbrahamVanHelpsing I got the file from source, but the problem stills. Any ideas?
Thanks
Edit
aa-status
did not mention mysql but it does now that I put the file that was missing.
Another edit
I can access mysql by running sudo mysqld
and then mysql
from another terminal, I still hope to register mysql in apparmor though