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
  • 相关阅读:
    HDU 2883 kebab
    CSUOJ 1635 Restaurant Ratings
    CSUOJ 1638 Continued Fraction
    POJ 1852 Ants
    ZOJ 3471 Most Powerful
    CSUOJ 1637 Yet Satisfiability Again!
    如何生成CA证书
    Keepalived实现双机热备
    Nginx负载均衡的优缺点
    负载均衡之 nginx
  • 原文地址:https://www.cnblogs.com/xdot/p/5097781.html
Copyright © 2011-2022 走看看