How to Install MySQL on Mac | Install MySQL on macOS (2024)

ProgrammingKnowledge
9 Jan 202417:11

Summary

TLDRThis tutorial guides viewers on installing MySQL server on a Mac. It starts with downloading the MySQL Community Server from the official website, selecting the appropriate version for M1/M2 or Intel processors, and installing it via a DMG file. The script covers setting a strong password, choosing encryption options, and starting the server automatically. It also explains configuring the terminal with the MySQL binary path and connecting to the MySQL server using command-line commands. Finally, it demonstrates installing MySQL Workbench, a GUI client, and connecting to the server using it.

Takeaways

  • 🌐 Start by opening a browser and searching for MySQL to download the server for Mac OS.
  • πŸ”— Click on the 'MySQL Community Downloads' link to find the appropriate version for your Mac.
  • πŸ–₯️ Choose the correct version for your Mac's processor, either ARM for M1/M2 chips or x86 for Intel processors.
  • πŸ“₯ Download the DMG file for MySQL Community Server, which is recognized automatically by your Mac's OS.
  • πŸ“¦ Click on the PKG file to begin the installation process after downloading.
  • πŸ” During installation, agree to the license terms and choose the installation type, typically standard.
  • πŸ”‘ Set a strong password for MySQL and decide whether to start the server after installation.
  • πŸ› οΈ After installation, you can check the status of MySQL in your system settings and adjust configurations if needed.
  • πŸ—οΈ Connect to MySQL server via the terminal by setting the path in the .zshrc file and using the MySQL command.
  • πŸ’» Install MySQL Workbench, the GUI client, by downloading the DMG file and dragging it into the Applications folder.
  • πŸ”„ Use MySQL Workbench to connect to your server, view databases, and manage your MySQL instance visually.

Q & A

  • What is the first step to download MySQL server on a Mac?

    -The first step is to open your favorite browser, search for 'MySQL', and click on the first link that appears from mysql.com.

  • Where can you find the MySQL Community downloads on the official website?

    -You can find the MySQL Community downloads by clicking on the 'Downloads' tab on the official MySQL website.

  • Which version of MySQL should you download for a Mac with an M1 or M2 chip?

    -For a Mac with an M1 or M2 chip, you should download the version labeled 'Mac OS 13 arm 64'.

  • How does the website recognize your Mac's operating system and select the appropriate MySQL version?

    -The website automatically recognizes your operating system and selects the latest version of MySQL Community server suitable for your Mac OS.

  • What is the file size of the DMG file for MySQL Community server for Mac OS?

    -The DMG file for MySQL Community server is around 567 megabytes.

  • How do you start the installation process of MySQL on a Mac?

    -You start the installation process by clicking on the PKG file within the DMG file that was downloaded.

  • What is the default installation location for MySQL Community server on a Mac?

    -The default installation location is in the '/usr/local/mysql' directory on the Mac.

  • What is the significance of choosing 'strong password encryption' during MySQL installation?

    -Choosing 'strong password encryption' enhances the security of the MySQL server by using more robust encryption algorithms for password storage.

  • After installation, how can you verify that the MySQL server is running on your Mac?

    -You can verify that the MySQL server is running by checking the system settings or the Apple logo menu, where you should see a new section named 'MySQL' indicating the server's status.

  • How do you connect to the MySQL server using the command line on a Mac?

    -You connect to the MySQL server using the command line by typing 'mysql -u root -p' and then entering the MySQL password when prompted.

  • Why might you encounter a 'zsh command not found' error when trying to connect to MySQL from the terminal?

    -You might encounter a 'zsh command not found' error if the MySQL binary directory is not included in your system's PATH, which can be resolved by adding the directory to the PATH in the .zshrc file.

  • What is the process to create a new database using the MySQL command line interface?

    -To create a new database using the MySQL command line interface, you use the command 'CREATE DATABASE database_name;' where 'database_name' is the name you want to give to the new database.

Outlines

00:00

πŸ’» Installing MySQL Server on Mac

This paragraph provides a step-by-step guide on downloading and installing MySQL server on a Mac operating system. The process begins with opening a browser and navigating to the official MySQL website to download the MySQL Community server. The user is instructed to select the appropriate version for their Mac OS, whether it's for M1/M2 chips or Intel processors. After downloading the DMG file, the user is guided to open it and start the installation by clicking on the PKG file. The installation process includes accepting license terms, choosing installation type and location, setting a strong password for MySQL, and configuring encryption settings. The video script emphasizes the importance of allowing the installer to run a program to check software compatibility and providing the MacBook password when prompted. Upon successful installation, the user is advised to move the installer to the bin and start the MySQL server.

05:00

πŸš€ Verifying MySQL Server Installation and Configuration

The second paragraph explains how to verify the successful installation of MySQL server and configure it for automatic startup. It details how to check the MySQL server status through the system settings and provides options to stop the server or disable its automatic startup. The paragraph also covers the configuration section where the installation paths for MySQL directories are displayed. The user is guided to connect to the MySQL server using the command line but encounters an error due to the MySQL binary directory not being in the system's PATH. To resolve this, the user is instructed to create or edit the .zshrc file in the home directory to include the MySQL bin directory path. The video script provides a command to be added to the .zshrc file and explains how to find the correct path for the MySQL bin directory using Spotlight and Finder.

10:02

πŸ” Configuring MySQL Client and Creating a Database

This paragraph continues the setup process by showing how to configure the MySQL client and create a new database. After ensuring the .zshrc file is updated with the correct MySQL bin directory path, the user is guided to reload the .zshrc file and attempt to connect to the MySQL server again. This time, the user is prompted for the MySQL password set during installation. Upon successful login, the user can execute commands like 'show databases' to view existing databases or 'create database' to create a new one. The paragraph demonstrates the creation of a 'demo' database and verifies its existence with the 'show databases' command.

15:05

πŸ–₯️ Installing MySQL Workbench on Mac

The final paragraph of the script focuses on installing MySQL Workbench, a graphical user interface client for MySQL server, on a Mac. The user is instructed to download MySQL Workbench from the official MySQL website, choosing the appropriate version for their Mac's processor type. After downloading the DMG file, the user simply drags the MySQL Workbench icon into the Applications folder to install it. The paragraph concludes with a demonstration of connecting to the MySQL server using MySQL Workbench, entering the server password, and executing a 'show databases' command to confirm the connection. The video script highlights the benefits of using MySQL Workbench for managing MySQL servers and concludes with a summary of the entire installation process.

Mindmap

Keywords

πŸ’‘MySQL

MySQL is an open-source relational database management system (RDBMS) based on SQL. It is widely used for developing and managing databases on various platforms. In the video, MySQL is the central theme as the presenter guides viewers through the process of downloading and installing MySQL server on a Mac operating system.

πŸ’‘Mac operating system

The Mac operating system, also known as macOS, is the primary operating system used on Apple's Mac computers. In the context of the video, it is the platform on which the MySQL server is being installed, indicating the tutorial's relevance to Mac users.

πŸ’‘Download

Downloading refers to the process of transferring data from a remote server to a local device, such as a computer. In the video, 'download' is a key action where the user is instructed to download the MySQL server software from the official MySQL website.

πŸ’‘DMG file

A DMG file is a disk image file used by macOS for storing data. In the video, the MySQL server is downloaded as a DMG file, which the user then opens to initiate the installation process of the MySQL server on their Mac.

πŸ’‘PKG file

PKG is a package file format used by macOS for the installation of software. In the video script, the PKG file is mentioned as the file that starts the installation of MySQL on the Mac.

πŸ’‘Installation

Installation in the context of the video refers to the process of setting up and configuring the MySQL server software on the user's Mac. It includes accepting license terms, agreeing to conditions, and following the installer's prompts to complete the setup.

πŸ’‘Strong password encryption

Strong password encryption is a security measure that involves using complex passwords to protect data. In the video, the presenter opts for strong password encryption during the MySQL installation, emphasizing the importance of security for database management.

πŸ’‘Terminal

Terminal is a command-line interface on macOS that allows users to interact with the operating system and execute commands. In the video, the terminal is used to connect to the MySQL server using command-line commands after the installation is complete.

πŸ’‘MySQL Workbench

MySQL Workbench is a visual tool designed for database administration, development, and maintenance. It provides a graphical interface for MySQL server management. In the video, after installing MySQL server, the presenter also shows how to install MySQL Workbench on the Mac.

πŸ’‘Spotlight

Spotlight is a search feature on macOS that allows users to search for applications, files, and other items on their computer. In the video, Spotlight is used to open the Terminal application and to find the path of the MySQL bin directory.

πŸ’‘zshrc file

The zshrc file is a configuration file for the Z shell (zsh), which is the default shell in macOS. In the video, the presenter instructs viewers to edit the zshrc file to include the path to the MySQL binary directory, which is necessary for using MySQL commands in the terminal.

Highlights

Introduction to downloading and installing MySQL server on Mac OS

Instructions to open a browser and search for MySQL

Guidance on selecting the appropriate download link for MySQL Community Server

Explanation of choosing the correct version for M1/M2 or Intel-based Macs

Process of downloading the DMG file without signing up for an Oracle account

Starting the installation process by clicking on the PKG file

Acceptance of the license terms and conditions

Selection of installation type and location

Entering the system password for the installation

Configuring the MySQL server with strong password encryption

Option to start MySQL server post-installation

Completion message indicating successful installation

Instructions to move the installer to the bin

Verification of MySQL server status through system settings

Details on stopping automatic start of MySQL server and uninstalling it

Explaining the configuration section and paths for MySQL installation

Connecting to MySQL server using the command line

Fixing the 'zsh command not found' error by setting the MySQL binary directory path

Creating and editing the .zshrc file to include MySQL path

Reloading the .zshrc file to apply the path changes

Successfully connecting to MySQL server and creating a new database

Instructions for installing MySQL Workbench, the graphical user interface for MySQL

Downloading and installing MySQL Workbench for Mac

Connecting to the MySQL server using MySQL Workbench

Viewing databases and server status in MySQL Workbench

Conclusion and anticipation for the next video

Transcripts

play00:00

hey guys in this video I'm going to show

play00:01

you how you can download and install

play00:03

MySQL server on your Mac operating

play00:06

system so let's get started and let's

play00:08

see how we can do it so first of all

play00:11

what you need to do is you need to open

play00:13

your favorite browser and search for

play00:15

MySQL and the first link which will

play00:16

appear here will be from myql.com so we

play00:20

are going to click on this link which is

play00:22

going to open this kind of uh web page

play00:26

now in here we need to click on the

play00:28

downloads tab so I'm going to to click

play00:30

on downloads Tab and then when I scroll

play00:33

down a little I will be able to see this

play00:37

link which says MySQL Community

play00:40

downloads so I'm going to click on this

play00:42

link and here you will see different

play00:45

tools which are available for the MySQL

play00:48

Community downloads We want to download

play00:51

the MySQL Community server so just click

play00:54

on this link which says MySQL Community

play00:58

server

play01:00

and here we can download the MySQL

play01:04

Community server for Mac OS so this

play01:07

website is going to recognize

play01:08

automatically your operating system so

play01:11

you can see uh Mac OS is automatically

play01:14

selected for us the latest version is

play01:17

also selected for us for MySQL Community

play01:20

server now here I can see a few

play01:22

different versions of Mac OS so I can

play01:26

see U Mac OS 13 arm 64 and and I also

play01:30

see Mac OS 13

play01:33

x86 so if you are using the M1 or M2

play01:38

version of Mac you need to select the

play01:40

first option if you are using Intel

play01:43

processor in your Mac then you can

play01:45

choose the second option I have the

play01:48

MacBook with M2 Chip so I'm going to

play01:51

select the first version so I'm going to

play01:52

click on the first download link which

play01:55

is this download button and then this

play01:57

website is going to encourage us to sign

play02:00

up into this website with the Oracle web

play02:04

account but if you don't want to do this

play02:06

click on this link which says no thanks

play02:08

just start my download which is going to

play02:11

start the download of this DMG file so

play02:14

it's around 567 megabyte and once this

play02:18

DMG file is downloaded we are going to

play02:20

click on this DMG file which is going to

play02:23

open this TMG file so let me minimize

play02:25

the browser here and to start the

play02:29

installation process you just need to

play02:30

click on this PKG file so I'm going to

play02:33

click on this PKG file which is going to

play02:36

start the installation of MySQL so let

play02:39

me minimize this window also now for the

play02:42

first time when you uh start the

play02:44

installation of MySQL Community server

play02:47

it says this package will run a program

play02:50

to determine if the software can be

play02:53

installed so I'm going to click on allow

play02:56

here and now the installer has been

play02:58

started so here you can see the

play03:00

introduction of MySQL I'm going to click

play03:01

on continue here these are the license

play03:04

terms and conditions so if you want to

play03:06

read these license terms and conditions

play03:08

just read them and then click on

play03:09

continue and then click on agree button

play03:13

and then you have the installation type

play03:16

so here I can see standard install on

play03:20

mechanos HD this will take around 823

play03:24

megabyte so I'm okay with this if you

play03:27

want you can change the location of the

play03:30

installation for the MySQL Community

play03:33

server but if you don't have the good

play03:35

reason to change it just leave it as

play03:37

default and click on

play03:39

install which is going to ask you for

play03:41

your MacBooks password so just provide

play03:43

the password which you use to log to

play03:45

your MacBook and then click on install

play03:48

software and it's going to start the

play03:50

installation of this

play03:52

software now in between you will be able

play03:55

to see uh this kind of window for the

play03:58

configuration here is says use strong

play04:01

password in encryption also you have the

play04:04

option to choose the Legacy password

play04:07

encryption we are going to choose the

play04:09

strong password encryption and then

play04:11

click on

play04:12

next and then you need to provide a

play04:16

strong password here you can also see

play04:19

the hint for that password a reasonable

play04:21

password consist of at least eight

play04:24

characters that are mixed of letter

play04:26

numbers and other characters so let me

play04:29

provide the password and also uh you

play04:32

have this option which says start MySQL

play04:35

server once the installation is complete

play04:37

so just leave it as checked and then

play04:39

click on finish here which is going to

play04:42

once again ask you for your MacBooks

play04:45

password so just provide the password of

play04:47

uh your MacBook which you use to log to

play04:49

your Mac operating

play04:51

system and then it's going to finish the

play04:55

configuration and once the installation

play04:57

of MySQL server is finished you will see

play05:00

this kind of message which says

play05:01

installation was completed successfully

play05:04

so once that's done we can close this

play05:06

window and then I can click on move to

play05:09

bin because we don't need uh this

play05:12

installer

play05:14

anymore and once that's moved to bin we

play05:17

can now open the MySQL server so MySQL

play05:21

server is already started to verify this

play05:24

you can click on the system settings

play05:26

icon on the doc or you can click on uh

play05:29

the Apple logo here and then click on

play05:31

system settings which is also going to

play05:33

open this kind of window when you scroll

play05:36

at the very bottom here you will see a

play05:38

new section with the name MySQL which is

play05:41

created here so just click on this uh

play05:44

MySQL section and here you will be able

play05:47

to see the status of your MySQL server

play05:51

instance you can also stop your MySQL

play05:54

server from here and you can also

play05:57

uncheck this checkbox so by default when

play06:00

you start your MacBook your MySQL server

play06:04

is going to start automatically if you

play06:07

want to stop that behavior you can

play06:08

uncheck this checkbox also in future if

play06:11

you want to uninstall MySQL you can

play06:13

click on this uninstall button which is

play06:15

going to uninstall MySQL one more thing

play06:18

here is the configuration section so you

play06:21

can see all the uh path for your uh

play06:27

MySQL installation here so you have the

play06:30

base directory which is installed in

play06:32

user local MySQL you also have the data

play06:35

directory so this is where your data

play06:38

will be saved for your MySQL you have

play06:40

the plug-in directory key ring directory

play06:43

and other files right so if you want uh

play06:47

to view uh any of uh these

play06:50

configurations you can uh change those

play06:54

configuration also or view them also

play06:56

right now once everything is working

play06:59

fine we can uh minimize this window and

play07:03

now let's try to connect to our MySQL

play07:05

server using the command line so just

play07:08

click on this Spotlight here and then

play07:12

just type

play07:13

terminal and then open the terminal and

play07:18

just write this command there which is

play07:21

MySQL space hyphen u space root space

play07:26

hyphen p and then press enter and and

play07:29

most probably is going to give you this

play07:31

kind of error which says zsh command not

play07:34

found and this is because we haven't set

play07:39

the path of MySQL binary directory in

play07:42

our zshrc

play07:45

file so when you open a terminal you are

play07:49

in the home folder of your Mac operating

play07:53

system so when you do for example LS

play07:58

space High an Al here it's going to list

play08:01

out all the files and folders in the

play08:05

home

play08:06

folder you will be able to see this kind

play08:09

of uh file there also which is called do

play08:12

zshrc if you don't see this file you can

play08:17

create this file by giving this command

play08:20

so let me clear the terminal and then

play08:23

you can create this file by using the

play08:26

touch command so just write touch Dot

play08:30

zshrc and when you press enter it's

play08:33

going to create this file so if you

play08:35

don't see zshrc in your home folder you

play08:39

need to create one once zshrc file is

play08:44

created you need to open it you can open

play08:47

it using a utility called Nano you can

play08:51

also open it uh using the utility called

play08:55

text editor which is the graphical

play08:56

editor on MacBook so for that you can

play08:59

give this command which is op space.

play09:02

zshrc I'm going to press enter which is

play09:05

going to open this do zshrc

play09:09

file now here I already have few exports

play09:13

which are related to different other

play09:15

tools here I need to add the path of the

play09:17

MySQL also so what you need to do is you

play09:20

need to add this uh command in your

play09:24

zshrc so let me copy this command from

play09:27

here I'm going to put this command in

play09:30

the description of this video also this

play09:32

command is export space path is equal to

play09:35

Dollar in the curly bracket path then

play09:38

colon for/ user SL lo/ my/ bin now in

play09:45

your case you might need to change this

play09:48

path a little depending on the path of

play09:51

the MySQL bin directory now to be sure

play09:56

where this bin directory is located you

play09:58

can click cck on the spotlight option

play10:01

and then just type for/ USR here and

play10:05

it's going to show you this output under

play10:08

folder so you need to open the user

play10:11

directory right so just click on user

play10:15

folder which is USR and let's open it in

play10:19

other View and here under use USR you

play10:23

will see this local folder so click on

play10:26

local here so here you will be able to

play10:28

see the my SQL folder so I'm going to

play10:31

select this uh option which is uh MySQL

play10:35

8.2.0 in your case it can be different

play10:37

and then select bin folder here and then

play10:40

right click on this folder so if you

play10:42

don't see the option to copy the path

play10:45

name then first of all click on view on

play10:49

the finder and then show path bar okay

play10:53

so just click on show path bar here

play10:56

which is going to show you the path bar

play10:58

of the select ected folder so here once

play11:01

again just right click on this bin

play11:03

folder which is shown in the path bar

play11:06

and then click on this option which just

play11:09

copy bin as path name I'm going to copy

play11:12

this path and instead of this path I'm

play11:16

going to replace the path with the path

play11:20

which I have copied which is this one

play11:22

once you are done just save this file so

play11:25

file and save and once this file is

play11:28

saved I'm going to click close this file

play11:30

and once this uh file is uh closed we

play11:34

need to reload the do zshrc in the

play11:36

current terminal so for that you need to

play11:39

write Source space do

play11:44

zshrc which is going to reload your path

play11:47

in the dot zshrc once that's done we are

play11:51

going to once again give this command

play11:53

which is MySQL space hyphen u space root

play11:57

space hyphen P press enter and this time

play12:00

it's going to ask you for your MySQL

play12:03

password this is the password which you

play12:05

have set at the time of installation of

play12:07

MySQL so let me give that password and

play12:10

then press

play12:11

enter and now I'm into the MySQL client

play12:16

and I'm connected to my MySQL server

play12:19

using this MySQL client right so now I

play12:24

can uh give show databases command here

play12:28

and then end with semicolon and it says

play12:31

syntax error because I should use show

play12:35

databases not show database and it's

play12:38

going to show me all the databases now

play12:41

if I want to create a new database I can

play12:43

give this command which is create

play12:46

database and then your database name

play12:49

which is demo for example so when I

play12:52

press enter it's going to create a new

play12:54

database and then once again when I give

play12:56

show databases command it's going to

play12:58

show me the new database also in this

play13:01

list so now everything is working fine

play13:05

using the MySQL client now let's also

play13:08

see how we can install MySQL workbench

play13:11

which is a graphical user interface

play13:14

client for MySQL server on our Mac

play13:17

operating system so for that you need to

play13:20

uh open your favorite browser and search

play13:22

for MySQL here and then the first link

play13:24

which will appear here will be from

play13:27

myql.com so I'm going to click on this

play13:29

link and then click on downloads here

play13:33

scroll down a little and then click on

play13:35

MySQL Community down

play13:38

downloads which is going to show you the

play13:40

list of community downloads We want to

play13:43

download this one which is my SQL

play13:46

workbench so I'm going to click on this

play13:49

and then for your M1 or M2 MacBook uh

play13:53

you can use the first option which is

play13:55

arm if if you're using Intel based

play13:57

MacBook you can use the second option in

play13:59

my case I will choose the first option

play14:01

because I have M2 MacBook I'm going to

play14:04

click on

play14:05

download and then just click on no

play14:08

thanks just start my download which is

play14:11

going to start the download of the MySQL

play14:14

workbench it's around 122 megabyte once

play14:17

this DMG file is downloaded I'm going to

play14:19

click on this DMG file which is going to

play14:22

start the installation process let me

play14:25

minimize this browser here the process

play14:28

is really simple I just need to drag

play14:30

this MySQL workbench into the

play14:33

applications folder so let me just

play14:34

select this MySQL workbench uh logo

play14:38

press command key on the keyboard and

play14:41

then drag this mycol workbench logo into

play14:43

the applications folder just hover over

play14:45

the applications folder and drop it on

play14:48

the application folder which is going to

play14:50

copy this my schill workbench into the

play14:53

applications folder you can see it's

play14:55

copying into the applications folder

play14:58

once once that's finished we can close

play15:01

this uh window and then we can go to the

play15:05

Launchpad and we will be able to see

play15:08

this uh myql workbench logo here so I

play15:11

can click on this myql

play15:14

workbench and then I have the option to

play15:17

connect to my myql server so here you

play15:22

can see you can click on this local

play15:24

instance 3306 which is the default port

play15:27

for MySQL server so I'm going to click

play15:30

on this uh option here and then it's

play15:33

going to ask me for my

play15:35

myql server password so I'm going to

play15:38

provide that

play15:40

password so this is the same password

play15:43

which I have used at the installation of

play15:46

MySQL server right I'm also going to

play15:49

check this check box which says save

play15:51

password in Keychain and then click on

play15:54

okay and then it says connection warning

play15:57

local instance uh this one at this point

play16:00

I'm going to click on continue anyway so

play16:03

now I'm connected to the myql server

play16:08

using myql workbench here I can uh just

play16:12

let's say give this command show data

play16:15

bases and then semicolon and then to run

play16:18

it I can run it by clicking on this uh

play16:23

icon here and I can see that this demo

play16:28

database is also also there which we

play16:30

have created after the installation of

play16:32

MySQL server so now you are connected to

play16:35

the MySQL server using the MySQL

play16:38

workbench also here you can also see the

play16:42

status of your MySQL server client

play16:44

connections and other uh good things

play16:47

about your MySQL server so this is how

play16:51

you can also install MySQL workbench on

play16:55

your Mac operating

play16:57

system so this is how you can download

play17:00

and install MySQL on your Mac operating

play17:05

system I hope you've enjoyed this video

play17:06

and I will see you in the next video

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
MySQL InstallationMacOS GuideDatabase SetupTech TutorialCommunity ServerSoftware DownloadWorkbench InstallMac UserDeveloper ToolsServer Management