Ask Your Question
0

Standalone puppet mysql installation

asked 2015-05-19 06:46:30 -0500

Rajasekar Ramasamy gravatar image

Hi

I am trying to install MySQL in Windows 2008 R2 by using standalone puppet agent. Installation is successful but getting failed while creating db. I am getting dbname from variable. please check my exec statement.

exec { "mysql_create_db":
            command => 'C:\Windows\System32\cmd.exe /c ""C:\Program Files\MySQL\MySQL Server 5.5\bin\mysql.exe" --user=root --password=mysql -e "CREATE DATABASE ${mysql_dbname};""',
              }

I am getting the below syntax error.

Error: Syntax error at 'mysql_dbname'; expected '}' at C:/puppet/modules/my sql_winx64_5528/manifests/init.pp:27 on node win-e91vno72g3v Error: Syntax error at 'mysql_dbname'; expected '}' at C:/puppet/modules/my sql_winx64_5528/manifests/init.pp:27 on node win-e91vno72g3v
edit retag flag offensive close merge delete

Comments

Did you try quoting the variable? "${mysql_dbname}"; ...

far4d gravatar imagefar4d ( 2015-05-19 07:39:39 -0500 )edit

yes, getting the below error Debug: Executing 'C:\Windows\System32\cmd.exe /c ""C:\Program Files\MySQL\MySQL Server 5.5\bin\mysql.exe" --user=root --password=mysql -e "CREATE DATABASE "${my sql_dbname}";""' Notice: /Stage[main]/Mysql_winx64_5528/Exec[mysql_create_db]/returns: ERROR 1064

Rajasekar Ramasamy gravatar imageRajasekar Ramasamy ( 2015-05-19 07:45:09 -0500 )edit

(42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{mysq l_dbname}' at line 1

Rajasekar Ramasamy gravatar imageRajasekar Ramasamy ( 2015-05-19 07:46:35 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-05-20 14:52:01 -0500

souldonut gravatar image

Flip the quotes and double down on the backslashes. Try this:

"C:\Windows\System32\cmd.exe /c 'C:\Program Files\MySQL\MySQL Server 5.5\bin\mysql.exe' --user=root --password=mysql -e 'CREATE DATABASE ${mysql_dbname};'"

edit flag offensive delete link more

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-19 06:46:30 -0500

Seen: 235 times

Last updated: May 19 '15