Overview

This guide contains instructions on how to install and do basic configuration of a MySQL database. At the time of this writing, the stable version is 5.7.

 

Prerequisites

  • Operating System: Ubuntu 18.04
  • Access to a Terminal or Shell Console (Need proper and consistent term for this)

 

Installation via Package Manager

01. Open a terminal window

 

02. Update the package repository and install MySQL. This will install the latest and most stable version of the database.

$ sudo apt update

$ sudo apt install mysql-server -y

 

03. Verify the MySQL has been installed

$ mysql --version

 

Securing the MySQL

Securing the MySQL database is a recommended step.

01. Run MySQL secure installation. Then type y or Y when asked to confirm execution.

$ sudo /usr/bin/mysql_secure_installation

 

02. Enter 2 option for a STRONG password

 

03. Choose a strong password with the following criteria

  • Minimum length : 8
  • Has a number [0-9]
  • Has a lower case character [a-z]
  • Has an upper case character [A-Z]
  • Has a special character (e.g. @, $, %, etc.)

A sample password that satisfy the criteria : [email protected] You can use this tool to generate a strong password: https://bartday.com/password_generator.html

 

04. Enter the password then confirm by entering y

 

05. Remove the anonymous user by entering y. It is advisable to remove the anonymous user.

By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

 

06. Disallow root login remotely. This is a security concern, if you don’t want the root user to be accessible remotely. Enter y.

 

07. Remove the test database, enter y.

By default, MySQL comes with a database named ‘test’ that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

 

08. Enter y to reload the privilege tables.

 

09. Test the MySQL config, by login using the root account.

$ sudo mysql -u root -p

# Enter the root password

Previous Google Cloud Next 2019 | Things I Wish I Knew Before Building Serverless ML Solutions
Next Google Cloud Next 2019 | Beyond Your Bill: Getting More Detail On Cost