• MySQL中可能遇到的问题及解决方法


    一.在创建存储函数时,出现错误:
     ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQLDATA in its declaration binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
     解决方法: 1.mysql> SET GLOBAL log_bin_trust_function_creators = 1;
      2.在登录MySQL服务器是,加上 “--log-bin-trust-function-creators=1 ”参数并设置为1。
      3.一劳永逸的方法,在my.ini(my.cnf)中的[mysqld]区段中加上 log-bin-trust-function-creators=1。

       mysql> show variables like '%func%'; 
    +---------------------------------+-------+
    | Variable_name | Value |
    +---------------------------------+-------+
    | log_bin_trust_function_creators | OFF? |
    +---------------------------------+-------+
    1 row in set (0.00 sec)
    mysql> set global log_bin_trust_function_creators=1;
    Query OK, 0 rows affected (0.00 sec)
    mysql> show variables like '%func%';
    +---------------------------------+-------+
    | Variable_name | Value |
    +---------------------------------+-------+
    | log_bin_trust_function_creators | ON? |
    +---------------------------------+-------+
    1 row in set (0.00 sec)

    二.在声明变量时:mysql> declare my_sql int default 10;
     ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'declare my_sql int default 10' at line 1
     解决方法:变量的声明(DECLARE)必须发生在BEGIN-END语句块里,而且必须发生在同一个BEGIN-END语句块里的其他命令之前。下面是变量声明(DECLARE)的语法:
    DECLARE varname1, varname2, varname3,… Datatype [DEFAULT value];

     注意:必须为所有的局部变量声明它们的数据类型。如果没有使用关键字 DEFAULT 进行设定(即初始化),局部变量的初始值都将是NULL

  • 相关阅读:
    Python笔记17(Django之路由系统)
    Python笔记16(Django介绍与安装)
    Python笔记16(Web框架本质)
    序列的区间操作
    并查集(入门)
    (补题 Uva 3027)Corporative Network
    (补题 cf 1167C)News Distribution
    (补题 CF 1013B 模拟)And
    (补题 CF 1234C)Pipes
    (补题 POJ 1679 次小生成树)The Unique MST
  • 原文地址:https://www.cnblogs.com/-lpf/p/4344331.html
Copyright © 2020-2023  润新知