Can't start mysql

Linode Staff

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

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct