I made a mistake yesterday. I tried to increase the volume of existing micro t2 instance by detaching the old volume and attaching a new volume. However, I didn’t pay attention to snapshot and now my website is down because “failed to establish connection with database”
150929 09:41:52 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
150929 9:41:52 [Note] Plugin 'InnoDB' is disabled.
150929 9:41:52 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
150929 9:41:52 [Note] - '0.0.0.0' resolves to '0.0.0.0';
150929 9:41:52 [Note] Server socket created on IP: '0.0.0.0'.
150929 9:41:52 [Note] Event Scheduler: Loaded 0 events
150929 9:41:52 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.5.42-log' socket: '/tmp/mysql.sock' port: 3306 Source distribution
150929 9:41:53 [Note] /usr/local/mysql/bin/mysqld: Normal shutdown
150929 9:41:53 [Note] Event Scheduler: Purging the queue. 0 events
150929 9:41:53 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
When I tried to stop mysql , I got following :
Stoping LNMP...
Stoping nginx... done
* MySQL server PID file could not be found!
Gracefully shutting down php-fpm done
Starting LNMP...
Starting nginx... done
Starting MySQL
. * The server quit without updating PID file (/var/run/mysqld/mysqld.pid).
Starting php-fpm done
Hope someone could help me.
It looks like your database was on that volume.
Check if you have automatically created snapshots (EC2 – Snapshots on the right).
If you have it then:
Now “stop” the instance (don’t terminate!), once stopped – detach the current volume and attache the one you created from the snapshot.
Start the instance and check if it works now.
But if you don’t have the snapshots then there is nothing to do – you just need to setup the database from scratch (create the new database, create tables, etc).
And if mysql doesn’t work after stop / start – try to re-install it, it should re-create the data folders which are probably missing now.