sudo apt install mysql-server
Login to MySQL and create a new user with the following command
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
change newuser and password with your desired username and password
GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost';
again, change the newuser with the user specified in the previous step.
Grant ALL PRIVILEGES ON *.* TO 'newuser'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
Now you need to edit the mysql config file to allow connection to the MySQL server. Open the config file using the below command.
cd /etc/mysql/mysql.conf.d/
sudo nano mysqld.cnf
comment out the line below from the mysqld.cnf file with '#' symbol and save the file.
bind-address = 127.0.0.1
sudo service mysql restart