zoukankan      html  css  js  c++  java
  • Mysql导出函数、存储过程

    下面是导出存储过程的代码

    1 # mysqldump -u 数据库用户名 -p -n -t -d -R 数据库名 > 文件名

    其中,-d 表示--no-create-db, -n表示--no-data, -t表示--no-create-info, -R表示导出function和procedure。所以上述代码表示仅仅导出函数和存储过程,不导出表结构和数据。但是,这样导出的内容里,包含了 trigger。再往mysql中导入时就会出问题,错误如下:

    ERROR 1235 (42000) at line **: This version of MySQL doesn't yet support ‘multiple triggers with the same action time and event for one table’

    所以在导出时需要把trigger关闭。代码为

    1 # mysqldump -u 数据库用户名 -p -n -t -d -R --triggers=false 数据库名 > 文件名

    这样导入时,会出现新的问题:

    ErrorCode:1418
    This function has none of DETERMINISTIC, NOSQL, or READS SQL DATA inits declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)

    解决方法是,在/etc/my.cnf中找到[mysqld],在它下面添加这样一行:

    1 log-bin-trust-function-creators=1
  • 相关阅读:
    逻辑架构设计目标和任务
    业务架构设计
    架构设计概念
    可扩展设计:如何做到增加功能不修改调用方代码?
    P2661 信息传递
    Network of Schools POJ
    1002 过河卒
    P3254 圆桌问题
    P2765 魔术球问题
    P1141 01迷宫
  • 原文地址:https://www.cnblogs.com/xdot/p/5097781.html
Copyright © 2011-2022 走看看