Ask Your Question
1

How can I run multiple sql scripts when creating a database with the mysql module?

asked 2013-08-14 10:21:48 -0500

getSurreal gravatar image

updated 2013-08-14 16:59:06 -0500

  mysql::db { 'zabbix':
    user  => 'zabbix',
    password => 'zabbix',
    require => service['mysqld'],
    sql => "/usr/share/doc/zabbix-server-mysql-2.0.7/create/schema.sql",
    sql => "/usr/share/doc/zabbix-server-mysql-2.0.7/create/images.sql",
    sql => "/usr/share/doc/zabbix-server-mysql-2.0.7/create/data.sql",
  }
edit retag flag offensive close merge delete

Comments

Which mysql module and version are you using?

GregLarkin gravatar imageGregLarkin ( 2013-08-14 12:22:31 -0500 )edit

I'm using the puppetlabs mysql module.

getSurreal gravatar imagegetSurreal ( 2013-08-14 15:08:12 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-08-14 15:21:35 -0500

bmurts gravatar image

updated 2013-08-14 15:22:16 -0500

I haven't used their module, but you might be able to pass an array to the sql parameter. Example:

database { 'zabbix':
  charset => 'utf8',
  require => service['mysqld'],
  sql     => [ '/usr/share/doc/zabbix-server-mysql-2.0.7/create/schema.sql',
               '/usr/share/doc/zabbix-server-mysql-2.0.7/create/images.sql',
               '/usr/share/doc/zabbix-server-mysql-2.0.7/create/data.sql', ],
}
edit flag offensive delete link more

Comments

i was missing my classes a bit (updated original post to use the correct class), but the array part is what I was looking for. I didn't realize I ...(more)

getSurreal gravatar imagegetSurreal ( 2013-08-14 17:00:52 -0500 )edit

After further testing, this particular class does not work with an array for the sql parameter.

getSurreal gravatar imagegetSurreal ( 2013-08-15 11:09:07 -0500 )edit

Hello did it get to work? because I'm having troubles with it with the provided sql scrpts as an array?

gideonmaina gravatar imagegideonmaina ( 2014-09-21 12:39:51 -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: 2013-08-14 10:21:48 -0500

Seen: 1,906 times

Last updated: Aug 14 '13