Client-Server is an architecture in which two or more computers are connected together over a network to send and receive requests between one another.
- Create and configure two linux based virtual servers (EC2 instances in AWS)
mysql-server
andmysql-client
- Install MySQL on both servers
On mysql server
install MySQL server software
sudo apt-get update
sudo apt-get install mysql-server
On mysql client
install MySQL client software
sudo apt-get update
sudo apt-get install mysql-client
- Confirm that the both servers are runing
sudo systemctl status mysql
-
Use mysql server's local IP address to connect from mysql client. MySQL sever uses TCP PORT 3306 by default. Hence, add a new in Inbound rule in mysql server.
-
Configure MySQL server to allow. Replace
127.0.0.1
to0.0.0.0
-
Restart
mysql-server
sudo systemctl restart mysql
- From mysql client Linux Server connect remotely to mysql server Database Engine without using ssh. The mysql utility must be use to perform this action by:
Login to mysql-server
sudo mysql
Create a new user with remote access privileges
CREATE USER '<user-name>'@'<Client-server-ip>' IDENTIFIED WITH mysql_native_password BY '<password>';
Grant privileges to the remote user
GRANT <permissions> ON <database>.* TO 'remote_user'@'client_ip' WITH GRANT OPTION;
After creating the user and granting privileges, flush the privileges to ensure the changes take effect
FLUSH PRIVILEGES;
Exit mysql-server
shell
exit
- Connect to
mysql-server
frommysql-cient
and check that the remote MySQL server is successfully connected.
mysql -u client -p -h <mysql-server-ip>
SHOW DATABASES;
This is a successfull implementation of a Client Server Architecture using MySQL Database Management System System