I have a vagrant file using puppet to configure mysql.

Here is the relevant code in default.pp:

class { '::mysql::server':
  override_options => { 'mysqld' => { 'bind_address' => '' } },

  grants => {
    '[email protected]/*.*' => {
      ensure     => 'present',
      options    => ['GRANT'],
      privileges => ['ALL'],
      table      => '*.*',
      user       => '[email protected]',

This works, but from the host machine (not the VM) I can only access mysql via and I want to be able to access via localhost (the default for the mysql client).

So my questions are: 1) what is the significance of ( copied and pasted this from an example) 2) how do I configure the mysql install on the VM to be accessible from the host OS (mac) as

mysql -u root -h localhost

I should also note that I tried changing [email protected] to root@localhost and this did not work.

thanks! phil

2 Answers 2

  1. is probably the virtual IP address of the guest OS instance using VirtualBox 'HostOnly' networking.

You should be able to connect to the mysql server in the guest instance using

mysql -u root -h
  1. "localhost" has a special meaning with MySQL, it causes clients to try to connect via Unix Domain Sockets instead of TCP. So it tries to connect using a socket file, usually either /tmp/mysql.sock or /var/run/mysql/mysql.sock, and these are special files only accessible locally to processes on the same operating system instance.

Your VM is a different OS instance though, and so your mysql client on the host OS can't access domain socket files on the guest OS.

0 means for which remote IP you grant access to user, by studying vagrant puphpet template vagrant/puphpet/puphpet/nodes/Mysql.pp you can see template definition manifesto, ruby code:

  each( $grants ) |$key, $grant| {
    # if no host passed with username, default to localhost
    if '@' in $grant['user'] {
      $user = $grant['user']
    } else {
      $user = "${grant['user']}@localhost"

therefore user must by yaml puphpet configured like

         user: dbuser@%

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .