MySQL service unable to start...

June 3, 2019 923 views
MySQL Debian

Hi,

I’m getting an “Error establishing a database connection” in WordPress, and on further inspection it looks like the MySQL service isnt running.

When I try and run sudo service mysql start, I get:

Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.

If I run systemctl status mysql.service I get:

Loaded: loaded (/etc/init.d/mysql)
   Active: failed (Result: exit-code) since Mon 2019-06-03 09:00:20 UTC; 18s ago
  Process: 936 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

running sudo journalctl -xn gives me:

-- Logs begin at Mon 2019-06-03 08:58:05 UTC, end at Mon 2019-06-03 09:09:21 UTC. --
Jun 03 09:09:01 roofingsheetsbyrhino cron[509]: Authentication token is no longer valid; new one required
Jun 03 09:09:01 roofingsheetsbyrhino cron[509]: Authentication token is no longer valid; new one required
Jun 03 09:09:09 roofingsheetsbyrhino sshd[991]: Invalid user share123 from 106.12.24.108
Jun 03 09:09:09 roofingsheetsbyrhino sshd[991]: input_userauth_request: invalid user share123 [preauth]
Jun 03 09:09:09 roofingsheetsbyrhino sshd[991]: pam_unix(sshd:auth): check pass; user unknown
Jun 03 09:09:09 roofingsheetsbyrhino sshd[991]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=106.12.24.108
Jun 03 09:09:10 roofingsheetsbyrhino sshd[991]: Failed password for invalid user share123 from 106.12.24.108 port 55360 ssh2
Jun 03 09:09:11 roofingsheetsbyrhino sshd[991]: Received disconnect from 106.12.24.108: 11: Bye Bye [preauth]
Jun 03 09:09:21 roofingsheetsbyrhino sudo[993]: tom : TTY=pts/0 ; PWD=/var/www ; USER=root ; COMMAND=/bin/journalctl -xn
Jun 03 09:09:21 roofingsheetsbyrhino sudo[993]: pam_unix(sudo:session): session opened for user root by tom(uid=0)

I’m really not sure what the issue is here, or how this has come about - any advice as to what I should do next would be hugely appreciated!

Thanks!

6 Answers

That log doesn’t appear to have any MySQL info in it (which is probably stating the obvious). I believe the default log location is /var/log/mysql.log try looking in there to see if you can get any more information. If it’s not in that location, usually the log_error configuration variable will tell you where it is.

Just quickly though, what happens when you run sudo systemctl start mysqld?

Thanks, I’ll check those logs and report back.

running sudo systemctl start mysqld gives me:

Failed to start mysqld.service: Unit mysqld.service failed to load: No such file or directory.

I’m not sure if I’m being really dumb or that log file is just empty…

sudo less /var/log/mysql.log is just displaying skipping... over and over again…

  • You could check with sudo vi /var/log/mysql.log and then capital G to go to the end of the file.

    I’m not a less user, so I’m not sure what skipping... is used for (I suspect duplicate entries?).

Thanks, all I see with sudo vi /var/log/mysql.log is:

~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/var/log/mysql.log" 0L, 0C

I’m presuming this means an empty file?

  • It appears that way.

    I’m sorry, I’m not sure that there is too much I can help you with.

    Check for the logs in /var/log/mysql or /var/log and give mysqld --help a go and see if that helps you.

    There may be a MySQL expert in the community that can give you some more specific assistance, although they will probably need to know things like:

    • Your distribution;
    • The MySQL version you are using;
    • Was there some event that prompted the issues (an update, hardware restart etc.)?
    • Do you keep the Distro, MySQL and/or WP updated? If not, is it possible you were hacked?

    Good luck!

all mysqld --help gives me is:

mysqld  Ver 10.0.27-MariaDB-0+deb8u1 for debian-linux-gnu on x86_64 ((Debian))
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Starts the MariaDB database server.

Usage: mysqld [OPTIONS]

For more help options (several pages), use mysqld --verbose --help.

Is this cause I am using MariaDB? Are the logs in a different place?

  • It would appear that you are using MariaDB, although the log file will generally be around the /var/log area (it could even be /var/log/mysqld).

    I edited my previous response and hope you can get some more assistance. You might have to resort to Google.

Embarrassingly, I just realised that the issue here was my backup plugin had piled up loads of backups rather than deleting the old ones… So the droplet had run out of disk space which was causing the issues.

So I’ve fixed the problem! Thanks for your help asciant!

Have another answer? Share your knowledge.