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

  • 相关阅读:
    ububtu 14.04 问题集合
    ubuntu grub 引导修复
    Ubuntu 下 glpk 的安装及使用
    ubuntu vim 7.4 编译安装
    ubuntu 12.04 clang 3.4 安装
    CMakeLists实战解读--YouCompleteMe
    Flume安装及部署
    SpringBoot整合kafka
    linux安装kafka
    Linux安装zookeeper
  • 原文地址:https://www.cnblogs.com/-lpf/p/4344331.html
Copyright © 2011-2022 走看看