zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    超级简单:一步一步教你创建一小型的asp.net mvc 应用程序
    asp.net AJAX 验证用户名是否存在 Jquery
    生成缩略图、为图片添加文字水印、图片水印的类
    图Graph
    [转]Implementing a Generic Binary Tree in C#
    .net C#数据结构
    Why HTML5 is worth your time
    跳跃表SkipList
    C# LockFreeStack类
    [转]泛型弱引用
  • 原文地址:https://www.cnblogs.com/-lpf/p/4344331.html
Copyright © 2011-2022 走看看