在 CentOS 上重启 LAMP(Linux + Apache + MySQL/MariaDB + PHP)相关服务,通常是对 Apache 和 MySQL/MariaDB 分别操作。下面分常见版本说明。
sudo systemctl restart httpd
如果是 MariaDB(CentOS 默认):
sudo systemctl restart mariadb
如果是 MySQL:
sudo systemctl restart mysqld
sudo systemctl restart httpd mariadb
sudo service httpd restart
sudo service mysqld restart
# 或
sudo service mariadb restart
sudo systemctl enable httpd
sudo systemctl enable mariadb
systemctl status httpd
systemctl status mariadb
journalctl -xe
netstat -tunlp | grep :80
如果你告诉我 CentOS 具体版本(如 7.9 / 8 / Stream)以及用的是 MySQL 还是 MariaDB,我可以给你更精确命令。