Connecting to a Vagrant Box using SSH for FTP and MySQL

Overview:

What this post will go over is how to connect to a FTP and MySQL server using a Vagrant environment provided by a PuPHPet VM.

What You’ll Need:

  1. Vagrant set up on your dev box
  2. A PuPHPet local VM set up (in this example I run CentOS 6.4)
  3. a MySQL database management software (in this example I use MySQL Workbench)
  4. a FTP client (in this example I use FileZilla)

Let’s Get Started!

Depending on your PuPHPet configuration your local VM IP address and MySQL username/passwords may be different.

Connecting to FTP using FileZilla:

  • Host: <Local VM IP Address (set in PuPHPet)>
  • Protocol: SFTP
  • Logon Type: Normal
  • User: vagrant (the default username)
  • Password: vagrant (the default password)
  • Default remote directory: /var/www/html

Connecting to MySQL using MySQL Workbench:

  • Connection Method: Standard TCP/IP over SSH
  • SSH Hostname: <Local VM IP Address (set in PuPHPet)>
  • SSH Username: vagrant (the default username)
  • SSH Password: vagrant (the default password)
  • MySQL Hostname: 127.0.0.1
  • MySQL Server Port: 3306
  • Username: root
  • Password: <MySQL Root Password (set in PuPHPet)>

By default the MySQL Hostname is set to 127.0.0.1, however if you need to find this address in case it is changed in your setup you can SSH into your Vagrant VM and use the following command:

  • cat /etc/my.cnf | grep bind-address
  • If the above file does not exist try:
    cat /etc/mysql/my.cnf | grep bind-address

Special Thanks and More Information:

  • http://scotch.io/tutorials/get-vagrant-up-and-running-in-no-time
  • https://coderwall.com/p/yzwqvg
  • http://www.centos.org/docs/5/html/5.2/Deployment_Guide/s1-server-ports.html
Advertisements

#ftp, #mysql, #puphpet, #vagrant