如何使用
Windows身份验证从命令
提示符连接到
sql Server?
这个命令
- sqlcmd -u username -p password
假设用户名&已设置sql Server的密码
或者,如何从命令提示符设置用户帐户?
我在Windows Server 2008计算机上使用sql Server 2008 Express,如果相关的话.
您可以使用不同的语法来实现不同的东西.如果它是你想要的Windows身份验证,你可以试试这个:
- sqlcmd /S /d -E
如果要使用sql Server身份验证,可以尝试以下操作:
- sqlcmd /S /d -U -P
定义:
- /S = the servername/instance name. Example: Pete's Laptop/sqlSERV
- /d = the database name. Example: Botlek1
- -E = Windows authentication.
- -U = sql Server authentication/user. Example: Pete
- -P = password that belongs to the user. Example: 1234
希望这可以帮助!