如何将用户名和密码放入我的数据库mydb
,以便我可以将其用于我的连接?就像在MySQL中一样,我们指定username = 'root' password = 'root'
。
我正在使用SQL Server 2014 Express。
答案 0 :(得分:1)
CREATE LOGIN server_user WITH PASSWORD = '123456789';
GO
USE MYDB;
GO
CREATE USER [server_user] FOR LOGIN [server_user]
GO
ALTER USER [server_user] WITH DEFAULT_SCHEMA=[dbo]
GO
ALTER ROLE [db_datareader] ADD MEMBER [server_user]
GO
ALTER ROLE [db_datawriter] ADD MEMBER [server_user]
GO
GRANT EXECUTE ON SCHEMA::[dbo] TO [server_user]
GO