While there is a number of answers for this question already, I haven't managed to fix this issue with any of them. So here are my facts.
I updated Ubuntu 14.04 after about 2 months of non usage. Right after the update, mysql would not work, giving me the following errors
PHP (local web dev):
Warning: mysqli_connect(): (HY000/2002): No such file or directory
Console:
sudo service mysql start
start: Job failed to start
or (not as root)
service mysql start
start: Unknown job: mysql
MySQL installation check gives me:
$ dpkg --get-selections | grep mysql
libapache2-mod-auth-mysql install
libmysqlclient18:amd64 install
libmysqlclient18:i386 install
libqt4-sql-mysql:i386 install
mysql-common install
mysql-server-5.5 deinstall
mysql-workbench-community install
php5-mysql deinstall
php7.0-mysql install
I see that while mysql-server-5.5 is installed, some other packages are missing, but from what I have read so far these are not necessary for the server to run.
Also, trying to get the server status using mysqladmin will return:
$ mysqladmin -u root -p status
mysqladmin: command not found
I have also tried to change the mysql data directory's permissions, as I have read that root perms may prohibit access and start of mysql server, although that should not be a consideration since mysql is not even recognized as a command.
I would have no problem trying to reinstall mysql if I knew my databases would be left in place.
UPDATE
I also tried dmesg command, and I get this result
dmesg | grep mysql
[ 4.315790] init: Failed to spawn mysql main process: unable to execute: No such file or directory
[ 3556.147153] audit: type=1400 audit(1482506149.514:64): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="/usr/sbin/mysqld" pid=4942 comm="apparmor_parser"
[ 3556.149528] init: Failed to spawn mysql main process: unable to execute: No such file or directory
[ 4666.027886] audit: type=1400 audit(1482507259.370:65): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="/usr/sbin/mysqld" pid=5724 comm="apparmor_parser"
[ 4666.030250] init: Failed to spawn mysql main process: unable to execute: No such file or directory
[ 8341.035215] audit: type=1400 audit(1482510934.298:66): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="/usr/sbin/mysqld" pid=7776 comm="apparmor_parser"
[ 8341.046625] init: Failed to spawn mysql main process: unable to execute: No such file or directory
Apparently mysqld is missing(?)
locate mysqld
returns
/etc/apparmor.d/usr.sbin.mysqld
/etc/apparmor.d/cache/usr.sbin.mysqld
/etc/apparmor.d/local/usr.sbin.mysqld
/etc/mysql/conf.d/mysqld_safe_syslog.cnf
/usr/lib/mysql-workbench/mysqldump
Any help appreciated :)