mysql 安装损坏,使 mysql 无法卸载
mysql corrupted installation, makes mysql uninstallabe
OS - Ubuntu 20.04.2 LTS
任务 - 创建 puppet 清单,这将生成 apache2-zabbix 页面。
$var = ['apache2','libapache2-mod-php','php7.4-mysql','php-mysql','php','php-mbstring','php-gd','php-xml','php-bcmath','php-ldap','php-mysql']
package { $var:
ensure => installed,
}
wget::fetch { "download zabbix":
source => 'https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+bionic_all.deb',
destination => '/root/',
timeout => 0,
verbose => false,
}
package { "puppet-dashboard":
provider => dpkg,
ensure => latest,
source => "/root/zabbix-release_4.0-2+bionic_all.deb"
}
$var3 = ['zabbix-server-mysql','zabbix-frontend-php']
package { $var3 :
ensure => installed,
}
mysql::db { 'zabbix':
user => 'myuser',
password => 'mypass',
host => 'localhost',
sql => '/root/zabbix/create.sql.gz',
import_cat_cmd => 'zcat',
import_timeout => 900,
}
mysql_grant { 'myuser@localhost/*.*':
ensure => 'present',
options => ['GRANT'],
privileges => ['ALL'],
table => '*.*',
user => 'myuser@localhost',
}
file_line { 'zabbix config':
path => '/etc/zabbix/zabbix_server.conf',
line => 'DBHost=localhost\nDBName=zabbix\nDBUser=myuser\nDBPassword=mypass',
}
问题 - mysql-服务器,在主计算机上下载不正确,并丢弃错误,这使得完整清单无用。
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
DOSNT 工作
mv /var/lib/dpkg/info/mysql* /tmp/wtf3
apt-get remove mysql*
apt-get purge mysql*
rm -r /etc/mysql/
apt --fix-broken install
这很可能只是一个依赖性问题 - Puppet 正在尝试安装 运行 Zabbix,然后 MySQL 服务器 运行ning.
尝试将 package
资源更改为
$var3 = ['zabbix-server-mysql','zabbix-frontend-php']
package { $var3 :
ensure => installed,
require => [
Mysql::Db['zabbix'],
Mysql_grant['myuser@localhost/*.*'],
],
}
您的清单中还缺少其他几个依赖项。请记住,Puppet 不会根据清单中的顺序对资源进行排序,至少不可靠。 Dependencies have to be given explicitly using require
, before
, notify
and subscribe
.
OS - Ubuntu 20.04.2 LTS
任务 - 创建 puppet 清单,这将生成 apache2-zabbix 页面。
$var = ['apache2','libapache2-mod-php','php7.4-mysql','php-mysql','php','php-mbstring','php-gd','php-xml','php-bcmath','php-ldap','php-mysql']
package { $var:
ensure => installed,
}
wget::fetch { "download zabbix":
source => 'https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+bionic_all.deb',
destination => '/root/',
timeout => 0,
verbose => false,
}
package { "puppet-dashboard":
provider => dpkg,
ensure => latest,
source => "/root/zabbix-release_4.0-2+bionic_all.deb"
}
$var3 = ['zabbix-server-mysql','zabbix-frontend-php']
package { $var3 :
ensure => installed,
}
mysql::db { 'zabbix':
user => 'myuser',
password => 'mypass',
host => 'localhost',
sql => '/root/zabbix/create.sql.gz',
import_cat_cmd => 'zcat',
import_timeout => 900,
}
mysql_grant { 'myuser@localhost/*.*':
ensure => 'present',
options => ['GRANT'],
privileges => ['ALL'],
table => '*.*',
user => 'myuser@localhost',
}
file_line { 'zabbix config':
path => '/etc/zabbix/zabbix_server.conf',
line => 'DBHost=localhost\nDBName=zabbix\nDBUser=myuser\nDBPassword=mypass',
}
问题 - mysql-服务器,在主计算机上下载不正确,并丢弃错误,这使得完整清单无用。
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
DOSNT 工作
mv /var/lib/dpkg/info/mysql* /tmp/wtf3
apt-get remove mysql*
apt-get purge mysql*
rm -r /etc/mysql/
apt --fix-broken install
这很可能只是一个依赖性问题 - Puppet 正在尝试安装 运行 Zabbix,然后 MySQL 服务器 运行ning.
尝试将 package
资源更改为
$var3 = ['zabbix-server-mysql','zabbix-frontend-php']
package { $var3 :
ensure => installed,
require => [
Mysql::Db['zabbix'],
Mysql_grant['myuser@localhost/*.*'],
],
}
您的清单中还缺少其他几个依赖项。请记住,Puppet 不会根据清单中的顺序对资源进行排序,至少不可靠。 Dependencies have to be given explicitly using require
, before
, notify
and subscribe
.