Transcript for:
Comprehensive MySQL Tutorial Guide

What's going on everybody? Today we are going to be starting our MySQL tutorial series. Now the entire MySQL series will be broken up into three smaller series. We'll have our beginner, our intermediate, and our advanced.

This lesson is the very first lesson in the beginner series. We're going to walk through all of the beginner or the basics of MySQL. Today we're going to be setting everything up. So we'll be installing MySQL. and then creating our database that we'll use to actually learn MySQL.

Now, before we get started, I wanted to let you know that I created three full MySQL courses over on analystbuilder.com. I built a crash course for MySQL for people who are gonna be interviewing or taking technical interviews. I also created a full MySQL course that's gonna cover everything from the basics all the way to the intermediate level. And then lastly, I created an advanced course that's gonna teach you a lot of the more advanced things that an analyst would typically use.

Those courses are gonna go really in depth and they're gonna have a lot of practice questions along the way. and we'll also have full guided projects in there as well. I'll have links in the description to all of those courses if you wanna check those out. Now, without further ado, let's jump on MyScreen and install MySQL and create our database.

All right, so let's get started by downloading MySQL. We're gonna come right over here to dev.mysql.com forward slash downloads forward slash installer, and I will have that link in the description so you don't have to write all that out, but you should be seeing this page right here. Now, we have to select an operating system.

I'm using a Windows machine. And if you aren't, if you're using Linux or Mac or something else, it should populate it for you. But if it doesn't just like this dropdown and select your operating system. Next, we have two different downloads. We can install the MySQL installer community or MySQL installer web community.

This one is very small, but then you actually do have to download the installer. It just gets it from the web. This one, I'm going to download the actual installer. It's larger, but this is the one I'm going to do. I'm going to go ahead and select download.

It's going to ask me if I want to log in or create an account and I don't. I'm going to say no thanks, just start my download. I'm going to save this in this desktop folder, doesn't really matter where you save it. We're going to save that and it's going to download. It should be done in just a few seconds.

I'm going to go ahead and click on it and it's going to open it up when it's finished and we should get the interface or the UI for the actual installation for MySQL. So here is the MySQL installer. And first thing we need to do is choose a setup type.

Now we're going to keep the developer default unless you really know what you're doing and you can select the server only, the client only, full, which is literally everything MySQL has to offer, or custom. So we're going to keep this developer default just installing the things that we kind of need. So let's go ahead and select next. And for whatever reason on my computer it's saying this path already exists.

You probably won't get that, but I'm just going to go ahead and select next. And then I'll select yes. It keeps doing that.

I can't explain why, but it keeps doing that for me, even though I've deleted it from my computer completely. But it just remembers it somewhere in its memory. Now, the next thing we need is to check requirements. Now, I just have this one.

It says I need to download this Visual Studio. I'm not going to do that. But on your screen, you may have multiple, multiple requirements. Typically, you're looking at something like this.

Microsoft Visual C++ redistributable package. What you need to do is download this. All you have to do is click download.

Once you download and install that on your computer and then we go back, all those should be gone. That's the one that I see the most when I'm actually working with these requirements. I had to install it myself when I got this new laptop. So go ahead and install that if you need to.

But if yours looks like mine, we don't need this Visual Studio for what we're going to do. We want to go ahead and select next. It is giving us a prompt that we haven't satisfied all the requirements, but that's okay. We're going to go ahead and select yes as well.

Now we're ready to install all of these things. These are all things that MySQL wants you to install. The most important are the server and the workbench. But it does not hurt to have all these other things as well.

Some of these connectors are also important. So we're going to go ahead and execute. This will take just a few minutes, I'll skip ahead when they're all done. But this should take just a few minutes. And then we'll continue on installing MySQL.

So everything just completed. And now we're going to select next. And now we need to actually configure our product. Now really the only one that we actually need to configure is the server.

The router says we need to configure it and the samples and examples say we need to configure it as well, but really it's just the server. Let's go ahead and select next. Now we're not going to change anything for this type and networking unless you know what you're doing with the port, the X protocol port.

We're not going to change any of this. We'll go ahead and select next. Next thing we need to do is select an authentication method. I'm going to be using a password.

I'm not going to be using the legacy authentication method. So I'm just going to go ahead and create a password. Now for you, and I keep getting this error and I can't explain why. Right here for you, you should be creating a password at the bottom. It's remembering my password somehow and I really can't explain it.

But I'm going to create my password or check my password. This is one that I already created before I deleted it off my computer, but it's still there. So it's saying my password is still good.

But if you need to, you should be entering a password and then confirming your password and saving it. And then you should also be checking it as well. And then we're going to configure this as a MySQL server as a Windows service.

I'm going to keep that checked. And we're going to start the MySQL server at system startup. I like that automatically being there. I don't want to mess with that. So I'm going to keep it as it has it.

I'm going to go ahead and select next. And the last thing we do is just need to execute this and then everything we put in there is going to actually go. So let's run this and execute it and that just finished. So let's go ahead and select finish. Now it says configuration complete for the server, but we also need to configure these other two.

Let's take a look at these really quickly. We're not going to do anything on this. It even says we really don't need to do this. We just need to click finish and configuration not needed.

Next we'll do samples and examples and we can input our password. and all this is really going to do is put in some sample databases for us in our database which if you want you definitely can do that. I just connected that worked.

I'm going to hit next and execute and it's basically just going to put in a database or two some sample ones for you to look at and the configuration is complete. You don't have to do that one but we'll see that in just a second. We're going to select next and now the installation is completely done and we can start MySQL Workbench after setup.

and start MySQL shell after setup. Now I'm not going to do the shell. So I'm going to actually uncheck that.

And we're going to select finish. Now MySQL just popped up for us. And this is exactly what you should be seeing. Now there's a lot of things in MySQL to learn and know how to do. We're not going to be taking a look at all of that stuff today.

But in future lessons, we'll walk through a lot of these different things that kind of correlate with different lessons or things that we're working on in MySQL. The first thing that we're going to click on is right over here. This is our local instance. This is local to just our machine. It's not a connection to, you know, some other database on the cloud or anything like that.

It's just our local instance. We're going to go ahead and click on this. So this is what you should be seeing right here.

This is where we're going to actually write all of our SQL code. And I'll show you all this in just a second. But this is where we can actually create our database. And our database is going to go right over here on this left hand side. The silica one is actually a sample database.

It has a bunch of tables and views or procedures functions as all of these things in here. if you want to go ahead and mess around with that. What we're about to do is create our own database that we're going to be using throughout this entire series, both the beginner, intermediate and advanced, we'll use a lot of this.

And sometimes we'll import some other ones for different use cases. But this will serve for most of what we're trying to do throughout this entire series. Now what I'm going to do is I'm going to go ahead and I'm going to say, open a SQL script file in a new query tab.

And right here, it opened up to a folder that I already created this MySQL beginner series folder. Within it, we have this right here, the parks and rec create underscore DB. Now, in order to get this, you just have to go to the GitHub and download this file.

That's all you have to do. We're then going to open this file. So let's click on it. We're going to say open. And what you're now seeing is basically the query editor.

This is where you can write your code. Now, we're not importing a database. We're actually creating it by running code.

Now, because this is the first lesson in the beginner series, I'm going to assume that you don't know a ton about MySQL. Really all this is doing is creating the database name and then we're inserting a few tables into that database and then we're inserting data into those tables. So this is all of our data that will go into these tables that we create. We only have one, two, three different tables that we're going to be using. So all you have to do to run this is click this lightning button right up here.

We're going to go ahead and execute this. If we come down to the bottom and we pull this up, this is our output. This says six rows affected, and we have a bunch of other things like create table, create table, insert, insert, create table, insert into.

These things are all working perfectly. So now if we go ahead and click refresh in our schemas with this refresh button right here, this parks and recreation table is populated. If we go under the tables, we see all of these things. So now that we've actually created our database and our tables, that's really all we were trying to do in this lesson.

But I just want to. open up a table really quickly, show you what it looks like, show you how we can run code, and then in the next lesson we'll start actually learning how to query this data. So let's go up to employee demographics. We're going to right click and select rows limit 1000. This is going to open up a new window right up here and it's going to say select everything from this database dot this table employee demographics and it ends with a semicolon. Now right down here We have this output window.

This is the actual data that sits in our table. We have columns right here. So employee ID, first name, last name, age, gender, and birth date. And then here are all of our employees on each row. So these are all separate rows.

We have Leslie Knope, Tom Haverford, and it goes on and on. So this is all of our data. The most important things to know when we're actually working with this, and I'm going to zoom in, is if we hover over this query right here and we run it, we can select this execute, which is this lightning bolt with this eye. We're going to execute this.

and it's going to run this because we're highlighted over it. Now if we have two queries, let's say this one right here, let's change it to employee underscore salary, we'll do underscore salary. Let's say we want to query this table.

So now if we highlight over this, and we go up and select the lightning bolt with the eye. Now we're looking at a different table. But if we select even if we're hovering over this, if we selected this button, we're going to execute everything.

in this editor window. So let's run this and now you can see at the bottom we have two outputs, the employee demographics and the employee salary. So this button is going to run everything in this editor window whereas if we select this lightning bolt with the eye we're doing everything that's just under where we have the cursor where we have it highlighted. The very last thing that I want to mention is that right over here you may have this up and you probably don't want that. We're not going to do any SQL additions in this series.

You can get rid of that by clicking this button right here. So starting in the next lesson, we'll have everything ready to go and we will start learning the basics of MySQL. I hope you're able to follow along, get everything set up, how we have it on the screen. I am super excited about this series.

I just, I love SQL. So I'm really, really, really excited to get started on this with you guys. I will see you guys in the next lesson.