MySQL not running
I'm trying to fix a Linode I've been assigned to work on. It's hosting a WordPress site and it no longer connects to the database. I'm pretty good with Linux and the shell but this one has me stumped. I have another Linode webserver that is running and I'm comparing the two to troubleshoot.
There is no mysqld.sock or mysqld.pid. Apache is running. I've tried invoking the mysqladmin, mysqld, and mysql commands but they don't seem to work
Can someone point me to where I might begin to debug this situation?
Thanks.
8 Replies
What does systemctrl status mysqld return (or the init script for your distro)?
root@ubuntu:~# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
sudo systemctl status mysql -l
This can also turn up some relevant logs:
sudo journalctl -u mysql --no-pager | tail -20
You should also check if your disk is full; this is a common reason for why MySQL won't start:
df -i
df -h
sudo: systemctl: command not found
sudo: journalctl: command not found
I've got 2 linodes, one works. I get the above returned on both. Sounds like maybe an environment issue maybe? It's not including another directory in the search for the command?
I used both my local terminal and the web based one through the Linode control panel.
The df -i and df -h commands do work and there's plenty of disk space.
Looks like progress.
-rw-rw–-- 1 mysql mysql 5 Mar 28 16:58 mysqld.pid
srwxrwxrwx 1 mysql mysql 0 Mar 28 16:58 mysqld.sock
In the Linode not working there are no such files. The ownership was root:root.
Somehow it got changed. I should verify ownership of the related and dependent directories and files.
Speciifically the directory /var/lib/mysql and all it's contents had ownership set to root:root. I set it all to mysql:mysql and that fixed it.
Thanks to the suggestions I got different views on this problem and finally honed in on the solution. I appreciate the support.