1、报错如下一
Error response from daemon: driver failed programming external connectivity on endpoint lnmp_mysql (61ce99378a4416221af9f6da52209b4473561a311f99e2ffa8b889915eafb56a): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 3308 -j DNAT --to-destination 172.17.0.2:3306 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1))
Error: failed to start containers: 005afd180cd7
解决方案如下
清空防火墙规则,重启docker
[root@node03 web]# iptables -F
[root@node03 web]# iptables -t nat -F
[root@node03 web]# service iptables save
[root@node03 web]# service iptables restart
[root@node03 web]# systemctl restart docker
注释:因为docker的规则会自己在iptables 里面生产,如果没有清空规则,会有诸多限制。
2、Navicat 远程连接docker容器中的mysql 报错1251 - Client does not support authentication protocol 解决办法
解决方法如下:
1、登录到mysql容器中
[root@node03 web]# docker exec -it lnmp_mysql bash
2、在登录mysql
root@8e84ab34e6fe:/# mysql -uroot -p
3、授权用户访问
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
Query OK, 0 rows affected (2.29 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.39 sec)
4、数据库可以链接了