MySQL Err1045 Err2003 solution for remote connection Linux

Source: Internet
Author: User

I Linux system Centos7

1.Err2003

My personal situation is because the firewall on Linux is turned on and blocked 3306 remote connection of this MySQL port

Workaround:

CentOS 7.0 defaults to using firewall as the firewall and now shuts it down

Systemctl Stop Firewalld.service #停止firewall
Systemctl Disable Firewalld.service #禁止firewall开机启动
Firewall-cmd--state #查看默认防火墙状态 (show notrunning after turn off, show running when turned on)

If you still want to open another firewall, remember to configure the relevant files do not block remote connection 3306 Port

Here is an example of an online find that configures the Iptables firewall (I did not practice it myself)

Vi/etc/sysconfig/iptables #编辑防火墙配置文件
# sampleconfiguration for iptables Service
# can edit thismanually or u Se system-config-firewall
# Askus to add additional ports/services to this default configuration
*filt ER
: INPUT ACCEPT [0:0]
: FORWARD accept[0:0]
: OUTPUT accept[0:0]
-A input-m state--state related, Established-j ACCEPT
-a input-p icmp-jaccept
-a input-i lo-jaccept
-a input-p tcp-mstate--state new-m TC P--dport 22-j ACCEPT
-a input-p tcp-m state--state new-m TCP--dport 80-jaccept
-a input-p tcp-m state--st Ate new-m tcp--dport 8080-j ACCEPT
-a input-j reject--reject-with icmp-host-prohibited
-a forward-jreject--reje Ct-with icmp-host-prohibited
COMMIT
: wq! #保存退出

Note: Use 80 and 8080 ports here for example. Section is generally added to the "-A input-p tcp-m State--state new-m tcp--dport 22-j ACCEPT" line above or below, remember not to add to the last line, or the firewall does not take effect after the restart.
Systemctlrestart Iptables.service #最后重启防火墙使配置生效
Systemctlenable Iptables.service #设置防火墙开机启动

2.Err1045

I previously used MySQL root account for MySQL under Remote Linux may be the cause of this problem

So I created an account and assigned a database to the account and then remote, successfully connected

Attach MySQL to add user related actions

http://my.oschina.net/u/1179414/blog/202377

MySQL Err1045 Err2003 solution for remote connection Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.