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)

    结束。

  • 相关阅读:
    空格转换
    vuex学习
    css移动端适配方法
    数组以及数组常用方法
    21-canvas事件监听
    20-canvas之形变
    [转]session 跨域共享方案
    [转载] 从mysql,代码,服务器三个方面看mysql性能优化
    [计算机]Alan Perlis人物简介
    Python环境搭建及pip的使用
  • 原文地址:https://www.cnblogs.com/liusingbon/p/12842903.html
Copyright © 2011-2022 走看看