MySQL创建用户与授权(CentOS6.5)
1.相关SQL语句
#创建用户与授权方法 ##本地访问 create user 'zend'@'localhost' IDENTIFIED BY '123456'; grant ALL privileges ON zenddb.* TO 'zend'@'localhost'; ##本地访问 create user 'zend'@'127.0.0.1' IDENTIFIED BY '123456'; grant ALL privileges ON zenddb.* TO 'zend'@'127.0.0.1'; ##针对远程访问 create user 'zend'@'%' IDENTIFIED BY '123456'; grant ALL privileges ON zenddb.* TO 'zend'@'%'; #刷新权限 flush privileges; #撤销用户权限 删除用户 REVOKE ALL ON zenddb.* FROM 'zend'@'localhost'; DROP USER 'zend'@'localhost';2.退出MySQL,重启服务
/etc/init.d/mysqld restart3.问题处理3.1 连接MySQL数据库时出现The dirver has not received any packets from the server解决办法:查看iptables后发现是端口3306被防火墙阻止
[root@zendlinux support-files]# vi /etc/sysconfig/iptables # Generated by iptables-save v1.4.7 on Tue Nov 8 16:07:49 2016 *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [1:184] -A INPUT -i lo -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT -A INPUT -p tcp -m tcp --dport 3306 -j DROP -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited -A INPUT -m state --state NEW -m tcp -p tcp --dport 15672 -j ACCEPT COMMIT # Completed on Tue Nov 8 16:07:49 2016
-A INPUT -p tcp -m tcp --dport 3306 -j DROP 修改 -A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT
接下来,重启服务即可service iptables restart
相关推荐
85407718 2020-02-13
Wytheme 2020-01-11
huha 2020-10-16
TLROJE 2020-10-26
echoes 2020-08-20
nercon 2020-08-01
zhanghaibing00 2020-06-28
Aveiox 2020-06-25
henryzhihua 2020-06-21
zhoutaifeng 2020-06-17
liangzhouqu 2020-06-16
TONIYH 2020-06-11
开心就好 2020-06-10
x青年欢乐多 2020-06-06
KyrieHe 2020-06-03
bertzhang 2020-06-02
haokele 2020-05-29