In this guide, we are going to briefly cover how to install the latest version of MySQL Server on your Ubuntu 18.04 / 19.04 VPS.
To begin with, we are going to update and upgrade out system, this guide is based off a freshly configured VPS. If you are installing on an existing system, you may want to drop the -y flag from the command and inspect the upgrades before they are installed.
( Note that you need to use sudo if you are not logged in as root. We recommend that you follow this guide to learn how to create a sudo capable user other than root for security purposes https://help.skysilk.com/support/solutions/articles/9000126208-how-to-create-new-users-and-grant-sudo-privileges-to-users-on-linux )
sudo apt update && sudo apt upgrade
Once that finishes, we can move forward with installing the default mysql-server package.
sudo apt install mysql-server -y
This may take a little while depending on your system's resources. The next thing to do is use the mysql_secure_installation to remove the default information and setup our root mysql user.
You will now be prompted with some basic setup questions, the default choices are pretty much the commonly accepted answer. Feel free to customize your choices based on your needs. Once you complete this setup, you have installed MySQL.
Test by doing:
For more in-depth information regarding MySQL security be sure to check out the official documentation --> https://dev.mysql.com/doc/refman/8.0/en/security.html