Check out a free preview of the full Visual Studio Code Can Do That? course
The "Working with MySQL" Lesson is part of the full, Visual Studio Code Can Do That? course featured in this preview video. Here's what you'd learn in this lesson:
Burke shows how to connect to a MySQL database located in a docker container using VS Code.
Transcript from the "Working with MySQL" Lesson
[00:00:00]
>> Burke Holland: So let's look at MySQL here. We have an extension that I've included called MySQL. And then inside of that, I've already connected, let's disconnect.
>> Burke Holland: No, let's not do that, Escape. Let me just disconnect this one, and we'll start from scratch. So let's add a new connection.
[00:00:17]
And the host name of this, you can probably guess is, what? What do you think the host name is?
>> Student: MySQL.
>> Burke Holland: MySQL, that's it, because that's the name of the container and we're linked, so we just say MySQL. So we'll say MySQL. And then it wants to know the user.
[00:00:37]
In MySQL, root is the user. And then for the password, you wouldn't know this without looking in the compose file but it's right there. So we'll say example, the port we can leave as the default. I don't even know what this is, I just press enter. And then, here's our mysql database.
[00:01:00]
So again, we can run queries here just like we would against SQL. So I'm going to say new query, and let's just do select * from Colors. And I think you have to end mysql statements in a semicolon. And then we'll say, mysql, run mysql query, boom. So, depending on what your database is, there's more than likely an extension for it inside of the S code so that you can work with your data and your databases without leaving your editor, which is a pretty cool thing.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops