Ask Your Question
0

puppet-mysql grant with no password

asked 2015-09-11 11:37:51 -0500

b gravatar image

updated 2015-09-14 05:36:46 -0500

I have the following setup to create a database, user and grant remote access:

mysql::db { 'my_db':
  user     => 'my_user',
  password => 'mystrongpassword',
  host     => 'localhost',
  grant    => ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
}

mysql_user { 'my_user@%':
  ensure        => 'present',
  password_hash => mysql_password('mystrongpassword'),
}

mysql_grant { 'my_user@%/my_db.*':
  ensure     => 'present',
  options    => ['GRANT'],
  privileges => ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
  table      => 'my_db.*',
  user       => 'my_user@%',
}

This all sets up fine, except that my_user doesn't require a password when connecting from a remote host.

e.g. mysql server:

mysql -u my_user -p my_db (works - OK)
mysql -u my_user my_db (access denied - OK)

remote server:

mysql -h mysql-server -u my_user -p my_db (access denied - BAD)
mysql -h mysql-server -u my_user mydb (works - BAD)

how do I set the grant that it requires a password/identified by from the remote host?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-09-12 09:21:40 -0500

Hi,

You have to declare the

mysql_user { 'user@%':
  ensure             => 'present',
  password_hash => mysql_password('password'),
}

resource first (replace password with yours)

Cheers

edit flag offensive delete link more

Comments

Hi, I have added this in (see above) but this has not solved the issue. Thanks.

b gravatar imageb ( 2015-09-14 05:37:23 -0500 )edit

Update: it is only % that it doesn't seem to work for. If I specify an IP eg. my_user@10.0.0.1 it works. Thanks

b gravatar imageb ( 2015-09-14 05:47:26 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-09-11 11:37:51 -0500

Seen: 157 times

Last updated: Sep 14 '15