From the course: Database Foundations: Database Management

Set up the database servers

From the course: Database Foundations: Database Management

Start my 1-month free trial

Set up the database servers

- [Instructor] If you've been following along with the other courses in this series, then you probably have a couple of database servers already running in Docker containers and an Azure Data Studio environment that looks something like what I have here on the screen right now. Now, if you're already at this point, then you can skip this movie and go straight into the next movie where we'll set up the database for this course. For everyone else, I'm going to throw these server connections away, and start fresh again. This will ensure that everyone is starting out on the same page, so that you can follow right along with me. Here in Azure Data Studio I'm going to right click on both of my server connections and choose Delete Connection. Then we need to make sure that we have some software installed. Inside of the Exercise Files is a folder called Chapter Zero, and inside of there is a text file called Server Setup. This includes the different URLs that we need to go to and all of the different commands that we need to run. So first, we need to install Docker and Azure Data Studio. You can find them at these URLs. The Docker Desktop page will allow you to download Docker depending on if you're on Windows, Mac, or Linux. Once you've downloaded it and installed it, you can turn to Azure Data Studio. You can get that software from this URL. Here in the middle of the page, you'll find the installers for the different platforms. Once everything is downloaded and installed and running, you can go ahead and turn your attention to setting up the database servers. Back on the desktop, I want to make sure that Docker Desktop is currently running. And you can take a look for this little whale icon in your menu bar, if you're on Mac iOS or Linux, or down on the bottom right-hand corner of your Start menu if you're on windows. Once Docker Desktop is running, you need to open up either the terminal application or Windows PowerShell. Then we can issue a couple of commands. Now first, my servers are already running, so I need to stop them. I'll say, docker stop sqlserver2019. We'll do the same thing for the PostgreSQL server. Once both Docker containers are stopped, I can remove them from my system. We do that with the command docker rm sqlserver2019, followed by docker rm postgresql. So that removes both of these servers that I already had running on my system. Now, I can re-install fresh copies of them. And for that, I'm going to return back to the server setup.txt file and take a look at the commands that I have written out right here. Now, if you're on Mac OS and Linux, you're going to run these two commands and if you're on windows PCs, you can run these two commands. So the first one is going to install our SQL server instance and it wraps onto two different lines. I'm just going to copy that to my clipboard, come back over here to PowerShell and paste it in and press Enter to run. That'll create a brand new SQL server container that we can connect to. Let's do the same thing to create a PostgreSQL container. I'll run this line right here, I'll paste it into PowerShell and run that. Now, if I issue the command docker ps, I should see that both of my containers are currently running. Here I have my PostgreSQL server, and I can see that it's up. And here I have my SQL server 2019 container and it's also up. If you restart your computer, you'll need to come back into Docker and restart your images. You can do that with the command docker start and then the name of each one, either PostgreSQL, or SQL server 2019. So once both of these containers are up and running, we can connect to them inside of Azure Data Studio. Let's close PowerShell, I'll close my notepad file and I can also close this chapter zero folder. We'll go back into Azure Data Studio and we'll create the connections. I'll come up here on the server connection sidebar and I'll press this icon with a plus. The first one is going to be to our SQL server instance. So in the connection type I'll choose Microsoft SQL server. The server is going to be our local host. Our authentication type will be SQL login and the username is sa. The password that I created when I created the Docker containers is Adam with a capital Adam123456. I'll choose to remember the password, I'll choose the database group as my SQL server group and I'll give this server connection a name. I'll call it SQL Server. Then, we'll press the Advanced button and we'll find the option for port. The port for this connection is 1401, I'll press OK and I'll press Connect to create the server connection and it should appear inside of my SQL server group. For the PostgreSQL one, we need to make sure that we have an extension enabled first. So I'll come down here to this icon to enable the extensions marketplace, and I'll search through and find the PostgreSQL extension. Now I've already got it installed, so it's right there ready to go. Now at the time of this recording there's a small bug with the PostgreSQL extension. If you get an error message when you're installing it that says the extension exited unexpectedly, take a look at this URL for a potential fix. Now I've already applied that fixed to my system so the extension is working again which will allow me now to connect to the Postgres server. So I'll come back over here to my server connection sidebar, I'll press the icon with a plus for a new connection again and my connection type this time will be PostgreSQL. The server name is local host again, the authentication type is password, the username is Postgres and the password again is Adam123456. I'll remember the password. We'll put it in the PostgreSQL server group and I'll name it PostgreSQL. Once again, we'll flip over to the advanced section and we'll find the port. And this one is 5401. With that typed in, I'll come down and press OK and press connect. That'll connect me to my PostgreSQL server and it's right here inside of the PostgreSQL group. And with that, we've got two fresh and clean database servers ready to go. If you want a more thorough explanation of all of these steps, I'll refer you to the corresponding movies in the course "Database Foundations, Intro to Databases."

Contents