I am trying to setup port forwarding in Vagrantfile to connect to guest mysqld from host system, but get reading initial communication packet error.
Host: Yosem         
        
Personally I don't bother with modifying MySQL for development Vagrant boxes - it's time consuming and difficult to script in a provisioner meaning you have to do it by hand every time you vagrany destroy or a new developer starts contributing. Instead, I connect via SSH Tunnel which is made super easy using Vagrant's generated private_key file. No additional post-install tweaking necessary.
Follow these steps to SSH Tunnel with SequelPro, MySql Workbench, or any other client that supports SSH connectivity:
127.0.0.1 (more predictable cross-os)root and the password is defined/created in the provisioner (see snippet below)Vagrantprivate_key for the Vagrant machine instead, located in .vagrant/machines/default/virtualbox in the root of your VM project; note that on most OS's this directory, and all starting with a . are hiddenTo automate installation and root password creation, add this to your Vagrant provisioner script file (config.vm.provision in Vagrantfile), commonly named provisioner.sh:
debconf-set-selections <<< 'mysql-server mysql-server/root_password password SuperSecretPasswordHere'
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password SuperSecretPasswordHere'
apt-get install -y mysql-server
Hope this helps save someone else some time!