Changes

Jump to: navigation, search

OPS705 Lab 8 (2207)

7,789 bytes added, 03:26, 1 December 2020
Created page with "= LAB PREPARATION = === Purpose / Objectives of Lab 8 === In this lab, you will learn how to modify the MySQL database created in Lab 7 to add a new user with the wordpress '..."
= LAB PREPARATION =

=== Purpose / Objectives of Lab 8 ===
In this lab, you will learn how to modify the MySQL database created in Lab 7 to add a new user with the wordpress ''Author'' permission. You will also create a new RDS MySQL database from scratch using the same setup at the first database.

While you are working through this lab, it is highly recommended that you write down general notes and commands to help you remember how to do this lab. You may use your notes during tests, so fill it out accordingly!

If you encounter technical issues, please contact your professor via e-mail or in your section's Microsoft Teams group.

=== Minimum Requirements ===
Before beginning, you must have:
# Working knowledge of databases and MySQL commands
# Successfully completed [[OPS705_Lab_7 | Lab 7]]
# Watched the Week 8 video lecture
# Read through the Week 8 slides, and have them handy as a reference for concepts
# Your AWS Educate login credentials

= INVESTIGATION 1: Modifying the RDS MySQL Database from Lab 7 =
In this investigation, you'll modify the database created for your Wordpress installation from Lab 7 to add a new user to the blog.

== Part 1: Finding the Database ==
# Login to the AWS Console. Under ''Services'', click on '''Elastic Beanstalk'''.
# Under ''Environments'', click your Wordpress environment name.
# In the left-hand menu, click on '''Configuration'''.
# Scroll down to ''Database'', make note of the database name in the endpoint link (the first part), then click the link.
# In the new RDS screen, you should see a database with the same name. Click it.
# You now see information about the database you created.
# This page includes information you'll need to connect to it and run MySQL queries. However, you can't connect to it under its current settings. Part 2 will show you how to set up access.

== Part 2: Modifying the VPC Security Group ==
# On the main information page of the database from Part 1, find the ''Security'' header section.
# Underneath, there's a single entry for ''VPC security groups''. Click it.
# In the new ''Security Groups'' page, click the only listed entry.
# Now, click the '''Edit inbound rules''' button.
# Click the '''Add rule''' button.
# For the new rule, use the following settings:
#* '''Type:''' MYSQL/Aurora
#* '''Protocol:''' Leave defaults
#* '''Port range:''' Leave defaults
#* '''Source:''' My IP
#* '''Description:''' Leave blank
# Click on '''Save rules''' to apply your settings.

== Part 3: Connecting to the Database ==
# From the AWS Console, select the '''RDS''' service.
# Navigate to your database.
# Using your favourite MySQL database client (GUI or CLI) and the information from the database information page, connect to your database. Use the following as a template, but supply your own information.
#* '''Host:''' something.us-east-1.rds.amazonaws.com (The database endpoint from the info page.)
#* '''Port:''' 3306
#* '''Username:''' admin
#* '''Password:''' Saved password from Lab 7

== Part 4: Adding a Secondary Author User To Your Blog ==
# Once logged in to the MySQL server, navigate to the '''ebdb''' database.
# List all tables to get an idea what's here.
# Let's take a look at the '''wp_users''' table description and current entries.
# If using the CLI, enter the following commands:
#* <code>DESCRIBE wp_users;</code>
#* <code>SELECT * FROM wp_users;</code>
# Take a look at the '''wp_usermeta''' table. We'll be using both.
# Add a new user with the following command ('''but supply your own username, password, e-mail, blog URL, and current date!'''): <code>INSERT INTO wp_users (ID, user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_status, display_name) VALUES (2, 'cjohnson31', MD5('apassword'), 'cjohnson31', 'cjohnson31@myseneca.ca', 'http://wordpress-env.eba-mukvj5kp.us-east-1.elasticbeanstalk.com', '2020-12-01 03:47:00', 0, 'cjohnson31');</code>
# List your '''wp_users''' table entries again to verify your work.
# Give your new user the ''Author'' role with the following command: <code>INSERT INTO wp_usermeta (umeta_id, user_id, meta_key, meta_value) VALUES (NULL, '2', 'wp_capabilities', 'a:1:{s:6:"author";s:1:"1";}');</code>
# Once complete, load your blog and login as your new user. You should be able to login as the new user and make a blog entry.
# Make a blog entry as this new user. In the entry, paste all the (modified) MySQL commands you used and publish the entry.
# Back in the MySQL server, create a third user with the following ''exact'' commands (but use your blog URL):
#* <code>INSERT INTO wp_users (ID, user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_status, display_name) VALUES (3, 'chris.johnson', '$P$BpUviJtx.VK1cZHEwIFZQKJMlq3One0', 'chris.johnson', 'chris.johnson@senecacollege.ca', 'http://yourblog.us-east-1.elasticbeanstalk.com', '2020-12-01 03:47:00', 0, 'Prof. Chris Johnson');</code>
#* <code>INSERT INTO wp_usermeta (umeta_id, user_id, meta_key, meta_value) VALUES (NULL, '3', 'wp_capabilities', 'a:1:{s:6:"author";s:1:"1";}');</code>
# You're done Investigation 1!

= INVESTIGATION 2: Create A Second Database Instance =
In this investigation, you will create a new MySQL instance in AWS RDS, and create the same tables and parameters as the ''ebdb'' database from Investigation 1.

== Part 1: Create A Second MySQL Instance ==
# Navigate to the RDS service in AWS.
# Click on the ''Databases'' link in the left-hand menu bar.
# On the new page, click the '''Create database''' link button.
# In the new window, use the following settings (leave all others on defaults):
#* '''Choose a database creation method:''' Standard create
#* '''Engine type:''' MySQL
#* '''Templates:''' Free Tier
#* '''DB instance identifier:''' wordpress-db2
#* '''Master username:''' admin
#* '''Master password:''' ''Choose a strong password''
#* '''Confirm password:''' ''Same as above''
#* '''Allocated storage:''' 5 GB
#* '''Enable storage autoscaling:''' Unchecked
#* '''Public access:''' Yes
#* '''New VPC security group name:''' lab8
#* '''VPC security group:''' Create new
#* (Under ''Additional configuration'') '''Initial database name''': ebdb
#* '''Enable automatic backups''': Unchecked
# Create the database.
# Once complete, add a second ''Inbound rule'' entry to your new security group (''lab8'') as you did in Investigation 1, Part 2.

== Part 2: Recreate the ebdb Database ==
This investigation will rely on your previous MySQL knowledge. Using the ''ebdb'' database from the '''first''' database instance as a template, create the necessary tables and table structure in the ''ebdb'' database in your '''second''' database instance (i.e. ''wordpress-db2''). It is advisable to connect to both database instances to compare as you create the second set of tables in the new instance.

= Lab Submission =
Submit to Blackboard's ''Lab Submission'' section '''full-desktop screenshots''' (PNG/JPG) of the following:
# List of table entries in ''wp_users'' from Investigation 1 showing all three users. (CLI or GUI)
# Logged in as your first user, a view of the ''Users'' page on your Wordpress blog showing all three users.
# The new blog entry from your second user.
# The RDS database info page for the database from Investigation 1.
# The RDS database info page for the second database created in Investigation 2.
# The new tables for the second database described. (CLI or GUI)

'''In the ''Comments'' text box for your submission on Blackboard, include the URL of your blog post.'''

Your professor will review your blog directly; the screenshots are a backup in case of catastrophic issues.

Labs aren't marked until screenshots have been submitted.

[[Category:OPS705]]
[[Category:OPS705 Labs]]
[[Category:Digital Classroom]]
[[Category:Fall 2020]]

Navigation menu