您现在的位置是: 首页 > 运维 docker mysql 导入 SQL 脚本
docker mysql 导入 SQL 脚本
2020-06-03 【运维】 3190人已围观 6267次浏览
简介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)
相关文章
- 自建Ngrok服务端
- 解决Lost connection to MySQL server at 'reading initial communication packet' 的方法
- CentOS 安装 Docker
- sentinel directive while not in sentinel mode 问题解决
- CentOS 安装Python3
- Nginx转发阿里云OSS内网流量
- 使用 OpenSSL 将 pfx 格式证书转为 pem 格式
- mysql 索引过长1071-max key length is 767 byte
- CentOS 安装Node.js
- Linux 常用命令 持续更新中...
点击排行
- 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 自动填充无效问题解决
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
- nuxt 项目完整部署方案
站长推荐
猜你喜欢
- mac idea spring boot 启动慢
- SpringBoot 启动测试时出现提示 Test class should have exactly one public zero-argument constructor
- Nestedset 出现 Node must exists. 错误解决方案
- Vue 监听回车 el-input 和 input 使用方法不同
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
- CentOS 7 安装 Golang 环境
- mybatis中大于等于小于等于的写法
- SpringBoot 启动提示 Requested bean is currently in creation: Is there an unresolvable circular reference?
- Docker 批量操作命令
- python scrapy 出现 DEBUG: Filtered offsite request to 错误