您现在的位置是: 首页 > 运维 docker mysql 导入 SQL 脚本
docker mysql 导入 SQL 脚本
2020-06-03 【运维】 1834人已围观 3969次浏览
简介docker mysql 导入 SQL 脚本
首先是复制宿主机中的文件到 docker 容器中
docker cp /path/test.sql mysql:/path/test.sql
然后登入容器
docker exec -it mysql bash
登录 MySQL
mysql -u root -p
输入密码进入后,新建数据库或指定某一个数据库
# 新建数据库
create database test;
# 指定数据库
use test;
导入 SQL 文件
source /path/test.sql
等待执行完成后,可以使用下面命令查看导入了哪些表
show tables;
上诉方法同样适用于直接安装的 MySQL,省略掉 docker 相关操作即可
很赞哦! (0)
相关文章
- ElasticSearch安装踩坑指南
- Linux no space left on device 出现设备上没有空间问题
- Zookeeper 找不到或无法加载主类 org.apache.zookeeper.server.quorum.QuorumPeerMain
- 自建Ngrok服务端
- sentinel directive while not in sentinel mode 问题解决
- 解决443端口被VMWare Workstation占用
- 【Docker】unauthorized: incorrect username or password
- LNMP定时备份任务教程(支持排除指定文件夹)
- Redis 提示 MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk 解决方案
- Linux 服务器之间传输大文件(压缩文件、查看MD5、后台传输)
点击排行
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- Debian apt 使用国内镜像
- RocketMQ 出现 sendDefaultImpl call timeout 问题
- 类 BASE64Decoder 程序包 sun.misc 找不到符号
- SpringBoot @NotBlank 不生效问题
- 记一次 Mybatis-Plus 自动填充无效问题解决
- nuxt 项目完整部署方案
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
站长推荐
猜你喜欢
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- Vue 报错 Avoid using non-primitive value as key, use string/number value instead
- linux下各文件夹的结构说明及用途介绍
- 记一次Java MessageFormat.format踩坑
- 自建Ngrok服务端
- Chrome 谷歌浏览器清除HTTPS证书缓存
- 防止Time Machine备份Parallels Desktop的虚拟硬盘文件
- 使用 OpenSSL 将 pfx 格式证书转为 pem 格式
- SpringBoot 2.x Security security.basic.enabled=false 失效问题解决
- ElasticSearch安装踩坑指南