- Created 2 ec2 instances i.e mysql client and mysql server
- MySQL server uses TCP port 3306 by default,so i opened it by creating a new entry in ‘Inbound rules’ in ‘mysql server’ Security Group. For extra security, i did not allow all IP addresses to reach my ‘mysql server’ – I allowed access only to the specific local IP address of my ‘mysql client’.
- Populated the Mobaxterm with the mysql client details
- Populated the Mobaxterm with the mysql server details
- Connected to the mysql client and switched to root
sudo -i
- Connected to the mysql server and switched to root
sudo -i
- update the apt peckage on the mysql server
apt update -y
- Install MySQL Server Software on the mysql server
apt install mysql-server
- Enable mysql on the mysql server
systemctl enable mysql
- Secured mysql server
-
Connecting into mysql
mysql
- Created User and Database within the mysql-server
# Created User
CREATE USER `remote_user`@`%` IDENTIFIED WITH mysql_native_password BY `password`;
# Created database
CREATE DATABASE test_db;
# Grant privileges
GRANT ALL ON test_db* TO `remote_user`@`%`WITH GRANT OPTION;
- configure MySQL server to allow connections from remote hosts.
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
- Replace ‘127.0.0.1’ to ‘0.0.0.0’
- Restart mysql
- update the apt peckage on the mysql client
apt update -y
- On mysql client Linux Server install MySQL Client software
apt install mysql-client
- From mysql client Linux Server connect remotely to mysql server Database Engine without using SSH
mysql -u remote_user -h 172.31.24.218 -p
- Checking that i have successfully connected to a remote MySQL server and i can perform SQL queries:
show databases;
- I have deployed a fully functional MySQL Client-Server