zoukankan      html  css  js  c++  java
  • 导入sql文件到mysql容器中

    导入sql文件到mysql容器中

     1. 在docker-compose文件中增加挂载路径./sqlfile,将sql文件映射进容器。

        volumes:

          - ./data/docker/mysql:/var/lib/mysql

          - ./mysql/:/docker-entrypoint-initdb.d/

          - ./conf/mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf

          - ./sqlfile:/app/sqlfile

      或者可以使用docker cp 的方式。

    2. 进入容器内部,导入sql文件到指定数据库。

    $ docker exec -it 54e61c8c4846 bash

    #mysql -uroot -proot

    mysql> show databases;

    +--------------------+

    | Database           |

    +--------------------+

    | information_schema |

    | apigateway-ai      |

    | mysql              |

    | performance_schema |

    | sys                |

    +--------------------+

    5 rows in set (0.00 sec)

    mysql> use apigateway-ai;

    mysql> source /app/sqlfile/ai_api_profile.sql;

    mysql> show tables;

    +-------------------------+

    | Tables_in_apigateway-ai |

    +-------------------------+

    | ai_api_profile          |

    +-------------------------+

    1 row in set (0.00 sec)

    结束。

  • 相关阅读:
    对象
    函数3
    函数2-作用域
    事件的分类
    函数1
    简单了解JSON Web令牌(JWT)
    Pycharm激活码,2020年9月29日最新激活码
    Python基础学习之常用模块
    python详细图像仿射变换讲解
    Python如何快速复制序列?
  • 原文地址:https://www.cnblogs.com/liusingbon/p/12842903.html
Copyright © 2011-2022 走看看