Accessing relational database using Windows and Linux machine.
- theblackthreat
- Sep 1, 2021
- 3 min read
1 st Connecting the Relational Database using Linux Machine.
First we will creating a RDs database from Storage---> RDS.
Steps to follow.
A) Create a MySQL DB instance:
We will use Amazon RDS to create a MySQL DB Instance with db.t2.micro DB instance class, 20 GB
of storage, and automated backups enabled with a retention period of one day
a) On the top right corner of the Amazon RDS console, select the Region in which you want to create
the DB instance.
b) In the Create database section, choose Create database.
c) You now have options to select your engine. For this tutorial, click the MySQL icon, leave the
default value of edition and engine version, and select the Free Tier template.
d) You will now configure your DB instance. The list below
shows the example settings you can use for this tutorial:
e) Settings: DB instance identifier: Type a name for the DB instance that is unique for your account in
the Region that you selected.
Master username: Type a username that you will use to log in to your DB instance.Master password:
Type a password that contains from 8 to 41 printable ASCII characters (excluding /,", and @) for your
master user password.
Confirm password: Retype your password
f) Instance specifications: DB instance class: Select db.t2.micro --- 1vCPU, 1 GIB RAM. Storage type:
Select General Purpose (SSD). Allocated storage: Select the default of 20 to allocate 20 GB of
storage for your database.
Enable storage autoscaling: If your workload is cyclical or unpredictable, you would enable storage
autoscaling to enable RDS to automatically scale up your storage when
needed.
g) Connectivity
Virtual Private Cloud (VPC): Select Default VPC. For more information about VPC
h) Database options
Database name: Type a database name that is 1 to 64 alpha- numeric characters. If you do not provide a name, Amazon RDS will not automatically create a database on the DB instance you are creating. DB parameter group: Leave the default value. For more information, see Working with DB Parameter Groups.Option group: Leave the default value. Amazon
RDS uses option groups to enable and configure additional features. For more information, see
Working with Option Groups.

Now Step 2:
Create EC2 Linux Instances. go to first experiment. and Connect it.


Step 4: now to connect the database we need to create a local server on linux use following cmds to
create server.

Note: if not connect then go throug the default security group and then edit inbound rule
All trafic--->all TCP ---ip(anywhere). then save it
after some time it will be connected.
Step 5: Install mysql server and update the instance
$ sudo apt update
$ sudo apt install mysql-server
Step 5: Now create databse that will conects to the RDS DB instance.
mysql> create db student
mysql> use student;
mysql> create table student_class(
-> Name VARCHAR(20) NOT NULL,
-> TITLE VARCHAR(10) NOT NULL,
-> PRIMARY KEY (TITLE));
Query OK, 0 rows affected (0.03 sec)
mysql> SHOW TABLE student_class;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'student_class' at line 1
mysql> describe student_class;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| Name | varchar(20) | NO | | NULL | |
| TITLE | varchar(10) | NO| PRI | NULL | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)2 rows in set (0.00 sec)

to check that all things is good go to RDS database now click on monitering

we can see that all data traffic is working when we created a database on terminal.
Now we have done this to connecting with linux Instance with RDS DB instance.
Comments