How to Install MySQL on Mac | Install MySQL on macOS

Опубликовано: 01 Май 2026
на канале: Java Fever
48
1

1) to clear the terminal
clear

2)To know all the files available in your current directory
ls -al

3)To create zshrc file
touch .zshrc

4) To open file
open .zshrc

5) Copy below line of in .zshrc file with proper java version

export PATH=${PATH}:/usr/local/mysql-8.0.42-macos15-arm64

6) save file
cmd+save

7) source the file , it will recognised by system
source .zshrc

8) to login
mysql -u root -p

9) show database
show databases;

10) create database
create database demo;

11) use demo;

12) create table
CREATE TABLE employees (
id INT AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
hire_date DATE,
salary DECIMAL(10, 2)
);

13) insert data

INSERT INTO employees (first_name, last_name, email, hire_date, salary) VALUES
('John', 'Doe', '[email protected]', '2023-01-15', 55000.00),
('Jane', 'Smith', '[email protected]', '2024-04-01', 62000.00);