Warning.
This video may contain extremely frustrating installation instructions and is for experienced developers
only.
It's advised that you install using Cloud nine to avoid needless pain and anger.
Welcome to this video on installing MySQL on a mac.
And again, I'll warn you, this can be painful.
And this lecture and doing this, all these steps are 100% optional.
In fact, if you don't have a good reason, if you're not sure if you should do this, then that means
that you shouldn't do it.
At least not until you get to the end of the course.
Of course, if you're somebody who is an experienced developer and you know you want to get this running
locally at the beginning on your Mac, then go ahead, follow these instructions.
But I would definitely recommend that you go through the course for 99.9% of the people in this class,
go through the course with cloud nine and then install this on your Mac at the end.
It just makes everything so much easier.
Okay, so if you're still here, though, the steps to actually install it are surprisingly simple.
The problem is, once you install it, you run into issues depending on your developer environment,
depending on things like if you're using Bash or Shell, if you have permissions issues and passwords
and it just turns into a nightmare a little bit.
Well, not just a little bit.
A lot.
So the first thing we need to do, like I said, is actually nice and easy.
Just go to my SQL com.
Go to the downloads tab.
And what you'll see here are a bunch of the basically like the commercial services and MySQL enterprise
software that is not free.
We want the community section and then we want the first thing here.
My SQL Community Server.
Then at the very beginning, this is kind of just a blurb about it, some documentation and instructions.
But if you keep scrolling down, you'll see the download links, so you'll need to select the one that
corresponds to your Mac depending on how old your Mac is or how new it is, what version of Mac OS it's
running.
All of that you'll have to make a decision.
But for me it's this first one here.
So I'll click download and it looks like you have to type or you have to sign in or create an account.
But that's not true.
You scroll down and there's this link.
No thanks.
Just start my download.
Of course, if you want to you can sign up, but most of you probably don't care.
So just click.
No thanks.
Just start my download and I'll see you in just a second once I edit this download Time Out.
All right now that's completed downloading so I'm just going to open it up.
Might take a second to open, but once it does, you'll see a single file inside of this and we'll just
double click, follow the steps, continue.
Read every word of this.
Of course I've already done it.
So you know, I know everything it says.
Click agree.
Tells you 1.13 gigs space needed to make sure that you have that available.
Then we'll click install.
Then it will ask you for your password for your computer.
Fortunately, I guess I can use my thumb or my finger.
That way you don't have to watch me type my password.
I don't have to edit that out.
It's always a problem.
I don't want people to see my passwords.
Okay, so here's an important part.
I mean, it's all important, but this in particular, it gives you a little pop up here.
It says a temporary password is generated for root at local host and then it gives you this password.
So I highly well, I don't highly recommend you need to copy this.
Technically, if you forget it or you lose it, you can reset the root password.
It's just another set of steps and complications.
So copy this.
Save it.
Okay, we're now done installing it.
We're going to move it to the trash.
So we're done with the install.
But that's the easy part.
Just a couple of clicks.
Now we need to do a couple of things.
The first is start up the server.
So to do that, we go to system preferences and it should be down here.
There should be a new icon somewhere, at least depending on how you have your setup.
For me, it's the bottom left, my SQL.
I'll click on that and we should see my SQL Server status, you know, blah, blah, blah.
It's the server instance is currently stopped.
There's a button to click to start it which will start it.
And then there's also this checkbox which I'll address now, depending on what you want.
You can have my SQL Server start up every time you start your computer.
I'm not going to do that.
You have to type your password again.
I have like six or seven database servers on here and I just don't want any of them to start up on this
machine.
At least this is not my developer machine.
This is what I use for teaching.
Totally up to you.
Just depends on how you're using it.
But if you're just learning my SQL now, it might actually be good to leave that on so you don't have
to continually start it.
But either way, it's not that hard to start.
It's just a button here which will click now.
And there we go.
If you didn't click this or uncheck this, you may have to type your password when you click that the
first time.
So now what we have left to do is open up our terminal.
And start interacting with this.
So I'm going to bring the font size up a bit.
And theoretically, you should be able to type my SQL.
But this is where we start running into issues.
So I'm getting this command not found.
And if you get this again, this depends on how your Mac is set up and your developer environment and
this is where it's annoying.
But for me, I'm using something called Shell.
I'm getting command not found.
And that's because the my SQL Command is not it's not in my path.
So what I need to do now, I'll open up my dot slash dot RC file.
And I'll paste this line in here just so you can see it.
I'll include this in the instructions for this lecture.
You can find this on anywhere online.
It's very common error when people type my SQL and you get command not found.
In fact, if we just did that right now, I went to Google.
You can see, depending on what version of OSX you're running, there's all sorts of replies that are
basically exactly what I just did.
In fact, that's where I got the line originally.
It just depends on if you're using batch and if you are, then you can use a line like this.
But essentially there's all these possibilities depending on your environment.
So I can't cover all of them here, but find the correct command for you to run.
And that's only if you're getting command not found.
All right, so we need to save this file.
Close it down, go back to terminal.
Then the next thing, I'm just going to close the window and reopen it.
Or you can quit terminal or you can source your profile.
Now, what I need to do is try my SQL again.
Okay.
So now we have a different problem.
And this is a it's not a great problem, but this is a problem.
We should have access denied for user cult steal at local host using password.
No, the problem is if you remember well, first of all, this means that my SQL, the command is found,
it's running, but we're getting a result now.
And the problem is that I'm trying to start my SQL and I don't have permission.
I need to log in as the root user.
And remember, we saved that password.
So I went and copied that password that we were told to save.
It's on my clipboard now.
I can paste it, but that won't do anything.
What we need to do is run my SQL, dash you space root dash P and hit enter and it should prompt you
for the password.
You can paste that in and we're in.
All right.
So if you get this far, congratulations.
Everything's working.
If you didn't get to this point, it's likely because of a couple of reasons.
One is that you're still getting that command not found issue that one is relatively easy to fix.
The problem is you have to be comfortable using your command line and opening up hidden files like batch
profile or your zip file.
The other problem you could run into is this permissions thing, and if you didn't save that password
that I told you you should save, but if you didn't or you close the window accidentally, you can reset
the root password.
All you need to do is go online and Google it.
There's a couple of posts online about it.
Basically what you do is you run my SQL dash, you space root, and there's something called Flush Privileges
Command and you can update your password with a new password.
There's a couple of things you can do like that, basically, rather than me making a video for every
possibility.
It's much better if you just find it out online.
And this is why I recommended that you use cloud nine.
I promise they're not paying me.
It's just that this is difficult, especially in an online setting.
Okay, so you might think we could start running some MySQL code, like if you tried.
Here's something we haven't actually seen yet, but if you tried this or actually, how about show databases?
So this would show us a list of databases.
And if there are no databases, it should still show us something.
But instead we get this.
You must reset your password using all true user statement before executing this statement.
Okay, so our final hurdle here, what we need to do is I have a command that I just had on my clipboard,
but it looks like this alter user in quotes, root at and then in quotes local host identified by.
And then all you need to do is provide a password here in quotes that you would like to use for the
root user for your MySQL install or for this server instance.
And so just type something, I'm just going to make mine password.
There we go.
And hit enter.
Oh, with a semicolon.
Now if we get the query, okay, things should be working.
If I try my show database command, this time we're in.
I don't get this permissions problem.
Phew.
It worked out.
So, again, that command.
I'll also include in the instructions if you need to do that, it's just alter user route.
That local host identified by password.
OC So then the last thing is if you want to close out, by the way, it's Command D which we'll be covering
all this if you're going through the course of the very first time and this is how you decide to start.
We'll actually go over these commands in the next section when we install everything, once we have
everything installed and we start talking about MySQL, but we need to be able to verify the install.
So there's a couple of commands.
So now if I wanted to try logging in again, I shut it down.
It's my SQL dash you root dash P and then we'll ask me for my password, which I changed to password
type that you won't actually see it, but if you type it correctly, you're in OC.
So that is our journey to installing MySQL on a mac.
Great time.
Hopefully if you got to this point, you made it through and everything worked out.
If not, if you're just starting this course off, I still highly recommend that you switch to using
cloud nine.
Avoid all of these issues and then come back to this when you feel more confident.
Otherwise, if you absolutely have to use a mac, we'll try our best to help you out.
Anyways, moving on.