我使用 Puppet 的 mySQL 模块来像这样调出它。
工作站ip为172.16.1.49,JIRA(mySQL)VM为172.16.1.47(Puppet Master为172.16.1.80);
我正在尝试从工作站 172.16.1.49(因此授权中的@172.16.1.49)使用 Workbench mySQL 客户端工具访问 mySQL 服务器。
通常,如果我可以在浏览器上查看 htp:/172.16.1.47:3306,我就知道我可以远程访问。在 mySQL VM 上,如果我执行 htp:/localhost:3306,我会看到一些消息,这意味着我可以访问 mySQL 服务器。但 htp:/172.16.1.47:3306 本身也不起作用。
我的 Puppet for mySQL 代码到底在哪里,我搞错了吗?我认为在我的 Puppet 代码的某个地方,我不允许 mySQL 服务器允许远程访问。
class { '::mysql::server':
root_password => 'secret',
remove_default_accounts => true,
override_options => $override_options
}
::mysql::db { 'mydb':
user => 'jira',
password => 'secret',
dbname => 'jiraDB',
host => 'localhost',
}
mysql_grant { 'jira@localhost/*.*':
ensure => 'present',
options => ['GRANT'],
privileges => ['ALL'],
table => '*.*',
user => 'jira@localhost' ,
}
mysql_grant { '[email protected]/*.*':
ensure => 'present',
options => ['GRANT'],
privileges => ['ALL'],
table => '*.*',
user => '[email protected]' ,
}
mysql_grant { '[email protected]/*.*':
ensure => 'present',
options => ['GRANT'],
privileges => ['ALL'],
table => '*.*',
user => '[email protected]' ,
}
答案1
尝试
node 'your hostname' { class {'mysql::server':} }
class mysql::server {
package { "mysql-server": ensure => installed }
package { "mysql": ensure => installed }
service { "mysqld":
enable => true,
ensure => running,
require => Package["mysql-server"],
}
file { "/var/lib/mysql/my.cnf":
owner => "mysql", group => "mysql",
source => "puppet:///mounted-storage/my.cnf",
notify => Service["mysqld"],
require => Package["mysql-server"],
}
file { "/etc/my.cnf":
require => File["/var/lib/mysql/my.cnf"],
ensure => "/var/lib/mysql/my.cnf",
}
}