SQL Server Community Edition service instance deployment

更新时间:
复制 MD 格式

Overview

SQL Server is a relational database management system (DBMS) developed and maintained by Microsoft. It is widely used by enterprises and organizations for data storage and management.

Deployment

  1. Go to the Compute Nest SQL Server Community Edition deployment link. On the Create Service Instance page in the Compute Nest console, specify a service instance name, select a region such as China (Hangzhou), and choose a billing method (pay-as-you-go or subscription). Configure other parameters, including instance type, instance password, Enable public IP address, operating system type, database configuration, and zone configuration. The configuration list on the right shows the real-time status of each parameter.

  2. After you configure the parameters, the pricing details appear. Review your settings and click Next: Confirm Order.

  3. On the order confirmation page, agree to the terms of service and click Create Now to start the deployment.

  4. Wait for the deployment to complete. The status of the service instance changes to Deployed. On the Overview tab for the service instance, find the public and internal endpoints in the Use Now section to connect to your database.

Usage

Connect to SQL Server (Windows)

  1. Use Workbench to log on to the Windows instance via RDP.

  2. In the search bar in the lower-left corner, enter ssms.

  3. Click Microsoft SQL Server Management Studio 18.

  4. In the Connect to Server dialog box, enter the server connection information and click Connect.

Connect to SQL Server (Linux) and disable the sa account

To improve security, create a new account and disable the 'sa' account after your initial logon.

  1. Connect remotely to the ECS instance. For the initial logon to SQL Server, use the 'sa' account:

    docker exec -it sqlserver /opt/mssql-tools18/bin/sqlcmd -No -S localhost -U sa

    Parameter description:

    -S: Specifies the server name or IP address.

    -U: Specifies the username.

  2. Create a new login.

    CREATE LOGIN <YOUR_USER> WITH PASSWORD = '<YOUR_PASSWORD>';

    Replace <YOUR_USER> with the new username.

    Replace <YOUR_PASSWORD> with the password for the new user.

    Run 'GO' to execute the statement.

    GO
  3. Grant the sysadmin role to the new user.

    ALTER SERVER ROLE sysadmin ADD MEMBER <YOUR_USER>;

    Run 'GO' to execute the statement.

    GO
  4. Disable the 'sa' account.

    ALTER LOGIN sa DISABLE;

    Run 'GO' to execute the statement.

    GO
  5. Verify the changes.

    SELECT name, is_disabled FROM sys.server_principals WHERE name IN ('sa', '<YOUR_USER>');

    Run 'GO' to execute the statement.

    GO

    The following sample output shows the result for a user named 'admin'. A value of 1 for 'is_disabled' indicates that the 'sa' account is disabled, while 0 indicates that it is enabled.

    1> SELECT name, is_disabled FROM sys.server_principals WHERE name IN ('sa', 'admin');
    2> GO
    name                                                                                                                            is_disabled
    -------------------------------------------------------------------------------------------------------------------------------- -----------
    sa                                                                                                                                        1
    admin                                                                                                                                     0

For more information, see the SQL Server official documentation.