View video tutorial

MySQL and Workbench

MySQL

MySQL Workbench is a popular tool among MySQL database developers and engineer

MySQL Workbench


➔ MySQL Workbench is a visual tool for MySQL databases that database developers, database designers, and database architects can use to create databases in MySQL.

How to install HR schema on MySQL for learning.


➔ The HR schema is a popular sample relational database design for generic human resources departments, and is commonly used for learning and parcticing SQL queries.

➔ After learning, analyzing, and testing SQL queries here, one can create and design databases, tables, and queries.

➔ The HR schema is provided by Oracle Database for the purpose of learning and demonstrating SQL structure, design, and queries.

Install HR schema in MySQL using workbench

Download the hr-schema-mysql.sql file.

01 Open workbench and select hr-schema-mysql.sql file.

Open sql script in workbench

02 Select sql script to open in workbench.

Select sql script to open in workbench

03 Execute all script and refresh Mysql Databases.

Execute all script and refresh Mysql Databases

04 Query HR databases tables.

Query HR Databases tables

How to install Northwind database on MySQL for learning.


➔ The Northwind database is a popular sample relational database design for a generic trading company called "Northwind Traders" that does import-export business around the world.

➔ This sample database is commonly used for learning, understanding, and analyzing SQL queries.

➔ After learning, analyzing, and testing SQL queries in this tutoril, one can create and design databases, tables, and queries.

➔ The Northwind database is provided by Microsoft for the purpose of learning and demonstrating SQL structure, design, and queries.

Install Northwind database in MySQL using workbench

Download the northwind-mysql.sql file.

01 Open workbench and select northwind-mysql.sql file.

Open sql script in workbench

02 Select sql script to open in workbench.

Select sql script to open in workbench

03 Execute all script and refresh Mysql Databases.

Execute all script and refresh Mysql Databases

04 Refresh schema palate to see the northwind databases and tables.

Query HR Databases tables

Access MySQL from command line:

Syntax
cd C:\Program Files\MySQL\MySQL Server 8.0\bin

/* user: root, password: rootpassword for example mysql123 */
/* mysql -h localhost -P 3306 -u root -p  */
/* mysql -h localhost -P 3306 -u root -p  */

mysql -u root -p

show databases;
use hr;
show tables;

Find the path to the bin directory of the MySQL installation.

If the command is not recognized, go to the bin folder. For Windows, this is usually C:\Program Files\MySQL\MySQL Server 8.0\bin

mysql installation path

Get the mysql installation path from the services window (alternative method).

get mysql installation path from service window

Copy mysql installation path C:\Program Files\MySQL\MySQL Server 8.0\bin from service window

copy mysql installation path from service window

Change directory (cd) to C:\Program Files\MySQL\MySQL Server 8.0\bin and Login to MySQL from command line

login to mysql from command line

Execute query in mysql from command line

execute query in mysql from command line