[英]Mssql login fail ECONNREFUSED 127.0.0.1:1433
while trying to log in using this.. mssql -u sa -p mypassword.i get this error, Error: Failed to connect to localhost:1433 - connect ECONNREFUSED 127.0.0.1:1433 I have installed sql server on docker using this https://www.microsoft.com/en-us/sql-server/developer-get-started/java-mac tutorial and started it. while trying to log in using this.. mssql -u sa -p mypassword.i get this error, Error: Failed to connect to localhost:1433 - connect ECONNREFUSED 127.0.0.1:1433 I have installed sql server on docker using this https: //www.microsoft.com/en-us/sql-server/developer-get-started/java-mac教程并启动它。 I am using mac os sierra.
我正在使用 mac os sierra。 I have searched all over internet including stackoverflow for this but gotten no answer.
我已经在整个互联网上搜索了这个,包括stackoverflow,但没有得到任何答案。 The only answer i get is to enable tcp/ip using sql configuration manager, but mac os doesn't have a configuration manager so I can enable the tcp/ip.
我得到的唯一答案是使用 sql 配置管理器启用 tcp/ip,但是 mac os 没有配置管理器,所以我可以启用 tcp/ip。 Kindly assist.
请协助。
I finally found the solution .. the docker set the memory as 2GB while the MS SQL server requires 3.25GB... All i had to do was go to the Docker preferences and changed the memory to 4GB and it works :).我终于找到了解决方案.. docker 将内存设置为 2GB 而 MS SQL 服务器需要 3.25GB ......我所要做的就是转到 Docker 首选项并将内存更改为 4GB 并且它可以工作:)。 I was using sql server on docker on Mac.
我在 Mac 上的 docker 上使用 sql server。
I'm using docker to set up containers and then sql-cli to access SQL server.我正在使用 docker 来设置容器,然后使用 sql-cli 来访问 SQL 服务器。 This is how I resolved that error which I got after providing
mssql -u sa -p mypassword
.这就是我解决提供
mssql -u sa -p mypassword
后出现的错误的方法。
docker run -d --name Homer -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=myPassw0rd' -p 1433:1433 microsoft/mssql-server-linux
The Terminal doesn't say this and only after going to docker > Kitematic and checking the logs of the just created container I saw such a security warning.终端没有说这个,只有在转到 docker > Kitematic 并检查刚刚创建的容器的日志后,我才看到这样的安全警告。 I deleted that container and created a container with a strong password.
我删除了该容器并创建了一个具有强密码的容器。
mssql -u sa -p mypassword
in the Terminal and start to work, I just go to docker > Kinematic and Start my container.mssql -u sa -p mypassword
并开始工作之前,我只需转到 docker > Kinematic 并启动我的容器。In my case the container exited due to an insecure mssql password.在我的情况下,容器由于不安全的 mssql 密码而退出。 Try reading the container logs.
尝试阅读容器日志。
就我而言,我只需要启动容器。
docker start {container_name}
In my case (I was following this tutorial https://database.guide/how-to-install-sql-server-on-a-mac/ ) the problem was the host address.就我而言(我正在关注本教程https://database.guide/how-to-install-sql-server-on-a-mac/ )问题是主机地址。
I was trying to connect to localhost and I got the ECONNREFUSED message but then I realized that I needed to use the local IP docker assigned to the container (it was something like 192.168.xxx.xxx), so:我试图连接到 localhost 并且我收到了 ECONNREFUSED 消息,但后来我意识到我需要使用分配给容器的本地 IP docker(类似于 192.168.xxx.xxx),所以:
mssql -s 192.168..... -o 1433 -u sa -p 'mypassword' mssql -s 192.168 ..... -o 1433 -u sa -p '我的密码'
finally worded.终于措辞了。
I had the same, in my case I notice that the problem was the PORT, so:我有同样的情况,就我而言,我注意到问题出在端口上,所以:
1)Check if the container is running with 1)检查容器是否正在运行
docker start "container_name"
2)Then, get the correct PORT with: 2)然后,获得正确的端口:
docker ps
3) Run it 3)运行它
mssql -s "PORT" -o 1433 -u sa -p "pwd"
I'm adding this answer to complement Krzysztof Tomasz's answer .我正在添加此答案以补充Krzysztof Tomasz 的答案。
I was following this guide: How to Install SQL Server on a Mac我正在关注本指南:如何在 Mac 上安装 SQL Server
Everything was going well but at the time of connecting to the container with this command:一切都很顺利,但在使用以下命令连接到容器时:
mssql -u sa -p mypass1
I got:我得到:
Error: Failed to connect to localhost:1433 - connect ECONNREFUSED 127.0.0.1:1433
错误:无法连接到 localhost:1433 - 连接 ECONNREFUSED 127.0.0.1:1433
Then I opened Docker app, clicked the container and in the Logs menu I could see the following:然后我打开 Docker 应用程序,单击容器,在日志菜单中我可以看到以下内容:
2020-02-05 16:26:45.71 spid20s ERROR: Unable to set system administrator password: Password validation failed.
2020-02-05 16:26:45.71 spid20s 错误:无法设置系统管理员密码:密码验证失败。 The password does not meet SQL Server password policy requirements because it is too short.
密码不符合 SQL Server 密码策略要求,因为它太短。 The password must be at least 8 characters..
密码必须至少为 8 个字符。
The password I set had only 7 chars.我设置的密码只有 7 个字符。 :o)
:o)
Now this makes sense.现在这是有道理的。
This is also documented @ Microsoft doc here:这也记录在@ Microsoft doc here:
Quickstart: Run SQL Server container images with Docker 快速入门:使用 Docker 运行 SQL Server 容器映像
Solved this problem by removing the container and launching it again...通过删除容器并再次启动它解决了这个问题......
As I only had one container I ran the following command:因为我只有一个容器,所以我运行了以下命令:
docker rm $(docker ps -a -q)
Then launched sql server image again with a stronger password:然后使用更强的密码再次启动 sql server 镜像:
docker run -d --name sql_server_demo -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=MyPass11' -p 1433:1433 microsoft/mssql-server-linux
我通过将端口从 1422 更新到 1433 来解决此问题,我使用 Kitematic 来实现此更新。
我有同样的情况,这是一个 RAM 问题,但是...... 4GB 对我没有帮助,出于某种原因,在我的情况下,我需要 6,然后它起作用了。
Make sure you have started the container in docker.确保你已经在 docker 中启动了容器。
Command to start a container: docker start container "containerName"
启动容器的命令:
docker start container "containerName"
and then try to connect mssql然后尝试连接mssql
I had same problem too, after study the logs with two commands:在使用两个命令研究日志后,我也遇到了同样的问题:
docker ps -a
then然后
docker logs 99373f58f2ff
I understood that problem is related to the password dose not to meet SQL Server password policy.我知道问题与密码不符合 SQL 服务器密码策略有关。 That's is.
那是。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.