Ask Your Question
0

mySQL - code brainstorming

asked 2015-05-21 13:58:41 -0500

pup-master gravatar image

updated 2015-05-21 14:46:30 -0500

In the process of brainstorming pp(s) for mySQL deployment that allows workbench access and other things. Any ideas or suggestion are very welcomed. (based on https://forge.puppetlabs.com/puppetla...)

[site.pp]

node 'jira.oracle' {include sqclass }

[init.pp]

class sqclass {

    class { '::mysql::server':
      root_password           => 'secret',
          override_options => { 'mysqld' => { 'max_connections' => '1024' } }
      }


    mysql::db { 'jiraDB':
      user     => 'jira',
      password => 'secret',
      host     => 'localhost',
                }



    mysql_grant { 'jira@localhost/*.*':
          ensure     => 'present',
          options    => ['GRANT'],
          privileges => ['ALL'],
          table      => '*.*',
          user       => 'jira@localhost' ,
        }

    mysql_grant { 'root@localhost/*.*':
          ensure     => 'present',
          options    => ['GRANT'],
          privileges => ['ALL'],
          table      => '*.*',
          user       => 'root@localhost' ,
        }


    mysql_user { 'root@10.213.9.215':
      ensure                   => 'present',
      max_connections_per_hour => '0',
      max_queries_per_hour     => '0',
      max_updates_per_hour     => '0',
      max_user_connections     => '0',
    }

        mysql_grant { 'jira@10.213.9.215/*.*':
             ensure     => 'present',
             options    => ['GRANT'],
             privileges => ['ALL'],
             table      => '*.*',
             user       => 'jira@10.213.9.215' ,
            }


         mysql_grant { 'root@10.213.9.215/*.*':
             ensure     => 'present',
             options    => ['GRANT'],
             privileges => ['ALL'],
             table      => '*.*',
             user       => 'root@10.213.9.215' ,
            }
     }

results in below, but I must be still missing something:

jira ~]$ mysql -h localhost -u jira --password=secret jiraDB
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 33
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>


jira ~]$ mysql -h 10.213.9.157 -u jira --password=secret jiraDB
ERROR 2003 (HY000): Can't connect to MySQL server on '10.213.9.157' (111)

[UPDATE: Changing /etc/my.cnf as below allows remote access. But how via puppet?]

[mysqld]

    #bind-address = 127.0.0.1
    #skip-external-locking 
    skip-grant-tables # saves having to grant extra permissions




[h@jira ~]$ mysql -h 10.213.9.157 -u jira --password=secret jiraDB
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2015-05-21 15:47:58 -0500

Hypnoz gravatar image

in mysql/manifests/params.pp I see this code (line 345):

'mysqld'                  => {
  'basedir'               => $mysql::params::basedir,
  'bind-address'          => '127.0.0.1',
  ...

I think you would have to change the "bind-address => 127.0.0.1" to "bind-address => $mysql::params::bindaddress", set that variable at the top of the file to to a param lookup like the other, and add more code so you can override that value and it uses it when it builds the my.cnf file.

You're right, commenting out "bind-address 127.0.0.1" in my.cnf is the first thing most people do for their DB, so if the module doesn't support this I would be totally baffled.

edit flag offensive delete link more

Comments

thanks your time but I'm a total newb, where in my pp files can I specify to do what you are implying here?

pup-master gravatar imagepup-master ( 2015-05-21 17:33:52 -0500 )edit

would you happen to know how to set $override_options to insert "skip-grant-tables" ?

pup-master gravatar imagepup-master ( 2015-05-22 13:59:31 -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-05-21 13:58:41 -0500

Seen: 224 times

Last updated: May 21 '15