AWS MS SQL 创建 table
AWS MS SQL create table
我已经按照本指南创建了一个 AWS MS SQL 数据库
我可以连接到它并使用命令
Select @@VERSION
但是,当我尝试创建 table 时,出现错误
Msg 262, Level 14, State 1, Line 1 CREATE TABLE permission denied in
database 'master'.
而我尝试的命令是
CREATE TABLE [RawInput] (
[DateTime] datetime,
[Text] text,
PRIMARY KEY ([DateTime])
);
将下面的 "YOUR_DATABASE_NAME" 替换为您的数据库名称。
USE [YOUR_DATABASE_NAME]
CREATE TABLE [RawInput] (
[DateTime] datetime,
[Text] text,
PRIMARY KEY ([DateTime])
);
我现在已经修复了它。
我遵循的教程没有显示所有必要的步骤。我在下面汇总了我经历的所有步骤的列表:
1) 下载并安装 Visual Studio 的 AWS 工具包。
https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/setup.html#install
2) 要使用 Visual Studio 登录 AWS,您需要创建 AWS 凭证
转到 AWS 控制台面板并进入 Services/IAM/Users - 并添加新用户
3) 新创建的凭据将提供给 Visual Studio。
https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/credentials.html
4) 现在可以创建数据库
https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/rds-launch-instance-sql.html
5) 数据库现已准备就绪,可以执行命令来创建表。
在这里,重要的是您要使用 USE [INSER_NAME_OF_DATABSE]
关键字指定要写入的数据库。否则它会尝试写信给Master。
分辨率:
USE [YOUR_DATABASE]
原因
什么是master
数据库:
The master database records all the system-level information for a SQL
Server system. This includes instance-wide metadata such as logon
accounts, endpoints, linked servers, and system configuration
settings. In SQL Server, system objects are no longer stored in the
master database; instead, they are stored in the Resource database.
Also, master is the database that records the existence of all other
databases and the location of those database files and records the
initialization information for SQL Server. Therefore, SQL Server
cannot start if the master database is unavailable.
任何用户级别的查询都不能 运行 使用 master
数据库,因为它会跟踪所有其他数据库
我已经按照本指南创建了一个 AWS MS SQL 数据库
我可以连接到它并使用命令
Select @@VERSION
但是,当我尝试创建 table 时,出现错误
Msg 262, Level 14, State 1, Line 1 CREATE TABLE permission denied in database 'master'.
而我尝试的命令是
CREATE TABLE [RawInput] (
[DateTime] datetime,
[Text] text,
PRIMARY KEY ([DateTime])
);
将下面的 "YOUR_DATABASE_NAME" 替换为您的数据库名称。
USE [YOUR_DATABASE_NAME]
CREATE TABLE [RawInput] (
[DateTime] datetime,
[Text] text,
PRIMARY KEY ([DateTime])
);
我现在已经修复了它。
我遵循的教程没有显示所有必要的步骤。我在下面汇总了我经历的所有步骤的列表:
1) 下载并安装 Visual Studio 的 AWS 工具包。 https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/setup.html#install
2) 要使用 Visual Studio 登录 AWS,您需要创建 AWS 凭证 转到 AWS 控制台面板并进入 Services/IAM/Users - 并添加新用户
3) 新创建的凭据将提供给 Visual Studio。 https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/credentials.html
4) 现在可以创建数据库 https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/rds-launch-instance-sql.html
5) 数据库现已准备就绪,可以执行命令来创建表。
在这里,重要的是您要使用 USE [INSER_NAME_OF_DATABSE]
关键字指定要写入的数据库。否则它会尝试写信给Master。
分辨率:
USE [YOUR_DATABASE]
原因
什么是master
数据库:
The master database records all the system-level information for a SQL Server system. This includes instance-wide metadata such as logon accounts, endpoints, linked servers, and system configuration settings. In SQL Server, system objects are no longer stored in the master database; instead, they are stored in the Resource database. Also, master is the database that records the existence of all other databases and the location of those database files and records the initialization information for SQL Server. Therefore, SQL Server cannot start if the master database is unavailable.
任何用户级别的查询都不能 运行 使用 master
数据库,因为它会跟踪所有其他数据库