Installing MySQL
Setting up Users and Databases
Start MySQL as Admin
sudo mysql -u root -p
Setting up Databases
CREATE DATABASE cliftonDB;
SHOW DATABASES;Setting up Users
SELECT user FROM mysql.user; --shows all users
CREATE USER 'clifton'@'localhost' IDENTIFIED BY 'password'; --local user
CREATE USER 'clifton'@'191.132.11.123' IDENTIFIED BY 'password'; --user at ONE IP
CREATE USER 'clifton'@'%' IDENTIFIED BY 'password'; --user at any IPGrant Database Permissions for Users
GRANT ALL ON cliftonDB.* TO clifton@'%';Enabling Remote Access
Note: remote access should not be enabled for client applications to connect (this should be done via HTTP requests and a webserver). Port 3306 should be closed and admins should rather use SSH.
Edit MySQL Config
sudo nvim /etc/mysql/mysql.conf.d/mysql.cnf
Change bind address to a specific IP or to 0.0.0.0 for any IP.
Open up the Firewall Port
sudo ufw allow from 191.322.3.123 to any port 3306 --for a specific IP
sudo ufw allow 3306/tcp --for all IPs
https://www.digitalocean.com/community/tutorials/how-to-allow-remote-access-to-mysql