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
  • 相关阅读:
    第四周进度条
    单元测试
    第四周开发日志(psp)
    软件工程个人作业03
    第四周课堂作业——单元测试
    进度条 第三周
    开发日志
    软件工程个人作业2
    《构建之法》阅读笔记01
    第一二周进度条
  • 原文地址:https://www.cnblogs.com/xdot/p/5097781.html
Copyright © 2011-2022 走看看