Let’s create a Schema in your MySQL Workbench on Mac OS.
Welcome to a quick and user-friendly guide to generating your first schema in MySQL.
By the end of this blog, you will understand how to generate a MySQL schema.
A schema is necessary for importing CSV files or JSON files because our end objective is uploading CSVs and performing custom SQL, and pushing that content into Tableau Desktop.
Our following blogs will help you with importing a CSV into MySQL on your Mac OS.
If you don’t currently have MySQL on your Mac OS – follow our other tutorial on how to install MySQL on your Mac.
You’re creating a schema – not a database!
Firstly we are going to want to understand the verbiage used in the product and the difference between database and schemas.
After you’ve downloaded MySQL workbench – we will want to begin bringing in data for Tableau consumption.
MySQL has Schemas in the database!
I’m sure you’re familiar with what a database is, if not, here’s the definition.
A database is a structured set of data held in a computer, especially one that is accessible in various ways.
In the MySQL – you can build multiple ‘folders’ in your database, called schemas.
Schema VS Database
A database is your primary container; it contains the data and log files, and all the schemas within it.
You always back up a database; it is a discrete unit on its own.
Schemas are like folders within a database and are mainly used to group logical objects together, which leads to ease of setting permissions by the schema.
Creating a Schema in MySQL Mac OS
Let’s talk about the point and click methods first.
When you have your workbench open – you’ll notice a place on the bottom left labeled “SCHEMAS,” and that’s where we want to click right to build a new Test Database!
Setting up your MySQL Schema on your Mac
Let’s start setting up your MySQL Schema.
Name your MySQL schema “Test_Schema1.”
Use UTF-8 for your collation.
What is UTF-8 Collation?
From Wikipedia, the free encyclopedia
The name is derived from Unicode (or Universal Coded Character Set) Transformation Format – 8-bit.
We will use UTF-8 for this schema.
Click apply – which is on the bottom right of the screen.
Wrapping up your schema build in Mac OS MySQL Workbench
Let’s wrap up your schema creation in MySQL.
If you’ve followed along you will see this window.
This leads us to our next topic.
Using SQL – instead of the GUI!
Using SQL to generate a Schema in your Mac OS on MySQL Workbench
Using SQL is an alternative to the clicks we just gained your first schema. Woot!
Most GUI steps on MySQL will uncover SQL that you’ve generated VIA using a built-in wizard.
The native features in MySQL offer a glimpse into creating your first schema.
CREATE SCHEMA `Test_Schema1` DEFAULT CHARACTER SET utf8 ;
You can copy and paste this code into a query on MySQL.
If you have MySQL Workbench open, you have a query open!
Paste your code and build Test_Schema2.
Now you should have two SCHEMAS – be sure to click the refresh button, and both will be present.
It will look like this screenshot below.
Get used to clicking the refresh button on MySQL Workbench and all other database GUI interfaces.
You’re making changes to something living and breathing on your computer, and right now – you have a database on your computer. Congratulations!
Again, the refresh is a normal process, don’t worry if you don’t see your work – especially if you’ve not refreshed your GUI interface, also known as your MySQL Workbench!
Did you expect it would be this easy to create a Schema in your MySQL Workbench on Mac OS?