您现在的位置是: 首页 > 运维 docker mysql 导入 SQL 脚本
docker mysql 导入 SQL 脚本
2020-06-03 【运维】 2477人已围观 4892次浏览
简介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)
相关文章
- LNMP 手动更新 SSL 证书
- Oracle ORA-12541:TNS:no listener错误解决方法
- 迁移 Docker 目录
- Debian apt 使用国内镜像
- 【Docker】unauthorized: incorrect username or password
- nginx 出现 the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in 错误解决方案
- mysql 索引过长1071-max key length is 767 byte
- CentOS 安装Node.js
- Linux no space left on device 出现设备上没有空间问题
- Nginx转发阿里云OSS内网流量
点击排行
- 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 项目完整部署方案
站长推荐
猜你喜欢
- 迁移 Docker 目录
- npm 出现 Unexpected token < in JSON at position 21330
- 自建Ngrok服务端
- Nginx转发阿里云OSS内网流量
- win10 cmder Debian 安装配置 oh-my-zsh
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
- 使用 OpenSSL 将 pfx 格式证书转为 pem 格式
- sentinel directive while not in sentinel mode 问题解决
- Zookeeper 找不到或无法加载主类 org.apache.zookeeper.server.quorum.QuorumPeerMain
- LNMP 手动更新 SSL 证书