Issue
I have a wordpress site on a VPS running Debian 7 that was working fine when I last visited it and I've made no changes since, but now when I visit the site it says: Error establishing a database connection. It also gives the same error in the admin portal.
I had not changed the password, domain, IP, or anything and checked the wp-config.php and everything in it is accurate.
I logged into my VPS as root and tried to log into mysql to check to see if wordpress was still a user, but it couldn't locate the socket:
root@debian7:~# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
So I tried restarting the mysqld and got:
root@debian7:~# /etc/init.d/mysql restart
[ ok ] Stopping MySQL database server: mysqld.
[FAIL] Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!
When I try to run mysqld:
root@debian7:~# mysqld
131226 15:36:15 [Warning] Can't create test file /var/lib/mysql/debian7.lower-test
131226 15:36:15 [Warning] Can't create test file /var/lib/mysql/debian7.lower-test
131226 15:36:15 [Note] Plugin 'FEDERATED' is disabled.
131226 15:36:15 InnoDB: The InnoDB memory heap is disabled
131226 15:36:15 InnoDB: Mutexes and rw_locks use GCC atomic builtins
131226 15:36:15 InnoDB: Compressed tables use zlib 1.2.7
131226 15:36:15 InnoDB: Using Linux native AIO
mysqld: Can't create/write to file '/tmp/ibRx51To' (Errcode: 30)
131226 15:36:15 InnoDB: Error: unable to create temporary file; errno: 30
131226 15:36:15 [ERROR] Plugin 'InnoDB' init function returned error.
131226 15:36:15 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
131226 15:36:15 [ERROR] Unknown/unsupported storage engine: InnoDB
131226 15:36:15 [ERROR] Aborting
131226 15:36:15 [Note] mysqld: Shutdown complete
So it seemed to be an access problem, so I checked the /var/lib/mysql directory
root@debian7:~# stat /var/lib/mysql
File: `/var/lib/mysql'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fe00h/65024d Inode: 391599 Links: 6
Access: (0700/drwx------) Uid: ( 104/ mysql) Gid: ( 106/ mysql)
Access: 2013-12-10 15:58:56.401341180 -0500
Modify: 2013-12-10 15:58:56.241341172 -0500
Change: 2013-12-10 15:58:56.241341172 -0500
Birth: -
As you can see, mysql is the owner and has rwx access..
The logs are somehow empty so I can't figure out what happened. I'm not familiar with troubleshooting these kinds of things though. So I could be making novice mistakes.
I'm just trying to get my wordpress site back and it seems the database dsiconnected on its own and the server wont restart. Any ideas?
More:
My /etc/mysql/my.cnf file contains these relevant lines:
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
bind-address = 127.0.0.1
Solution
Okay, after troubleshooting a while, it turned out that the entire file system is read-only. I tried making new files and in each case it says it can't cause "Read-only filesystem"
It seems to be a bad image or some sort of change my VPS provider made. So I'll be contacting them.
Answered By - Leifingson