如何在 docker-compose mariadb 容器中恢复 MySQL 数据库转储
使用此代码片段在你的 MariaDB 容器中恢复 SQL 文件:
restore_mysqldump.sh
docker-compose exec -T [container name] mysql -uroot < mydump.sql这假设你没有设置 root 密码。为了使用 root 密码,使用
restore_mysqldump_with_pw.sh
docker-compose exec -T mariadb mysql -uroot -pmysecretrootpassword < mydump.sql-T 表示不使用 TTY,换句话说,不期望交互式输入。这避免了
tty_error.txt
the input device is not a TTY错误消息。
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow