Please be aware that this is an old post, more than one year old, so you might need to look for an updated version of this article either on this site or using your favourite search engine.
TBH, installing mysql does not need that much of work, but it will not work if you try to install it on a small VPS (512MB) so I will let you know what to do.
To be able to use mysql on a small VPS you will need to create a swap for it, you are free to use the following script, which I have created.
Its not 100% perfect, but it worked
create a shell file and call it swap.sh
!/bin/bash SWAPFILENAME=/swapfile echo "create the swapfile dev" sudo dd if=/dev/zero of=$SWAPFILENAME bs=1024 count=524288 echo "make swap for $SWAPFILENAME" sudo mkswap $SWAPFILENAME echo "changing the permission for $SWAPFILENAME" sudo chown root:root $SWAPFILENAME sudo chmod 0600 $SWAPFILENAME echo "Turn the swapon for $SWAPFILENAME" sudo swapon $SWAPFILENAME echo "now you should add the following line to your /etc/fstab, you will need to do that as root" echo "$SWAPFILENAME swap swap defaults 0 0" echo "sudo nano /etc/fstab"
execute the command
sudo sh swap.sh
and then remember to edit fastab file to add the swap to it and you are done.
You can install it like any other linux package using APT package manager .
apt-get install -y mysql-server-5.6
after the script finish, you can try to secure it by executing the following command
to access mysql from the command line
mysql -u root -p
and that's it.