Automatically start MySQL if apache kills the process or sacrifice children on Ubuntu Server

There are several ways to solve the problem of Apache running wild and killing MySQL. It the problem occurs very¬†infrequently, there’s a easy way of restarting MySQL with the use of the crontab. The script even sends a notification email so you know what just happened.

First, SSH into your server:

Create a script file:

Paste the following:

Press CTRL + O to save, and CTRL + X to exit.

Give execute permission to your script:

Edit the Crontab:

Paste the following:

Press CTRL + O to save, and CTRL + X to exit.

To see if it works, type the following:

In case the service doesn’t start, just start it manually with the following:


MySQL queries and php load time in WordPress

Get number of MySQL queries and php load time of your theme in WordPress, by adding this last in your footer.php-file. Don’t forget to add the constant WP_ENV to your functions.php to make sure it stays in¬†the development environment.


Backup your WordPress database during development with GIT

Save daily backups of your WordPress database to file during development, to store them in GIT alongside with other developers databases.

First, define the environment by adding this to your wp-config.php:

Second, paste this to your functions.php: