MySQL service unable to start...


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
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=
Jun 03 09:09:10 roofingsheetsbyrhino sshd[991]: Failed password for invalid user share123 from port 55360 ssh2
Jun 03 09:09:11 roofingsheetsbyrhino sshd[991]: Received disconnect from 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!


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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!

here is my /etc/mysql/mysql.conf.d/mysqld.cnf file replace it with yours and make chmod 777 it should work.

# The MySQL database server configuration file.
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
# For explanations see

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

socket		= /var/run/mysqld/mysqld.sock
nice		= 0

# * Basic Settings
user		= mysql
pid-file	= /var/run/mysqld/
socket		= /var/run/mysqld/mysqld.sock
port		= 3306
basedir		= /usr
datadir		= /var/lib/mysql
tmpdir		= /tmp
lc-messages-dir	= /usr/share/mysql
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address		=
# * Fine Tuning
key_buffer_size		= 16M
max_allowed_packet	= 16M
thread_stack		= 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options  = BACKUP
#max_connections        = 100
#table_open_cache       = 64
#thread_concurrency     = 10
# * Query Cache Configuration
query_cache_limit	= 1M
query_cache_size        = 16M
# * Logging and Replication
 Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
# Error log - should be very few entries.
log_error = /var/log/mysql/error.log
# Here you can see queries with especially long duration
#slow_query_log		= 1
#slow_query_log_file	= /var/log/mysql/mysql-slow.log
#long_query_time = 2
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id		= 1
#log_bin			= /var/log/mysql/mysql-bin.log
expire_logs_days	= 10
max_binlog_size   = 100M
#binlog_do_db		= include_database_name
#binlog_ignore_db	= include_database_name
# * InnoDB
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# * Security Features
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem

Site Moderator
Site Moderator badge
July 27, 2022

Hello there,

For anyone that runs into a similar issue, I’ll recommend checking:

  • If you have recently made any changes to the MySQL configuration or any general changes on the droplet. Check what the changes are and if possible try to revert them and test if the issue is resolved.

  • Examine the server’s resource usage and check if there is anything that consumes the server’s memory or CPU.

  • Check the MySQL error log for a specific error message.

  • Additionally, you can check /var/log/syslog for any references to the MySQL service that can help to resolve the issue.

We also have an article on How To Troubleshoot Issues in MySQL


Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel