我的步骤:
1. 启动sql server 服务,正常
2. 打开“MS SQL Server Management Studio”,server type选择的 Database Engine, Authenticaion选择的SQL Server Authentication(这里我也不太明白,安装的时候选的是windows 和SQL Server混合认证方式),用sa连接成功了,打开了SQL Server Management Studio /如果用windows Authentication也能打开。
3. 打下面的命令就连不上了。我就是在服务器端的机器上怎么都连不上本机呢?C:\Documents and Settings\Administrator>osql -U sa -S localhost \MSSQLSERVER
Password:password
[SQL Native Client]SQL Network Interfaces: Connection string is not valid
[87].
[SQL Native Client]Login timeout expired
[SQL Native Client]An error has occurred while establishing a connection to
the server. When connecting to SQL Server 2005, this failure may be caused by
the fact that under the default settings SQL Server does not allow remote
connections.
4. 要执行一个sql文件建一个库和一堆表,
> test_sql.bat localhost\MSSQLSERVER test dbo sa password , 结果也是报上面的错, 连不上数据库。
5. 我尝试过的解决方法有:1.确认了SQL Server采用混合认证模式
                               2. 启用命名管道以及 TCP/IP 协议.
                               3.用windows用户连,并且SQL SERVER的安全—>用户里有BUILTIN\Administrators和<机器名>\Administrator,角色都是sysadmin, user mapping:db_owner&public 结果还是连不上
C:\Documents and Settings\Administrator>osql -U administrator -S localhost\MSSQLSERVER
Password:password
[SQL Native Client]SQL Network Interfaces: Connection string is not valid
[87].
[SQL Native Client]Login timeout expired
[SQL Native Client]An error has occurred while establishing a connection to
the server. When connecting to SQL Server 2005, this failure may be caused by
the fact that under the default settings SQL Server does not allow remote
connections.
我想应该是哪个关键的步骤错了,两种用户都连不上。盼高手指点呀!!!