在CentOS系统中,sqladmin通常不是一个标准的软件包或服务名称。如果你是指配置MySQL或MariaDB的防火墙规则,以便允许远程连接,你可以按照以下步骤操作:
登录到你的CentOS服务器。
确定你使用的防火墙类型。CentOS 7及更高版本默认使用firewalld,而CentOS 6使用的是iptables。
对于firewalld:
a. 启动firewalld服务(如果尚未启动):
sudo systemctl start firewalld
b. 启用firewalld服务开机自启:
sudo systemctl enable firewalld
c. 添加MySQL/MariaDB服务到firewalld:
sudo firewall-cmd --permanent --zone=public --add-service=mysql
注意:如果你使用的是MariaDB,确保添加的服务名称是mariadb而不是mysql。
d. 重新加载firewalld配置以应用更改:
sudo firewall-cmd --reload
e. 检查防火墙状态:
sudo firewall-cmd --list-all
在输出中查找services部分,确认mysql或mariadb服务已被添加。
对于iptables:
a. 允许MySQL/MariaDB端口(默认3306)的流量:
sudo iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
b. 保存iptables规则。这一步因CentOS版本而异。在CentOS 7及以上版本中,你可以使用firewalld来持久化规则,如上所述。如果你使用的是CentOS 6或其他需要手动保存规则的版本,可以使用以下命令:
sudo service iptables save
或者
sudo /sbin/service iptables save
c. 重启iptables服务以应用更改:
sudo systemctl restart iptables
注意:在某些CentOS版本中,你可能需要启用iptables-services包来管理iptables服务。
完成以上步骤后,你的CentOS服务器应该已经配置了允许远程连接到MySQL或MariaDB服务的防火墙规则。记得在配置防火墙之前,确保你的数据库服务器已经正确安装并运行,并且监听在正确的端口上。