简体   繁体   English

连接MySQL数据库与VirtualBox Vagrant?

[英]Connecting Mysql database with VirtualBox Vagrant?

I installed Ubuntu on Virtual-box with Vagrant, and Virtual Machine is running on Windows. 我在带有Vagrant的Virtual-box上安装了Ubuntu,并且Virtual Machine正在Windows上运行。 I'm running my application on Ubuntu through vagrant. 我正在通过流浪汉在Ubuntu上运行我的应用程序。

Now I want database for my application, and trying to connect MySQL Workbench with SSH Host. 现在,我要为应用程序提供数据库,并尝试将MySQL Workbench与SSH主机连接。 But workbench is continuously giving error on Authentication. 但是工作台不断地在身份验证上出错。

When i logged in through virtual-box the login credentials i given worked absolutely fine. 当我通过virtual-box登录时,我给出的登录凭据绝对正常。

在此处输入图片说明

And on same credential workbench is giving error. 并且在同一凭证工作台上出错。

在此处输入图片说明

Now What i did is changed my SSH Hostname : 127.0.0.1:2222 as identified in Bash : 现在我所做的就是更改了Bash中标识的SSH主机名:127.0.0.1:2222:

在此处输入图片说明

在此处输入图片说明

Now i'm getting this error. 现在我收到此错误。

I'm doing blunders in making connection, but couldn't locate from where i went wrong. 我在建立连接时犯了大错,但找不到我出问题的地方。 Please help me setting up database for my application. 请帮助我为我的应用程序设置数据库。

Can someone help me? 有人能帮我吗? Thanks 谢谢

When you do vagrant up notice a line like this: 当您vagrant up注意以下内容:

default: 22 (guest) => 2222 (host) (adapter 1)

This means port 22 (SSH port) of guest is mapped to port 2222 on host. 这意味着guest虚拟机的端口22(SSH端口)已映射到主机上的端口2222。 So when accessing with normal SSH command you need to access port 2222 on host. 因此,使用普通的SSH命令访问时,您需要访问主机上的端口2222。

ssh vagrant@127.0.0.1 -p 2222

Change the port to 2222 in SSH hostname and you should be fine. 在SSH主机名中将端口更改为2222,应该没问题。

SSH hostname: 127.0.0.1:2222

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM