Share
Explore

Student Lab Workbook: Installing MySQL Server and Workbench for Mac OS

Student Lab Workbook: Installing MySQL Server and Workbench

This workbook will step you through the process of installing MySQL Server and Workbench on macOS and running simple SQL commands to create and populate databases and tables.
Note: The installation process may require administrative rights on your system.

Section 1: Installing MySQL Server on macOS

Download MySQL Server: Go to the and select the proper version for Mac OS. Click on "Download."
Start Installation: Once downloaded, open the installer. You might be prompted for your admin password.
** Type**: Select your setup type (For most, the standard setup type will work). Click "Next."
Beginning Installation: Check the installation settings and click on "Install.”
Root Password Setup: During the installation process, you will be asked to set a root password. Make sure to remember this as it is required to log into your MySQL Server.
Finish Installation: The installation should proceed and finish installing MySQL server on your system. Click on "Finish" when done.

Section 2: Installing MySQL Workbench on macOS

Download MySQL Workbench: Go to the and select the proper version for Mac OS. Click on "Download."
Start Installation: Once downloaded, open the installer. You will be asked to drag the MySQL Workbench icon into Applications folder.
Finish Installation: Workbench should now be available in your Applications folder.

Section 3: Connect to MySQL Server through MySQL Workbench

Open MySQL Workbench: Open MySQL Workbench from the Applications folder.
Add Connection: Click on the '+' next to "MySQL Connections" to add a new connection. Give it a name (such as "Local instance") and keep the rest as default. Enter the password you set during MySQL Server installation for the password field.
Test Connection: Click on "Test Connection" to ensure everything is setup correctly.

Section 4: Create and Populate a Database

Now that you have MySQL Workbench connected to your server, here's how you create a database and tables and populate them:
Create a Database
CREATE DATABASE studentDB;
Select the Database
USE studentDB;
Create a Table
CREATE TABLE students (
student_id INT AUTO_INCREMENT,
first_name VARCHAR(40) NOT NULL,
last_name VARCHAR(40) NOT NULL,
email VARCHAR(60) DEFAULT NULL,
PRIMARY KEY (student_id)
Insert Data into
INSERT INTO students (first_name, last_name, email)
VALUES
('John', 'Doe', 'john.doe@example.com'),
('Jane', 'Doe', 'jane.doe@example.com');
View the Data in the Table
SELECT * FROM students;
You have now successfully installed MySQL Server and workbench, connected them, and run some simple SQL commands to create and populate a database. Be sure to continue practicing your SQL commands and experimenting with more complex database setups.
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.