Project 5
The project started with the creation of 2 Linux instance on AWS: mysql server and mysql client. See the snapshot of the two instances here.
Next is the installation of MySQL Server as shown below: On the MySQL Server Instance, run the following set of commands to install the MySQL server package -
sudo apt update
sudo apt install mysql-serverAfter the server installation, the MySQL service is started using the comand below:
sudo systemctl start mysql.serviceServer Status shown here.
Following the server installation is the running of DBMS security script to change the default security settings:
sudo mysql_secure_installationThe root account password was changed from default and confirmed with the new password.
mysql -u root -pThe mySQL server was connected using the root as shown here.
Another user was created on the MySQLserver using the command below after connecing as root:
CREATE USER 'lekan'@'localhost' IDENTIFIED BY 'password';Note the 'password' indicated was changed to a strong password to comply with the password policy.
Test the mysql instance using the new user:
sudo mysqladmin -p -u lekan versionNext is the Installation of the client using the command below on the mysql client instance:
sudo apt install mysql-client -yCheck the client version to verify if the installation was successful:
mysql -VIn order to connect to the MYSQL Server instance, port 3306 was opened on the EC2 instance security group:
Next the server is edited to allow connection from remote host by changing the config file as follow:
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnfIn addition to the above, the database user must be allowed to connect to the host server by running the following commands on the MYSQL Server:
sudo mysql -u root -pGRANT ALL PRIVILEGES ON *.* to 'lekan'@'172.31.27.181';
FLUSH PRIVILEGES;And the host allowed for the user is confirmed by:
SELECT host FROM mysql.user WHERE user = "lekan";The connection is now tested from the client to the server using the mysql utility as follow:
mysql -u lekan -p -h 172.31.27.181