Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Pre-Lab 2 Assignment Objectives: to install and start using MySQL on your computer This is an individual lab. Each student has to complete all work
Pre-Lab 2 Assignment Objectives: to install and start using MySQL on your computer
This is an individual lab. Each student has to complete all work required in the lab, and submit all required materials exactly as specified in this assignment. We will use MySQL throughout the course.
MySQL is a client-server application, even if the client and server are running on the same machine. When you run a MySQL session, you are actually interacting with a client
program MySQL on your local lab machine, which then sends commands and retrieves data from the MySQL server (started automatically at system start-up or by invoking MySQL from the shell prompt). Your MySQL sessions will involve simple scrolling text only. You may use a GUI if you want, but it is not required, and I won't be able to answer GUI-related questions.
Tasks
In this lab, you will have to install MySQL on your computer and then write SQL commands.
1. Install and configure MySQL as specified in Lab 2 manual if you have not already installed it on your computer.
2. Startup MySQL client and login as a root user(admin rights)
3. Type the following commands:
SHOW DATABASES;
The above SQL command lists all databases on the MySQL server host. SHOW SCHEMAS is a synonym for SHOW DATABASES. Words given in all capitals are reserved words in SQL. Reserved words are case-insensitive, so you can enter them all lowercase if you want.
If you forgot to add the semicolon at the end of a SQL statement, just type the semicolon at the prompt in the next line and hit enter.
CREATE DATABASE yourLastName;
The above SQL command creates a new database with your last name.
o Example:CREATEDATABASEtsay;
o Substituting tasy with your own last name
If the database already exists, it will return an error message saying cant create database yourLastName; database exists.
SHOW DATABASES;
USE
The database with your last name is included in the list of the available databases.
YourLastName
;
The above statement tells the database server to select yourLastName database as the default database.
o Example: USE tsay;
If the database name is misspelled or not existed yet, it will return an error message saying Unknown database yourLastName.
SHOW TABLES
;
The above statement lists all available tables in the current database. Since we did not create any table yet, it will return a message saying
Empty set.
4. Take a screenshot of your MySQL clients that show all of the above commands. It should look like the following figure.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started