Can't start mysql
Somehow, mysql has stopped running on my system.
If I run:
service mysql status
it shows
mysql.service: Main process exited, code=exited, status=1/FAILURE
I've tried running:
service mysql start
But nothing happens.
1 Reply
Hi there,
I would suggest starting by checking for MySQL errors with the following commands:
sudo journalctl -xe
tail -30 /var/log/mysql/error.log
If logging is not enabled, you will need to edit your MySQL configuration file at /etc/mysql/my.cnf by adding or changing a line, like:
log = /example/path/to/log/file
Note that if you are using MySQL 5.1 or higher, you’ll need to use:
general_log = on
general_log_file=/path/to/log/file.log
MySQL can sometimes fail to start because there is not enough free disk space on the filesystem. You can check your disk usage with the following commands:
df -h
If this is the case, I would recommend using tools like du, find, and ncdu to test for the number of files and to look for space hogs on your system. For example, the following commands would perform a file count and provide a count of files by directory:
find . | wc -l
du -a
ncdu is a great tool that provides an interactive way to look at which directories are using the most space on your system:
ncdu