Docker 无网络内网机安装MySQL

外网机:
docker pull mysql:5.7.39
docker run -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7.39
docker ps --no-trunc
Show:
docker-entrypoint.sh mysqld
docker save mysql | gzip > /home/li/mysql_5.7.39.tar.gz

内网机:
docker load < mysql_5.7.39.tar.gz
docker tag IMAGEID TARGET_IMAGE[:TAG]
docker run -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql_5.7.39 docker-entrypoint.sh mysqld

Login error:
Host '10.10.10.1' is not allowed to connect to this MySQL server
docker cp mysql-test:/etc/my.cnf ./
vi my.cnf
Add:
skip-grant-tables
docker cp ./my.cnf mysql-test:/etc/my.cnf
docker restart mysql-test
docker exec -it mysql-test mysql -hlocalhost -uroot -p
mysql> use mysql;
mysql> update mysql.user set authentication_string = password("123456") where user="root";
mysql> flush privileges;
exit
恢复配置文件
vi my.cnf
#skip-grant-tables
docker cp ./my.cnf mysql-test:/etc/my.cnf
docker restart mysql-test
docker exec -it mysql-test mysql -hlocalhost -uroot -p
mysql> use mysql;
mysql> CREATE USER 'root'@'%' IDENTIFIED BY '123456';
mysql> GRANT all privileges ON mysql.* TO 'root'@'%';
mysql> flush privileges;
exit

mysql> source /root/xxxx.sql
Error Code: 1153 - Got a packet bigger than 'max_allowed_packet' bytes
mysql> show global variables like 'max_allowed_packet';
+--------------------+---------+
| Variable_name      | Value   |
+--------------------+---------+
| max_allowed_packet | 4194304 |
+--------------------+---------+
mysql> set global max_allowed_packet=1024*1024*160;