Sunday, August 07, 2016

This assumes that you already have a running Ubuntu server with Apache installed. To install basic security in Ubuntu, see Basic Security Installs for Ubuntu. This instructions was extracted from here.

1. Update the package index on your server

sudo apt-get update

2. Install the package

sudo apt-get install mysql-server

3. Run the included security script. This changes some of the less secure default options for things like remote root logins and sample users.

sudo mysql_secure_installation

4. If you're using a version of MySQL earlier than 5.7.6, you should initialize the data directory by running command below.