###mysql-exporter-img #创建Mysql监控账号 CREATE USER 'exporter_mysql'@'%' IDENTIFIED BY 'EXporter_paSSword.20-23'; GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter_mysql'@'%'; flush privileges; cat > my.cnf < /usr/lib/systemd/system/mysqld_exporter.service [Unit] Description=redis_exporter Documentation=https://prometheus.io/ After=network.target [Service] Type=simple User=prometheus ExecStart=/usr/local/mysql_exporter/mysqld_exporter --config.my-cnf=/usr/local/mysql_exporter/my.cnf [Install] WantedBy=multi-user.target EOF ln -sv /usr/lib/systemd/system/mysqld_exporter.service /etc/systemd/system/mysqld_exporter.service useradd prometheus -s /sbin/nologin chown -R prometheus:prometheus /usr/local/mysql_exporter/ systemctl daemon-reload systemctl enable mysqld_exporter systemctl start mysqld_export