1. Related SQL statements
#创建用户与授权方法 # #本地访问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 Ze nddb.* to ' Zend ' @ ' 127.0.0.1 ' , # #针对远程访问create user ' Zend ' @ '% ' identified by ' 123456 ' , grant all privileges on Ze nddb.* to ' zend ' @ '% ' ; #刷新权限 flush privileges; #撤销用户权限 Delete User revoke all on zenddb.* from ' zend ' @ ' localhost ' ;D rop U SER ' zend ' @ ' localhost ';
2. Log out of MySQL and restart the service
/etc/init.d/mysqld restart
3. Problem handling
3.1 When connecting to the MySQL database, the dirver have not received any packets from the server
Workaround: After viewing iptables, it is found that port 3306 is blocked by the firewall
[Email protected] support-files]#VI/etc/sysconfig/iptables# Generated by Iptables-save v1.4.7On Tue Nov8 -: -: the .*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 A-J ACCEPT-A input-p tcp-m TCP--dport the-J ACCEPT-A input-p tcp-m TCP--dport3306-J DROP-A input-p icmp-m ICMP--icmp-type8-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 A-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--dport15672-J acceptcommit# completed on Tue Nov8 -: -: the .
-A input-p tcp-m TCP--dport 3306-J DROP modification -A input-p tcp-m TCP--dport 3306-j ACCEPT
Next, restart the services to service iptables restart
MySQL Create user and authorization (CentOS6.5)