centos7开启3306端口,liunx查看防火墙是否开启
Can't connect to MySQL server on localhost (10061)这个就属于下面要说的情况
启动服务
systemctl start mariadb.service
systemctl enable mariadb.service
systemctl stop mariadb.service
1.首先开启mysql权限
设置ROOT密码
mysqladmin -u root password '888888'
mysql -u root -p
use mysql
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mysql' WITH GRANT OPTION;
flush privileges;
第一句中"%"表示任何主机都可以远程登录到该服务器上访问。如果要限制只有某台机器可以访问,将其换成相应的IP即可,如:
GRANT ALL PRIVILEGES ON *.* TO root@"172.168.193.25" IDENTIFIED BY "root";
select * from user where user='root';
查看是否有%这条记录
2.开启3306端口及常用的其它端口
查看是否有这个文件/etc/sysconfig/iptables,如果没有
iptables -P OUTPUT ACCEPT
service iptables save 进行保存,默认就保存到了/etc/sysconfig目录下的iptables文件中
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT #允许3306数据库端口通过防火墙
service iptables save
cat /etc/sysconfig/iptables有3306这条信息
service iptables restart就ok咯
其它常用端口:
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #允许80web端口通过防火墙
iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
iptables -A INPUT -p tcp --dport 110 -j ACCEPT #email
iptables -A INPUT -p tcp --dport 25-j ACCEPT #email
iptables -A INPUT -p tcp --dport 20-j ACCEPT #ftp
iptables -A INPUT -p tcp --dport 21-j ACCEPT #ftp
iptables -A INPUT -p icmp -j ACCEPT #ping
iptables -A INPUT -p udp --dport 53 -j ACCEPT #DNS
3.查看防火墙是否开启:
service iptables status
active表示开启,inactive表示关闭
firewall-cmd --state
norunning
4.关于防火墙的命令
重启后永久性生效:
开启:chkconfig iptables on
关闭:chkconfig iptables off
即时生效,重启后失效:
开启:service iptables start
关闭:
service iptables stop
重启:service iptables restart
保存配置:service iptables save
或者/etc/rc.d/init.d/iptables save
#设置防火墙开机启动
systemctl enable iptables.service
禁止防火墙在系统启动时启动
/sbin/chkconfig --level 2345 iptables off
5.删除iptables规则
查看当前规则
iptables -L -n
iptables -L -n --line-number
iptables -D INPUT 3
centos7开启3306端口,liunx查看防火墙是否开启的更多相关文章
- Centos7防火墙开启3306端口
CentOS7的默认防火墙为firewall,且默认是不打开的. systemctl start firewalld # 启动friewall systemctl status firewalld # ...
- iptables 开启3306端口
[root@mysqld ~]# mysql -uroot -h 192.168.1.35 -p Enter password: ERROR 1130 (HY000): Host '192.168.1 ...
- Linux下防火墙开启相关端口及查看已开启端口
最近利用Apache Mina实现了一个http服务,发布到linux下发现无法访问,通过HttpClient来发送http请求时,报如下错误: Exception in thread "m ...
- centos7 开放3306端口并可以远程访问
开启远程访问: GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; 允许任何ip以roo ...
- windows开启3306端口并用可视化工具访问远程mysql(授权访问)
开启 MySQL 的远程登陆帐号有两大步: 1.确定服务器上的防火墙没有阻止 3306 端口. MySQL 默认的端口是 3306 ,需要确定防火墙没有阻止 3306 端口,否则远程是无法通过 330 ...
- Linux开启相关端口及查看已开启端口
防火墙层面: /sbin/iptables -I INPUT -p tcp --dport 8011 -j ACCEPT #开启8011端口 /etc/rc.d/init.d/iptables ...
- Linux 开启相关端口及查看已开启端口
防火墙层面: /sbin/iptables -I INPUT -p tcp --dport 8011 -j ACCEPT #开启8011端口 /etc/rc.d/init.d/iptables ...
- mysql ubuntu 开启3306端口,设置远程访问
远程登陆数据库的时候出现了下面出错信息 :ERROR 2003 ( HY000 ) : Can 't connect to MySQL server on ' xxx.xxx.xxx.xxx ',经过 ...
- linux如何查看防火墙是否开启?删除iptables规则
iptables是linux下的防火墙组件服务,相对于windows防火墙而言拥有更加强大的功能,此经验咗嚛以centos系统为例.关于iptables的一般常见操作,怎么来判断linux系统是否启用 ...
随机推荐
- linux系统中scp命令的用法(Permission denied排错二例)
原文链接: 这里需要注意,当往远程主机拷文件时,必须当前用户对远程主机的对应目录具有写权限 http://www.360doc.com/content/13/0929/13/6496277_31784 ...
- Django跑起来
1. 安装python 2. 安装pip 3. 安装dj 4. 配置dj 5. 建立dj web app 6. 开始项目 打算写这篇文章,先把目录写上
- 【洛谷P2296】寻找道路
反正图两边bfs #include<iostream> #include<cstdio> #include<queue> using namespace std; ...
- Apache 常用伪静态配置
1. /a/b?c=d => index.php?_a=a&_m=b&c=d 2. /xxx/detail-yyy.html => index.php?_a=xxx& ...
- static, readonly, const
static Use the static modifier to declare a static member, which belongs to the type itself rather t ...
- Adaboost算法初识
1.算法思想很简单: AdaBoost 是一种迭代算法,其核心思想是针对同一个训练集训练不同的分类器,即弱分类器,然后把这些弱分类器集合起来,构造一个更强的最终分类器.(三个臭皮匠,顶个诸葛亮) 它的 ...
- ORACLE之ASM学习
ASM(Automatic Storage Management)是Oracle10g R2中为了简化Oracle数据库的管理而推出来的一项新功能,这是Oracle自己提供的卷管理器,主要用于替代操作 ...
- Magicodes.WeiChat——WeChatOAuthTest(网页授权获取用户基本信息)
Demo访问地址:http://wechat.magicodes.net/app/AppDemo/WeChatOAuthTest?tenantId=1 关于公众号如何获取用户信息,请参考此文档:htt ...
- xps 文件操作笔记
1. 在 Silverlight 显示XPS文件,参考:http://azharthegreat.codeplex.com/ 2. Word,Excel, PPT 文件转换为XPS: 参考一(老外写的 ...
- latex数字加粗后变宽
latex的数字默认用的是Times New Roman字体,这个字体有个不优美之处就是加粗后会变宽,如下图所示: 平常倒是也无所谓.昨天在把实验数据整理进表格时,为了凸显每个数据集上各个实验方法的优 ...