Introduction
This lesson is the practical starting point of the course series. The previous lesson established a general understanding of relational databases and the SQL Server ecosystem. In this lesson, you will prepare a working SQL Server environment on your Windows computer. By the end, you will be able to connect to the SQL Server Database Engine, run queries through SQL Server Management Studio (SSMS), and verify essential server and connection information.
The exercises can be completed with SQL Server 2019 or SQL Server 2022 Developer or Express Edition. Developer Edition provides a broad feature set for development and testing, but it is not intended to be licensed as a production edition. Express Edition is a free, more limited edition suitable for small applications and learning. SSMS is not the database server itself; it is a client tool used to connect to, administer, and query SQL Server.
Preparation Before Installation
Required components
- A computer or virtual machine running Windows.
- SQL Server 2019 or SQL Server 2022 Developer or Express installation media.
- The SQL Server Management Studio installation package.
- Local administrator permissions during installation.
- A development or testing purpose for Developer Edition, and awareness of the resource limits of Express Edition.
SQL Server and SSMS are installed from separate packages. You can install the Database Engine first and then install SSMS. Before beginning, it is useful to check the computer name, your Windows account, and any existing SQL Server instances. A computer can contain multiple instances, so using the correct instance name is essential when connecting.
Default instances and named instances
During SQL Server setup, you will usually choose between a default instance and a named instance. A default instance is commonly addressed by the computer name, localhost, or .. A named instance is addressed by adding the instance name after the computer name. Express Edition is frequently used with a named instance called SQLEXPRESS. In that case, the connection name is commonly localhost\SQLEXPRESS.
| Installation type | Example server name | Description |
|---|---|---|
| Default instance | localhost | The default Database Engine instance on the local computer. |
| Named instance | localhost\SQLEXPRESS | An instance installed with a specific name; common with Express installations. |
| Local computer shortcut | . | Represents the local computer when the relevant instance can be addressed through the default connection. |
Installing SQL Server 2019/2022
1. Start the setup wizard
- Use Microsoft's official SQL Server download resources to select SQL Server 2019 or SQL Server 2022.
- Download the Developer or Express Edition setup package.
- Run the installer with administrator privileges.
- In the installation center, start a new SQL Server standalone installation.
The wording of setup pages can vary slightly by SQL Server version and installation language. The main process remains similar: select an edition, accept the license terms, choose features, configure the instance, configure services, and configure the Database Engine.
2. Select an edition
When the free edition options are displayed, select Developer or Express Edition. Developer Edition is often more suitable for learning because it exposes a broader set of features. Production licensing must be reviewed separately. If you select Express Edition, remember that it has limitations related to resources, performance, and database size.
3. Select features
On the Feature Selection page, select Database Engine Services. This is sufficient for the fundamental exercises in this course. Components such as Analysis Services, Reporting Services, and Integration Services are not required for the initial lessons. Avoiding unnecessary features reduces installation time and resource consumption.
4. Configure the instance
On the Instance Configuration page, choose either a default instance or a named instance. If SQL Server has not previously been installed on the computer, a default instance can make connection details easier. If you use the SQLEXPRESS name suggested by an Express installation, enter localhost\SQLEXPRESS in SSMS.
Record the choice you make during setup. If two SQL Server instances exist on the same computer, entering only the computer name may connect to the wrong instance or fail to connect.
5. Configure services
On the Service Configuration page, make sure the SQL Server Database Engine service is configured to start after installation. Automatic startup is convenient on a development computer. On a computer where SQL Server is used only occasionally, manual startup may be appropriate. The correct choice depends on your system administration policy and usage requirements.
6. Select an authentication mode
On the Database Engine Configuration page, you can choose Windows Authentication Mode or Mixed Mode.
- Windows Authentication: Connects by using your Windows account. It is usually the simplest and safest starting point for a local learning environment.
- Mixed Mode: Supports SQL Server Authentication in addition to Windows Authentication. When selected, you must provide a strong password for the
saaccount.
Windows Authentication is recommended for the initial exercises. If you select Mixed Mode, store the sa password securely and never use an easily guessed password outside a disposable practice environment. If setup asks you to specify SQL Server administrators, add your current Windows account so that you can administer the instance.
7. Complete setup and check the service
Review the configuration summary and start the installation. After setup finishes, open SQL Server Configuration Manager or the Windows Services application and verify that the relevant SQL Server service is running. If you use a named instance, the SQL Server Browser service can help with some connection scenarios; however, for local work, using the correct instance name or a known port is usually more predictable.
Installing SSMS
1. Download the SSMS package
Download SQL Server Management Studio from Microsoft's official Microsoft Learn installation page. SSMS can connect to supported SQL Server versions such as SQL Server 2019 and SQL Server 2022. SSMS is maintained separately from the Database Engine, so it is possible to use a newer SSMS release to connect to SQL Server 2019.
- Download the SSMS installer.
- Run the setup program and approve administrator permissions.
- Wait for the installation to complete.
- Restart Windows if the installer requests it.
- Open SQL Server Management Studio from the Start menu.
SSMS may display an update notification when it starts. Although the interface can vary between SSMS releases, Object Explorer, the Connect to Server dialog, and Query Editor remain the primary work areas for this course.
Connecting to SQL Server through SSMS
Fields in the connection dialog
When SSMS opens, the Connect to Server dialog appears. Use the following basic values:
| Field | Example value | Purpose |
|---|---|---|
| Server type | Database Engine | Connects to the SQL Server Database Engine. |
| Server name | localhost or localhost\SQLEXPRESS | Depends on the instance selected during setup. |
| Authentication | Windows Authentication | Connects by using the Windows account. |
- Set Server type to Database Engine.
- Enter the server name associated with your installation.
- Select Windows Authentication.
- Click Connect.
- After a successful connection, expand Object Explorer and look for Databases, Security, and Server Objects.
Verify the connection with T-SQL
Click New Query in SSMS and run the following statement:
SELECT @@SERVERNAME AS ServerName,
SERVERPROPERTY('ServerName') AS InstanceName,
SERVERPROPERTY('ProductVersion') AS ProductVersion,
SERVERPROPERTY('Edition') AS Edition,
SYSTEM_USER AS ConnectedUser;
This query displays the server name, instance information, product version, edition, and connected user. SQL Server 2019 uses a 15.x major version number, while SQL Server 2022 uses a 16.x major version number. Compare the result with the edition and version you selected during setup.
You can also list the system databases to confirm access to the Database Engine:
SELECT name, state_desc
FROM sys.databases
ORDER BY name;
Seeing databases such as master, model, msdb, and tempdb indicates that the connection to the Database Engine is working.
Basic Connection Settings and Network Protocols
When SSMS and SQL Server run on the same computer, no additional network configuration is usually required for a local connection. If another computer must connect to the instance, you may need to configure TCP/IP, the listening port, Windows Firewall, and authentication permissions.
In SQL Server Configuration Manager, inspect the protocols under SQL Server Network Configuration for the relevant instance. If TCP/IP is enabled or changed, restarting the SQL Server service may be required. Port 1433 is commonly associated with a default instance, but you should verify the actual configuration rather than assuming that port. Named instances may use dynamic ports.
For the local exercises in this course, do not expose SQL Server to external networks unnecessarily. An Internet-accessible SQL Server instance creates a security risk. First verify the local connection; configure remote access only when necessary and only together with appropriate firewall and authentication controls.
Common Mistakes
- Incorrect server name: A named instance may require
localhost\SQLEXPRESSinstead oflocalhost. - The SQL Server service is stopped: Check the service status in Services or SQL Server Configuration Manager.
- Incorrect authentication choice: If the instance was configured for Windows Authentication, do not select SQL Server Authentication and enter your Windows password.
- SSMS is installed but the Database Engine is missing: SSMS is only the management client; the SQL Server Database Engine must also be installed.
- A forgotten Mixed Mode password: Prefer your Windows account when possible and store administrative credentials securely.
- Testing remote access too early: First test a local connection, then investigate TCP/IP, port, and firewall settings.
- No visible query results: Confirm that the correct query window is active and that the intended statement or selected block was executed.
Short Practice Exercise
Complete the following activity:
- Install SQL Server 2019 or SQL Server 2022 Developer or Express Edition.
- Install SSMS and connect to the Database Engine.
- Observe the server name shown in Object Explorer.
- Run this query:
SELECT DB_NAME() AS CurrentDatabase,
GETDATE() AS ConnectionTime,
@@VERSION AS SqlServerInformation;
- Record the current database and SQL Server product information returned by the query.
- Disconnect and reconnect. Verify that the same Server name and Authentication settings work again.
Optionally, expand the Databases node in Object Explorer and inspect the names of the system databases. You do not need to create a user database yet; that task will be covered in a later lesson.
Conclusion
In this lesson, you learned the basic installation flow for SQL Server 2019/2022 Developer or Express Edition, the difference between the Database Engine and SSMS, the distinction between default and named instances, and how to connect with Windows Authentication. You also verified the server version, edition, connected user, and system databases by using T-SQL queries.
The clearest signs of a successful setup are a running SQL Server service, a functioning SSMS installation, a successful connection with the correct server name, and results returned by a query such as SELECT @@VERSION. In the next lesson, you will use this local environment to explore the SSMS interface, create a database, and perform basic database operations.
Sources
- https://learn.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-installation-wizard-setup?view=sql-server-ver17
- https://learn.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server?view=sql-server-ver16
- https://learn.microsoft.com/en-us/ssms/
- https://learn.microsoft.com/en-us/ssms/quickstarts/ssms-connect-query-sql-server
- https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/configure-client-protocols?view=sql-server-ver17