A)安装及配置
- 下载mariadb:
yum -y install mariadb-server mariadb
- 开启mariadb服务:
systemctl start mariadb.service
- 重启:systemctl restart mariadb.service
- 无密码登录mariadb:
mysql
- 查看用户表:
select * from mysql.user;
- 修改密码和授权: grant all on *.* to 'root'@'%' identified by '123456' with grant option;update mysql.user set host = '%' where user = 'root';select host, user from user;flush privileges;
- 密码登录: mysql -u root -p
-
设置开机启动:systemctl enable mariadb.service
B)防火墙
- 停止防火墙::systemctl stop firewalld
- 安装iptables-services:yum install iptables-services
- 设置开机启动:
systemctl enable iptables
systemctl stop iptables
systemctl start iptables
systemctl restart iptables
systemctl reload iptables
4.保存设置:
service iptables save
5.开放某个端口 在/etc/sysconfig/iptables里添加:
/sbin/iptables -A INPUT -p tcp --dport 3306 -j ACCEPT 或者
查看防火墙状态:
service iptables status
永久性生效,重启后不会复原
开启:
chkconfig iptables on
关闭:
chkconfig iptables off
2.即时生效,重启后复原
开启:
service iptables start
关闭:
service iptables stop
参考
https://www.cnblogs.com/star91/p/4980024.html
https://blog.csdn.net/qq_40342287/article/details/82428048
http://blog.51cto.com/12173069/2119307
https://www.cnblogs.com/wujunbin/p/7465538.html
https://blog.csdn.net/c233728461/article/details/52679558/
https://blog.csdn.net/qq_37928350/article/details/78830896