How to Install MySQL on Mac | Install MySQL on macOS (2024)
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
💻 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.
🚀 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.
🔍 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.
🖥️ 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
💡Mac operating system
💡Download
💡DMG file
💡PKG file
💡Installation
💡Strong password encryption
💡Terminal
💡MySQL Workbench
💡Spotlight
💡zshrc file
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
hey guys in this video I'm going to show
you how you can download and install
MySQL server on your Mac operating
system so let's get started and let's
see how we can do it so first of all
what you need to do is you need to open
your favorite browser and search for
MySQL and the first link which will
appear here will be from myql.com so we
are going to click on this link which is
going to open this kind of uh web page
now in here we need to click on the
downloads tab so I'm going to to click
on downloads Tab and then when I scroll
down a little I will be able to see this
link which says MySQL Community
downloads so I'm going to click on this
link and here you will see different
tools which are available for the MySQL
Community downloads We want to download
the MySQL Community server so just click
on this link which says MySQL Community
server
and here we can download the MySQL
Community server for Mac OS so this
website is going to recognize
automatically your operating system so
you can see uh Mac OS is automatically
selected for us the latest version is
also selected for us for MySQL Community
server now here I can see a few
different versions of Mac OS so I can
see U Mac OS 13 arm 64 and and I also
see Mac OS 13
x86 so if you are using the M1 or M2
version of Mac you need to select the
first option if you are using Intel
processor in your Mac then you can
choose the second option I have the
MacBook with M2 Chip so I'm going to
select the first version so I'm going to
click on the first download link which
is this download button and then this
website is going to encourage us to sign
up into this website with the Oracle web
account but if you don't want to do this
click on this link which says no thanks
just start my download which is going to
start the download of this DMG file so
it's around 567 megabyte and once this
DMG file is downloaded we are going to
click on this DMG file which is going to
open this TMG file so let me minimize
the browser here and to start the
installation process you just need to
click on this PKG file so I'm going to
click on this PKG file which is going to
start the installation of MySQL so let
me minimize this window also now for the
first time when you uh start the
installation of MySQL Community server
it says this package will run a program
to determine if the software can be
installed so I'm going to click on allow
here and now the installer has been
started so here you can see the
introduction of MySQL I'm going to click
on continue here these are the license
terms and conditions so if you want to
read these license terms and conditions
just read them and then click on
continue and then click on agree button
and then you have the installation type
so here I can see standard install on
mechanos HD this will take around 823
megabyte so I'm okay with this if you
want you can change the location of the
installation for the MySQL Community
server but if you don't have the good
reason to change it just leave it as
default and click on
install which is going to ask you for
your MacBooks password so just provide
the password which you use to log to
your MacBook and then click on install
software and it's going to start the
installation of this
software now in between you will be able
to see uh this kind of window for the
configuration here is says use strong
password in encryption also you have the
option to choose the Legacy password
encryption we are going to choose the
strong password encryption and then
click on
next and then you need to provide a
strong password here you can also see
the hint for that password a reasonable
password consist of at least eight
characters that are mixed of letter
numbers and other characters so let me
provide the password and also uh you
have this option which says start MySQL
server once the installation is complete
so just leave it as checked and then
click on finish here which is going to
once again ask you for your MacBooks
password so just provide the password of
uh your MacBook which you use to log to
your Mac operating
system and then it's going to finish the
configuration and once the installation
of MySQL server is finished you will see
this kind of message which says
installation was completed successfully
so once that's done we can close this
window and then I can click on move to
bin because we don't need uh this
installer
anymore and once that's moved to bin we
can now open the MySQL server so MySQL
server is already started to verify this
you can click on the system settings
icon on the doc or you can click on uh
the Apple logo here and then click on
system settings which is also going to
open this kind of window when you scroll
at the very bottom here you will see a
new section with the name MySQL which is
created here so just click on this uh
MySQL section and here you will be able
to see the status of your MySQL server
instance you can also stop your MySQL
server from here and you can also
uncheck this checkbox so by default when
you start your MacBook your MySQL server
is going to start automatically if you
want to stop that behavior you can
uncheck this checkbox also in future if
you want to uninstall MySQL you can
click on this uninstall button which is
going to uninstall MySQL one more thing
here is the configuration section so you
can see all the uh path for your uh
MySQL installation here so you have the
base directory which is installed in
user local MySQL you also have the data
directory so this is where your data
will be saved for your MySQL you have
the plug-in directory key ring directory
and other files right so if you want uh
to view uh any of uh these
configurations you can uh change those
configuration also or view them also
right now once everything is working
fine we can uh minimize this window and
now let's try to connect to our MySQL
server using the command line so just
click on this Spotlight here and then
just type
terminal and then open the terminal and
just write this command there which is
MySQL space hyphen u space root space
hyphen p and then press enter and and
most probably is going to give you this
kind of error which says zsh command not
found and this is because we haven't set
the path of MySQL binary directory in
our zshrc
file so when you open a terminal you are
in the home folder of your Mac operating
system so when you do for example LS
space High an Al here it's going to list
out all the files and folders in the
home
folder you will be able to see this kind
of uh file there also which is called do
zshrc if you don't see this file you can
create this file by giving this command
so let me clear the terminal and then
you can create this file by using the
touch command so just write touch Dot
zshrc and when you press enter it's
going to create this file so if you
don't see zshrc in your home folder you
need to create one once zshrc file is
created you need to open it you can open
it using a utility called Nano you can
also open it uh using the utility called
text editor which is the graphical
editor on MacBook so for that you can
give this command which is op space.
zshrc I'm going to press enter which is
going to open this do zshrc
file now here I already have few exports
which are related to different other
tools here I need to add the path of the
MySQL also so what you need to do is you
need to add this uh command in your
zshrc so let me copy this command from
here I'm going to put this command in
the description of this video also this
command is export space path is equal to
Dollar in the curly bracket path then
colon for/ user SL lo/ my/ bin now in
your case you might need to change this
path a little depending on the path of
the MySQL bin directory now to be sure
where this bin directory is located you
can click cck on the spotlight option
and then just type for/ USR here and
it's going to show you this output under
folder so you need to open the user
directory right so just click on user
folder which is USR and let's open it in
other View and here under use USR you
will see this local folder so click on
local here so here you will be able to
see the my SQL folder so I'm going to
select this uh option which is uh MySQL
8.2.0 in your case it can be different
and then select bin folder here and then
right click on this folder so if you
don't see the option to copy the path
name then first of all click on view on
the finder and then show path bar okay
so just click on show path bar here
which is going to show you the path bar
of the select ected folder so here once
again just right click on this bin
folder which is shown in the path bar
and then click on this option which just
copy bin as path name I'm going to copy
this path and instead of this path I'm
going to replace the path with the path
which I have copied which is this one
once you are done just save this file so
file and save and once this file is
saved I'm going to click close this file
and once this uh file is uh closed we
need to reload the do zshrc in the
current terminal so for that you need to
write Source space do
zshrc which is going to reload your path
in the dot zshrc once that's done we are
going to once again give this command
which is MySQL space hyphen u space root
space hyphen P press enter and this time
it's going to ask you for your MySQL
password this is the password which you
have set at the time of installation of
MySQL so let me give that password and
then press
enter and now I'm into the MySQL client
and I'm connected to my MySQL server
using this MySQL client right so now I
can uh give show databases command here
and then end with semicolon and it says
syntax error because I should use show
databases not show database and it's
going to show me all the databases now
if I want to create a new database I can
give this command which is create
database and then your database name
which is demo for example so when I
press enter it's going to create a new
database and then once again when I give
show databases command it's going to
show me the new database also in this
list so now everything is working fine
using the MySQL client now let's also
see how we can install MySQL workbench
which is a graphical user interface
client for MySQL server on our Mac
operating system so for that you need to
uh open your favorite browser and search
for MySQL here and then the first link
which will appear here will be from
myql.com so I'm going to click on this
link and then click on downloads here
scroll down a little and then click on
MySQL Community down
downloads which is going to show you the
list of community downloads We want to
download this one which is my SQL
workbench so I'm going to click on this
and then for your M1 or M2 MacBook uh
you can use the first option which is
arm if if you're using Intel based
MacBook you can use the second option in
my case I will choose the first option
because I have M2 MacBook I'm going to
click on
download and then just click on no
thanks just start my download which is
going to start the download of the MySQL
workbench it's around 122 megabyte once
this DMG file is downloaded I'm going to
click on this DMG file which is going to
start the installation process let me
minimize this browser here the process
is really simple I just need to drag
this MySQL workbench into the
applications folder so let me just
select this MySQL workbench uh logo
press command key on the keyboard and
then drag this mycol workbench logo into
the applications folder just hover over
the applications folder and drop it on
the application folder which is going to
copy this my schill workbench into the
applications folder you can see it's
copying into the applications folder
once once that's finished we can close
this uh window and then we can go to the
Launchpad and we will be able to see
this uh myql workbench logo here so I
can click on this myql
workbench and then I have the option to
connect to my myql server so here you
can see you can click on this local
instance 3306 which is the default port
for MySQL server so I'm going to click
on this uh option here and then it's
going to ask me for my
myql server password so I'm going to
provide that
password so this is the same password
which I have used at the installation of
MySQL server right I'm also going to
check this check box which says save
password in Keychain and then click on
okay and then it says connection warning
local instance uh this one at this point
I'm going to click on continue anyway so
now I'm connected to the myql server
using myql workbench here I can uh just
let's say give this command show data
bases and then semicolon and then to run
it I can run it by clicking on this uh
icon here and I can see that this demo
database is also also there which we
have created after the installation of
MySQL server so now you are connected to
the MySQL server using the MySQL
workbench also here you can also see the
status of your MySQL server client
connections and other uh good things
about your MySQL server so this is how
you can also install MySQL workbench on
your Mac operating
system so this is how you can download
and install MySQL on your Mac operating
system I hope you've enjoyed this video
and I will see you in the next video
浏览更多相关视频
2 | How to Install a Local Server for PHP | 2023 | Learn PHP Full Course for Beginners
Installing MySQL and Creating Databases | MySQL for Beginners
Part2 : Database Testing | Environment Setup
CARA INSTALL DAN KONFIGURASI DHCP SERVER PADA LINUX UBUNTU SERVER 23.10 (ISC DHCP SERVER)
How to install MongoDB 6 on Ubuntu 22.04 LTS Linux
How to install Private Server | Genshin Impact (2024)
5.0 / 5 (0 votes)