I had a LAMP stack running on Ubuntu for WordPress development, however something has gone wrong with the setup and I now get the infamous “Error establishing a database connection” when connecting to the localhost running WordPress. The problem is with MySQL; after executing a killall
and restarting the related services, the MySQL restart fails. The error I get says:
Process: 2924 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
(…)
mysqld[2924]: mysqld" Can't change dir to '/var/lib/mysql/' (Errcode: 13 - Permission denied).
I ran the commands both as the local user and as sudo
so I don’t know what’s going on with the permissions. I gave the local user permissions over this directory through the chown
command but that didn’t change anything.
I can’t figure out what went wrong with MySQL as the stack was running WordPress locally just fine. Then I came back from the weekend and poof – it’s all a mess. Any insight would be greatly appreciated; I really don’t want to have to wipe the stack and start over. Thanks.