In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "sqlserver 2008 installation process and create a database and add user methods," interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's learn how to install sqlserver 2008 and how to create a database and add users.
SQL Server 2008R2 installation
Demo Version [SQL.Server.2008. Enterprise Edition.R2].cn_sql_server_2008_r2_enterprise_x86_x64_ia64_dvd_522233
1. Extract the file to the corresponding directory
2. Run setup.exe with Administrator and click OK
3. Open the SQL Server Installation Center dialog box shown below, select the installation option on the left, and click the option "New SQL Server Standalone Installation or Add Features to Existing Installation" on the right, as shown in the figure:
4. In the opened SQL Server 2008 Installer dialog box, the Installer Support Rules option appears. You can see that some checks have passed. Click OK to proceed to the next step, as shown in the figure:
click OK
5. After clicking OK, a prompt appears to enter the product key. The key I use here is the enterprise version: "GYF 3T-H2 V88-GRPPH-HWRJP-QRTYB". Click Next to continue the installation, as shown in the figure:
6. Select the "I accept the license terms" option on the following license terms page and click the Next button to continue the installation, as shown in the figure:
7. In the installer support files page that appears, click the install button to continue, as shown below:
The installation process is shown below:
After that, the "Installer Support Rules" page appears. Only if the rules are met can the installation continue. Click the Next button to continue the installation, as shown in the figure:
The role settings page appears. Click Next by default:
The function selection page appears, click Select All, set shared directory, click Next:
The instance configuration interface appears. Select the default instance, set the root directory of the instance, and click Next:
Disk requirements screen appears, such as by clicking Next, if not please check disk space:
8 The server configuration interface appears, and settings are made according to specific needs. Here is the default. Click Next:
9. The database engine configuration interface appears, set authentication to mixed mode, enter the database administrator password, namely sa user password (p@ssw0rd), and add the current user, click Next:
10. The Analysis Services configuration page appears, add the current user, and click Next:
The Reporting Services Configuration page appears, and with the default settings, click Next:
Error and Usage Report page appears, select according to your needs, click Next to continue installation:
The installation rules page appears, if all pass, click Next:
The Ready to Install page appears, check the feature options to be installed, click Install:
Installation is underway, as shown below:
Installation complete (takes some time) Click Close:
11. Start SQL Server 2008, select Configuration Tools in Microsoft SQL Server R2 from the Start menu, and click SQL Server Configuration Manager:
12. Finally, start the integration tool provided by Microsoft for us. Open the SQL Server Manager Studio option according to the above figure. Enter the username and password to enter, as shown in the figure:
SQL Server is now complete.
SqlServer Add User Add Role Assignment Permission
--Create a simple login, login name: newlogin; login password: 123456; default database: master, default database can also be unspecified.
EXEC sp_addlogin 'newlogin','123456','master'
--Create user
--Create a simple user. If you don't specify a username, add it to the current database login name. If you don't specify a role, the user defaults to the public role. Add newlogin login name below.
EXEC sp_adduser 'newlogin'
--Create a user with a username. The user can be the same as the login name (similar to the previous one) or different, but to set the current login name, the user role is optional, and the default is public. The following is to add user newuser to the newlogin name.
EXEC sp_adduser 'newlogin','newuser'
--Create a role
EXEC sp_addrole 'newrole'
--Below is adding user newuser to newlogin. And assign the newrole.
EXEC sp_adduser 'newlogin','newuser','newrole'
--Give newrole all permissions on jobs table
GRANT ALL ON jobs TO newrole
--Give newrole permission to query and modify sales table
GRANT SELECT,UPDATE ON sales TO newrole
--Prevent newrole from using insert permissions on employees table
DENY INSERT ON employees TO newrole
Another way to create users and assign roles
--Add security account newuser to database for login newlogin
EXEC sp_grantdbaccess 'newlogin',' newuser'--adds newuser as a member of the role newrole EXEC sp_addrolemember 'newrole','newuser'
--Delete database users, roles, logins
--Delete current database user
EXEC sp_revokedbaccess 'newuser';
--Delete database login
EXEC sp_droplogin 'newlogin'
--Delete database role
EXEC sp_droprole 'newrole'
--Delete user (newuser) from database role (newrole)
EXEC sp_droprolemember 'newrole', 'newuser'
--Create new login and user with SQL code
--Create mylogin login with password, MUST_CHANGE option requires user to change this password when first connecting to server.
CREATE LOGIN mylogin WITH PASSWORD = '123456' MUST_CHANGE;
--Create login names mapped to credentials.
--The following example creates a mylogin login. This login will map to mycredential credentials.
CREATE LOGIN mylogin WITH PASSWORD = '123456',
CREDENTIAL = mycredential;
--Create login from Windows domain account
--If the login is mapped from a Windows domain account, the login must be enclosed in square brackets ([ ]).
CREATE LOGIN [jack\xiangzhao] FROM WINDOWS;
--If a username is specified, the default login name is not used as the database user
CREATE USER myuser FOR LOGIN mylogin
--The following example creates the database role myrole owned by user myuser
CREATE ROLE myrole AUTHORIZATION myuser;
--The following example creates database role myrole owned by db_role fixed database role
CREATE ROLE myrole AUTHORIZATION db_role
create a database
USE [master]
GO
/** **** Object: Database [test] Script Date: 03/08/2019 14:45:36 ******/
CREATE DATABASE [test] ON PRIMARY
( NAME = N'test', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\test.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'test_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\test_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
ALTER DATABASE [test] SET COMPATIBILITY_LEVEL = 100
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [test]. [dbo]. [sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [test] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [test] SET ANSI_NULLS OFF
GO
ALTER DATABASE [test] SET ANSI_PADDING OFF
GO
ALTER DATABASE [test] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [test] SET ARITHABORT OFF
GO
ALTER DATABASE [test] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [test] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [test] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [test] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [test] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [test] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [test] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [test] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [test] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [test] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [test] SET DISABLE_BROKER
GO
ALTER DATABASE [test] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [test] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [test] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [test] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [test] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [test] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [test] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [test] SET READ_WRITE
GO
ALTER DATABASE [test] SET RECOVERY FULL
GO
ALTER DATABASE [test] SET MULTI_USER
GO
ALTER DATABASE [test] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [test] SET DB_CHAINING OFF
GO
EXEC sys.sp_db_vardecimal_storage_format N'test', N'ON'
GO
USE [test]
GO
/** **** Object: Table [dbo]. [test_tab] Script Date: 03/08/2019 14:45:37 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo]. [test_tab](
[name] [nchar](10) NULL,
[id] [int] NULL,
[job] [nchar](10) NULL
) ON [PRIMARY]
GO
At this point, I believe that we have a deeper understanding of the "sqlserver 2008 installation process and methods to create databases and add users," may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.