So let's start
installing some database servers, and engines, and clients.
And in this lecture,
I'll give you a brief overview of the MySQL installation,
because we're going to get started
with setting up MySQL in this lecture.
And then for the majority of this lecture,
we'll install MySQL in macOS.
Now you can skip to the next lecture
if you're using Windows,
because there I will show you how
to set up MySQL on Windows,
but you should stick around for the brief overview
of the MySQL installation, with which I'll start right now.
Because to install MySQL,
you can of course visit the official MySQL page,
which you can also find by just searching for MySQL.
And there it's always a good idea
to explore the official documentation,
to find detailed instructions
on how you can install this software, MySQL,
the MySQL server, for different operating systems.
Though, it will be even easier
to find the installation documentation
if you search for MySQL installation,
and then here you'll find a direct link
to the MySQL installation guide,
where you can learn how to set up MySQL
on different operating system,
including Windows and macOS, and also Linux.
However, and that's really important,
although for Windows later
there are different versions of MySQL and to MySQL server.
For example, there is this MySQL database service,
which is a managed, paid service that you could be using,
but that we will not use in this course because it's paid.
There also is the enterprise edition, which is also paid.
We will be using the community edition instead,
which has all the same base features,
all the features we need, and all great performance,
but which is free to use.
And therefore we'll switch
to these community downloads instead.
Alternatively, you can also search
for, download MySQL community.
And then we need that MySQL community server.
And you can pick the latest version there,
for me it currently is version eight dot something.
Now here on this page, you can select your operating system
and you'll find a link to this page
attached to this lecture by the way,
so that we all operate on the same page.
And then here for macOS,
since that is what I'll get started with,
you can download your package, your software installer.
Now here, I'll choose the top download, the top one here,
which includes the SQL server.
And I'll choose this one because I'm on an M1 Mac,
so I need the ARM version.
If you're on the Intel Mac, you would choose the X86 version
and download that.
And that will then give you an installer
through which you can walk,
and through which we'll walk together in a couple of seconds
that will install the MySQL server on our system.
So I'll download this.
And then on this next page you're asked to log in,
but actually you don't need to do that.
You can just click, no thanks, just start my download.
And that's what I'll do here.
And this will then download this MySQL package
onto the system so that we can then use that
to install the MySQL server.
So now the download finished,
and I can now start this installer here.
So here's the installer opened up,
and I will now simply walk through it
and generally keep the default settings,
enter my user password here when I'm prompted for it,
and let it generally install everything here.
And then here, once we reach configuration,
we can use either of the two options.
I'll go with the strong password encryption here,
and then click next.
And then you have to choose a password for the root user.
This is a user that will be created for the database server
because when we connect with a client to a database server,
we will need to authenticate.
In reality, not everyone should be able
to talk to our database because we of course wanna protect
the data that's in it.
That's why we need users with passwords
for the database server,
just as we have a user for our own personal machine,
or for our Amazon account for example,
Now such a user with the name, root,
is created automatically here.
You can also create users manually thereafter
if you wanna have multiple users on your database,
but here we'll go with the default user
and we'll use that default user
for connecting to the database with our client later.
And that default user will have a name of, root,
but now we also need to assign a password
and therefore I will do that here.
And choose a password, and then I will click finish here.
Now I need to enter my user password again,
this time the regular password of your macOS user,
not the password you just entered here
for the database user.
And with that, the MySQL software should be installed
on your system.
So we can now finish this process.
So now we installed the MySQL server
and it already should be up and running.
You can confirm this
by going to your system preferences on macOS,
and there you should now have a new MySQL option,
which you can choose
where you actually have that SQL server,
which you can also stop and restart from there.
And here you can also control
whether it should start up automatically
when your computer starts.
And I will, for example, disable this here
so that I have to start it manually whenever I wanna use it.
You of course should make sure
that this SQL server is up and running
whenever you wanna work with it.
Under configuration you can also control
where the actual database data
will be stored on your hard drive,
because at some point
it of course still will be written to your hard drive.
The database engine is just an intermediate software
between your data and the data being written
on the hard drive.
And you can of course change these paths
if the actual data should be stored somewhere else,
but I'll keep those defaults.
Now that was the SQL server.
The server is not enough though,
we also need clients, as you learned.
And for this, I'll go back
to the MySQL community downloads here.
So on this download page,
I'll click on MySQL community downloads
and here we downloaded the server,
now I also want to download the Shell,
which is this MySQL command line tool I mentioned before,
and the workbench.
So I'll go to MySQL Shell here,
and I'll also choose macOS here
and then download this Shell for my M1 Mac.
Start this download.
And while this is downloading,
I will already also go back and download the MySQL workbench
which is this graphical user interface.
There is no ARM version of that,
so I'll use the X86 version for my M1 Mac
and run it via Rosetta.
So I'll download this as well here, like that.
Now I'll start with the Shell and open this installer here.
Here we go. That's the installer for the Shell.
And I'll simply walk through it here,
agree to the license, and install this Shell.
Again, enter my password for my Mac user
and install this shell, which is this command line client,
and click close.
Now we also downloaded MySQL Workbench,
and if you double click on that download,
you should be greeted with this trivial installer
where you just drag MySQL Workbench
into the applications folder here.
And this will then install MySQL Workbench,
this graphical client, this graphical user interface client
on your macOS system.
So, I'll also do this now.
Now with all of that installed,
and with the SQL server up and running on macOS,
you should be able to open your terminal,
and in there run MySQL.
This command should now be available
since you installed the MySQL Shell.
If you get, command not found,
you need to make sure that this installed Shell
is available as a global command.
To make it available as a command,
you can go to your user folder in the finder,
make sure you show hidden files
with Command, Shift dot, by default.
And there you should have a dot set profile file,
which you can edit.
If you don't have that file yet,
you can simply create it with any text editor.
So here I'll just opened this with text edit,
and edit this file.
And in that file, I'll just add this entry here,
where I write export, white space,
path equals/usr, with U-S-R, /local/mySQL/bin:$PATH,
where path is written all uppercase.
That's what I add here.
And then I'll close this,
and if you now close your terminal and restart it,
you should be able to execute MySQL.
And you should now get a different error
that tells you that access was denied,
because running it just like this indeed is incorrect.
Instead, now we can use MySQL to connect to the database,
but we'll do that and learn about MySQL Workbench
in one of the later lectures in this section.
Because now we have that installed,
we have the server installed,
now we wanna do the same for Windows
before we then see how we can connect
with those different clients
through the different database systems.