Start and stop SQL Server Three forms of service
- Background start service
Services->sql Server (MSSQLSERVER), management---services and applications, computers--right
- SQL Server Configuration Manager Startup service
Start-and-install path, configuration tool->sql Server Configuration Manager
- 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
- There are two types of authentication modes: Windows Authentication and SQL Server Authentication
- 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