问题
I am using a free azure subscription, have set up an SQL server (v12) and created a database onto it.
However i cant seem to log in using the server admin credentials that i set when prompted during the SQL server credentials.
Management Studio returns:
Cannot connect to <server name>...Login failed for user 'mickey'
SQLCMD -S <servername>.database.windows.net -U mickey@servername -P pass -q "select 1"
Returns
Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : Login failed for user '
Is there something i am missing? Been at this for hours
回答1:
On SQL Server Management Studio, could you please check if you have SQL Server Authentication or Windows Authentication in the 'Connect to Server' dialog box? The connection to Azure SQL DB works with 'SQL Server Authentication' only.
Also on SQLCMD, please try the command without spaces between the parameter indicators and values. For example:
SQLCMD -Sin4live.database.windows.net -Umickey@servername -Ppass
rather than
SQLCMD -S in4live.database.windows.net -U mickey@servername -P pass
回答2:
It could be the password contains a few special characters that sqlcmd does not handle (such as dollar, single or double quote, parentheses). I tried using the Azure interface and surrounding the password with single-quotes (we had a dollar-sign in the password), but that did not work. So, we simply removed the special character and now it is OK. see: Powershell Invoke-Sqlcmd Login Failed and https://mohitgoyal.co/2017/08/09/vsts-azure-sql-database-deployment-task-keeps-failing-with-error-login-failed-for-user/
回答3:
It was actually a password issue, reset it from a different laptop and it worked.Could be a keyboard issue. Have had this with my godaddy password reset too
来源:https://stackoverflow.com/questions/39035464/azure-sql-login-failed-for-user