This Project involed setting up a MySQL-server and MySQL-client and configuring them to connect to each other remotely.
1. The first step was to set up two virtual machines using AWS, one for the db-server and one for the db-client.
ssh -i "privatekey.pem" ubuntu@ec2<pub-ip>.compute-1.amazonaws.com
# For Server
sudo apt update
sudo apt upgrade -y
sudo apt install mysql-server
# For Client
sudo apt update
sudo apt upgrade -y
sudo apt install mysql-client
Sudo systemctl status mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Password.1';
sudo mysql_secure_installation
sudo mysql -p
CREATE USER 'username'@'%' IDENTIFIED WITH mysql_native_password BY 'Password.1';
CREATE DATABASE cybrox_db;
GRANT ALL ON cybrox_db.* TO '<username>'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
sudo systemctl restart mysql
ip addr show
14. Next i opened port 3306 in db-server security group and added private ip of mysql-server to its inbound rules
sudo mysql -u teejay -h <private ip of dbserver> -p