SQL Server Database Base notes

Source: Internet
Author: User
Tags mssqlserver

Start and stop SQL Server Three forms of service

    1. Background start service

Services->sql Server (MSSQLSERVER), management---services and applications, computers--right

    1. SQL Server Configuration Manager Startup service

Start-and-install path, configuration tool->sql Server Configuration Manager

    1. To start and stop a service by using commands in the Run window

Windows (Key) +r

Start the SQL Server service: NET start mssqlserver

Stop the SAL Server service: net stop mssqlserver

SQL Server the authentication Mode

    1. There are two types of authentication modes: Windows Authentication and SQL Server Authentication
    2. To configure the authentication Mode (FAQ: 18456,18470) Step:

(1) In Object Explorer, right-click Security, configure authentication Mode

(2) Change the sa login password---Direct search security--Login name->sa-> right-click Properties

(3) Enable SA account, direct seek security, login name,->sa->, right-click Properties, state-enabled

(4) Restart Service, Object Explorer, right-click Restart

Use SQL statement to create a database

Use maste--the database of the operations currently pointed to

GO

CREATE DATABASE E_market

On PRIMARY--primary filegroup

(

Name= ' e_market_data ',--logical file name

--Physical file name

Filename= ' H:\project\E_Market_data.mdf ',

SIZE=5MB,--Initial Size

MAXSIZE=100MB,--Maximum Capacity

filegrowhe=15%--Growth rate

)

Log on--Journal file

(

Name= ' E_market_log ',

Filename= ' H:\project\E_Market_log.ldf ',

SIZE=5MB,

filegrowth=0-Auto-Grow not started

)

GO

SELECT *from sysdatabases--Querying the database

Use SQL statement to delete a database

--Delete a database named E_market

DROP DATABASE E_market

--Check if the database you want to delete exists

IF EXISTS (SELECT * from sysdatabases WHERE name= ' E_market ')

DROP DATABASE E_market

Use SQL statement to create a login and give permissions to a user

--Create Login name

Use master

GO

CREATE LOGIN pbmaster with password= ' 123456 '

GO

--Create a database user

Use E_market

GO

CREATE USER masterdbuser for LOGIN pbmaster

GO

--Give Masterdbuser permissions to view, add, and modify operations

USER E_market

GO

Crant select,insert,update on UserInfo to Masterdbuser

GO

--Recycle Update permissions

USER E_market

GO

REVOKE UPDATE on UserInfo to Masterdbuser

GO

SQL Server Database Base notes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.