1.编辑nginx目录的html下的test.php文件
命令:
vi /usr/local/nginx/html/test.php
添加如下内容:
<?php
echo "Zabbix 4.X 演示<br><br>";
$conn = new mysqli("127.0.0.1","root","a123456");
if ($conn->connect_error) {
die("连接数据库失败: ");
}
echo "连接数据库成功";
?>
2.在浏览器访问http://192.168.80.200/test.php
3.关闭mysql服务
命令:
systemctl stop mysql
4.再次验证是否能访问到mysql数据库