IDEA中连接SQLserver数据库(DataGrip相同连接)

1. 打开IDEA-database组件

2. 新建SQL server连接

3. 填写信息进行连接
填写连接名称,连接主机IP,端口,默认端口1433,数据库用户名密码,默认数据库用户名是sa
第一次连接需要下载驱动

5. 尝试连接报错,解决TCP/IP连接失败错误
通过端口 1433 连接到主机 localhost 的 TCP/IP 连接失败

解决方案
打开SQL server的配置管理

选择MSSQLSERVER的协议

将右侧TCP/IP改为已启用


然后重新启动MSSQLSERVER服务

右键重新启动

6. 然后再进行Test Connection测试
出现Succeeded便连接成功

默认数据库是master
