<\/span><\/h2>\n\n\n\nAs always, first log in to your VPS via SSH:<\/p>\n\n\n\n
ssh user@hostname<\/code><\/pre>\n\n\n\nOnce you are in, run the following commands to update the package index and upgrade all the installed packages to the latest available version.<\/p>\n\n\n\n
sudo apt-get update\nsudo apt-get upgrade<\/code><\/pre>\n\n\n\n<\/span>Step 2: Installing MySQL<\/span><\/h2>\n\n\n\nYou can simply start the MySQL installation with the command:<\/p>\n\n\n\n
sudo apt-get install mysql-server<\/code><\/pre>\n\n\n\nTo verify if the installation has been successful and if MySQL is running on your server, you can execute the following command:<\/p>\n\n\n\n
sudo systemctl status mysql<\/pre>\n\n\n\nWe will configure MySQL and enhance its security with the mysql_secure_installation script.<\/p>\n\n\n\n
<\/span> Step 3: Configuring MySQL <\/span><\/h2>\n\n\n\nTo run the security script, execute this command on your terminal:<\/p>\n\n\n\n
sudo mysql_secure_installation<\/code><\/pre>\n\n\n\nThis will start the script which will prompt a series of questions to configure the MySQL passwords and security on that instance.<\/p>\n\n\n\n
The first prompt is about the Validate Password Componen<\/strong>t, which we will install to ensure that all MySQL users follow the policy for complex passwords.<\/p>\n\n\n\nVALIDATE PASSWORD COMPONENT can be used to test passwords\nand improve security. It checks the strength of password\nand allows the users to set only those passwords which are\nsecure enough. Would you like to setup VALIDATE PASSWORD component?\n\nPress y|Y for Yes, any other key for No: Y<\/code><\/pre>\n\n\n\nThe next prompt will ask for the policy level that you would like to use. You can choose the level of policy you like to use, for the purpose of this tutorial we will choose option “1”. Which means the password must consist of numeric, mixed case, and special characters and the password length must be equal or greater than 8.<\/p>\n\n\n\n
There are three levels of password validation policy:\n\nLOW Length >= 8\nMEDIUM Length >= 8, numeric, mixed case, and special characters\nSTRONG Length >= 8, numeric, mixed case, special characters and dictionary file\n\nPlease enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1\n1<\/code><\/pre>\n\n\n\nAfter choosing the policy level, you can now set your new root password:<\/p>\n\n\n\n
Please set the password for root here.\n\n\nNew password: \n\nRe-enter new password:<\/code><\/pre>\n\n\n\nInsert ‘Y’ in the following prompts in order to finish the installation:<\/p>\n\n\n\n
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y\n\nRemove anonymous users? (Press y|Y for Yes, any other key for No) : Y\n\nDisallow root login remotely? (Press y|Y for Yes, any other key for No) : Y\n\nRemove test database and access to it? (Press y|Y for Yes, any other key for No) : Y\n\nReload privilege tables now? (Press y|Y for Yes, any other key for No) : Y<\/code><\/pre>\n\n\n\n