宅基地错误:SSH命令以非零退出状态响应 [英] Homestead error: The SSH command responded with a non-zero exit status

查看:339
本文介绍了宅基地错误:SSH命令以非零退出状态响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在家用机器上执行homestead up --provision时出现错误:

I get an error when I do homestead up --provision on my homestead machine:

...[success logs here]...
==> default: Running provisioner: shell...
default: Running: /var/folders/9j/bsvhbzdn2dx8hjwgnl7nrj7w0000gn/T/vagrant-
shell20170127-4343-1dyyzgz.sh
==> default: mysql: 
==> default: [Warning] Using a password on the command line interface
 can be insecure.
==> default: Please use --connect-expired-password option or invoke
 mysql in interactive mode.
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

尽管我收到此错误,但除一个错误外,其他一切都正常运行

Although I get this error, everything works fine except one:

我在~/.homestead/Homestead.yaml中定义的数据库不是在mysql中创建的.所以我想这个错误会导致问题.

Databases that I have defined in ~/.homestead/Homestead.yaml are not created in mysql. So I guess this error causes the issue.

任何帮助将不胜感激.

推荐答案

我相信,这实际上是由于MySQL的密码具有有效期,而不是永久存在.当我运行旧的Laravel Homestead 5盒子而不是较新的Homestead 7+盒子时,这似乎发生在我身上.

I believe this is actually due to MySQL having an expiration time on passwords rather than having them last forever. It seems to happen for me when I'm running my old Laravel Homestead 5 box instead of newer ones for Homestead 7+.

请注意,以下解决方案也可以修复ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

Note that the following solution also fixes ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

从主机上:

vagrant up
# ignore "SSH command responded with a non-zero exit status"
vagrant ssh

现在在客户端计算机中:

Now within the client machine:

# log into mysql (for Homestead your password is likely "secret")
mysql -h localhost -u homestead -p

SET PASSWORD = PASSWORD('secret');

-- A) set password to never expire:
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;

-- or B) to change password as well:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password', 'root'@'localhost' PASSWORD EXPIRE NEVER;

-- quit mysql
quit

# exit back to host shell
exit

现在从主机上来

vagrant up --provision

它应该可以工作.

但是,如果现在看到==> default: createdb: database creation failed: ERROR: database "homestead" already exists,请在客户端计算机上运行以下行:

However, if you now see ==> default: createdb: database creation failed: ERROR: database "homestead" already exists then run this line within the client machine:

mysql -h localhost -u homestead -p -e "DROP DATABASE homestead"

然后在主机上运行vagrant up --provision并按您的方式进行.

Then run vagrant up --provision from the host machine and be on your way.

这篇关于宅基地错误:SSH命令以非零退出状态响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆