怎么server 2008 远程连接接sqlserver2008

我不会抽烟 的BLOG
用户名:我不会抽烟
文章数:78
评论数:106
访问量:60991
注册日期:
阅读量:5863
阅读量:12276
阅读量:372246
阅读量:1066151
51CTO推荐博文
最近在做一个小项目玩,需要让同事可以访问我电脑下的数据库,所以必须设置我的数据库远程可以访问,费了一番周折,最后搞定,在这里分享一下经验。我的环境是64位,win7系统,数据库则是SQL SERVER2008版本。下面我们开始,我手把手教你~首先网上的教程多是修改本地的sa用户账号,但是我的sa账号有点问题,修改密码的时候会出现下面的提示错误通过一些其他的方法我也没能解决这个问题,但是我们也可以不使用sa账号,那么,我们就需要重新创建一个账号,下面跟我走1、首先打开SQL SERVER 2008,即SQL Server Management Studio2、用windows身份连接数据库,然后右键点击数据库【属性】3、左边的选择页点击【安全性】,右边选中【SQL Server和Windows身份验证模式】4、左边的选择页点击【连接】,右边选中【允许远程连接到此服务器】,然后点击【确定】5、接着在左边的对象资源管理器中右键点击【安全性】-【新建】-【登录】6、左边选择页选择【常规】,右边写一个【登录名】,选择【SQL Server身份验证】项,填写密码,选择【强制实施密码策略】这里要注意一点的是,填写的密码必须稍稍复杂,否则会出现下面错误提示你写的密码强度最好能像这样,例:Uiop_098Mn,狗血吧,哈哈7、如果你只想你本地上的某一个或几个数据库供其他局域网机器连接,那么左边选择页选择【用户映射】,右边选择你想共享的数据库名,下面要勾选【db_owner】【public】两项。如果你就是想分享你的全部数据库,那么可以跳过此步。8、接着左边选择【状态】,右边从上到下依次选择【授予】【启用】,之后点击【确定】9、接着点击数据库右键【方面】10、方面项选择【服务器配置】,方面属性项将【RemoteAccessEnabled】置为true到此为止,你就可以利用刚刚新建的账号去登录SQL Server了,不过还没有完下面请打开【SQL Server配置管理器】650) this.width=650;" src="/wyfs02/M00/23/2D/wKioL1Mz1oGACxs8AAE1Y_Wedkw043.jpg" title="QQ截图16.png" alt="wKioL1Mz1oGACxs8AAE1Y_Wedkw043.jpg" />1、保持图中三项为【正在运行】状态2、选择【SQL Server网络配置】下的【MSSQLSERVER的协议】,将【TCP/IP】置为已启用。3、接着切换到【IP地址】分页,将IPAll中的TCP端口设成‘1433’4、选择【SQL Native Client配置】下的【客户端协议】,将【TCP/IP】置为已启用。OK,又完成了一部分的设置最后我们还需要对防火墙做些操作1、打开防火墙2、关掉所有防火墙3、然后我们还需要手动添加远程访问列表4、点击【允许运行另一程序】5、通过浏览,找到本地的sqlserver.exe文件,举例路径(C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Binn\sqlservr.exe),这个需要根据你自己本地的情况去选择。很好找最后将你找到的sqlserver.exe添加进防火墙允许列表就OK了。之后我跑到了同事的电脑上,服务器名称输入了我电脑的IP地址,选择【SQL Server身份验证】,输入上刚刚新建的用户名和密码,点击【连接】就OK啦这真是手把手教程,如果你还是没有成功,一定要告诉我~本文出自 “” 博客,请务必保留此出处
了这篇文章
类别:┆阅读(0)┆评论(0)
16:51:59 17:09:24 15:35:32&&新的Sharepoint服务器上的SQL SERVER2008数据库实例需要启用远程访问,在此做个笔记以便以后查阅。&通常如果我们没有启动远程访问服务,我们会遇到"Cannot connect to SQL-Server-Instance-Name"错误提示信息:& 错误信息的具体内容可能为&
&<span style="color: #.An&error&has&occurred&while&establishing&a&connection&to&the&server.&When&connecting&to&SQL&Server&<span style="color: #08,&this&failure&may&be&caused&by&the&fact&that&under&the&default&settings&SQL&Server&does&not&allow&remote&connections.&(provider:&SQL&Network&Interfaces,&error:&<span style="color: #&&#8211;&Server&doesn&#8217;t&support&requested&protocol)&(Microsoft&SQL&Server)&#8221;&&<span style="color: #.An&error&has&occurred&while&establishing&a&connection&to&the&server.&When&connecting&to&SQL&Server&<span style="color: #08,&this&failure&may&be&caused&by&the&fact&that&under&the&default&settings&SQL&Server&does&not&allow&remote&connections.&(provider:&SQL&Network&Interfaces,&error:&<span style="color: #&&#8211;&Error&Locating&Server/Instance&Specified)&(Microsoft&SQL&Server)&#8221;&<span style="color: #.Login&failed&for&user&&#8216;username&#8216;.&(Microsoft&SQL&Server,&Error:&<span style="color: #456)&#8221;
& 为了打开SQL SERVER2008的远程服务,我们通常需要下面四个步骤&1. 开启SQL Server Browser service,此服务是用于侦听远程来访的服务请求并提供SQL SERVER实例信息。&2. 打开TCP/IP protocol for SQL Server 2008,以便于远程来访&3.(可选项)把Server Authentication 的方式改为 SQL Server and Windows Authentication. 如果你需要特定的用户连接到SQL Server,你就必须要修改此处的设置。&4.开启SQL Server2008以及服务器防火墙的1433端口.
& 具体操作步骤A.开启SQL Server Browser serviceStep 1. 启动SQL Server Configuration Manager。在操作系统桌面上点击 Start -& Programs -& Microsoft SQL Server 2008 -& Configuration Tools -& SQL Server Configuration Manager.
Step 2. 在SQL Server Configuration Manager中, 选中左侧的 SQL Server Services.在其中选中 SQL Server Browser,如果它没启动,则启动它。如果已经启动,则直接进入第Step 6.
Step 3. 双击 SQL Server Browser, 会跳出其 Properties 窗口. 选择一个帐号来启动SQL Server Browser Service. 此例中,我设置的是Local Service account.
Step 4.在SQL Server Browser的属性窗口, 进入 Service 选卡,更改Start Mode 为 Automatic. 这样,当服务器重新启动时,就会自动启动此服务。点击 OK使更改生效。
& 我们也可以通过修改注册表来实现此目标,具体的操作方法是:&将HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SQLBrowser\Start值4修改为2(即设置为自动启动),重启服务器后就会自动启动。
Step 5. 回到SQL Server Configuration Manager,右击右边窗口中的SQL Server Bowser,在弹出的菜单中选择Start,以启动此服务。
Step 6.在SQL Server Configuration Manager的左侧窗口,展开 SQL Server Network Configuration -& Protocols for SQLEXPRESS. 你会发现TCP/IP protocol的当前状态是disable的。
B. 打开TCP/IP protocol for SQL Server 2008Step 7.右击TCP/IP,在此更改其状态为Enable.
Step 8.你会看到一个弹出信息窗口,要求你重启SQL Service以使更改生效。
Step 9.在SQL Server Configuration Manager的左侧窗口, 选择 SQL Server Services. 然后在右侧窗口中选中 SQL Server (SQLEXPRESS),右击选项,在弹出菜单中 Restart.这样SQL Server service就重启了。
C.(可选项)把Server Authentication 的方式改为 SQL Server and Windows AuthenticationStep 10. 打开 Microsoft SQL Server Management Studio 并连接到SQL Server 2008实例,进入其Property设置,在其Security设置下修改Authentication mode。然后,照上方法重启SQL Service服务。
也可以参见我的另一短文
D.开启SQL Server2008以及服务器防火墙的1433端口.&开启SQL Server端口操作步骤如下:&在操作系统桌面上All Programs -& Microsoft SQL Server 2008 -& Configuration Tools -& SQL Server Configuration Manager--展开SQL Server Netwoek Configuration--&选中 Protocol for MSSQLSERVER-- 选择它的TCP/IP属性项--&右击在弹出菜单中选择Property进入TCP/IP的属性设置,依下面内容进行设置:IP1=& Active=Yes, Enabled=Yes,IP Address =&machine ip address&, TCP Dynamic Port=Empty, TCP Port=1433IP2=& Active=Yes, Enabled=Yes,IP Address =127.0.0.1, TCP Dynamic Port=Empty, TCP Port=1433IP3=& TCP Dynamic Port=Empty, TCP Port=1433设置完成后,仍按上面方法重启SQL Server Service在Windows Server2008中开启防火墙的1433端口方法如下:
网上也有用脚本来实现开启指定端口的,方法是在服务器上建一个OpenServerPort.bat,直接运行此批处理文件就行了。其脚本内容如下:
@echo&=========&&SQL&Server&Ports&&===================@echo&Enabling&SQLServer&default&instance&port&<span style="color: #33netsh&firewall&set&portopening&TCP&<span style="color: #33&"SQLServer"&@echo&Enabling&Dedicated&Admin&Connection&port&<span style="color: #34netsh&firewall&set&portopening&TCP&<span style="color: #34&"SQL&Admin&Connection"&@echo&Enabling&conventional&SQL&Server&Service&Broker&port&<span style="color: #22&&netsh&firewall&set&portopening&TCP&<span style="color: #22&"SQL&Service&Broker"&@echo&Enabling&Transact-SQL&Debugger/RPC&port&<span style="color: #5&netsh&firewall&set&portopening&TCP&<span style="color: #5&"SQL&Debugger/RPC"&@echo&=========&&Analysis&Services&Ports&&==============@echo&Enabling&SSAS&Default&Instance&port&<span style="color: #83netsh&firewall&set&portopening&TCP&<span style="color: #83&"Analysis&Services"&@echo&Enabling&SQL&Server&Browser&Service&port&<span style="color: #82netsh&firewall&set&portopening&TCP&<span style="color: #82&"SQL&Browser"&@echo&=========&&Misc&Applications&&==============@echo&Enabling&HTTP&port&<span style="color: #&netsh&firewall&set&portopening&TCP&<span style="color: #&"HTTP"&@echo&Enabling&SSL&port&<span style="color: #3netsh&firewall&set&portopening&TCP&<span style="color: #3&"SSL"&@echo&Enabling&port&for&SQL&Server&Browser&Service's&'Browse'&Buttonnetsh&firewall&set&portopening&UDP&<span style="color: #34&"SQL&Browser"&@echo&Allowing&multicast&broadcast&response&on&UDP&(Browser&Service&Enumerations&OK)netsh&firewall&set&multicastbroadcastresponse&ENABLE&
阅读(...) 评论()

我要回帖

更多关于 php远程连接sqlserver 的文章

 

随机推荐