手册上的源代码:
代码1:
mysql> CREATE PROCEDURE dorepeat(p1 INT)
    -> BEGIN
    ->   SET @x = 0;
    ->   REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;
    -> END
    -> //
执行以下代码时:
mysql> CREATE PROCEDURE dorepeat(p1 INT)
    -> BEGIN
    ->   SET @x = 0;
这三步之后 产生了报错
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 'at line 3
代码2:可以执行成功
mysql> create procedure proc_char_a (OUT str CHAR)   
    -> begin
    -> select * from a;
    -> end
    -> //代码3
mysql> create function hello(s char(20)) returns char(50) 
    -> return concat('Hello, ',s,'!');
    -> //
ERROR 1418 (HY000): This routine has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_routine_creators variable)
在网上查原因为
以下错误需要设置log_bin_trust_routine_creators变量的值
Mysql> set GLOBAL log_bin_trust_routine_creators=1;
提示错误ERROR 1193 (HY000): Unknown system variable 'log_bin_trust_routine_creators'请问是那的问题呢我的数据库版本5.5.8 

解决方案 »

  1.   

    delimiter $$
    CREATE PROCEDURE dorepeat(p1 INT)
       BEGIN
      SET @x = 0;
    end
    $$
    delimiter ;
      

  2.   

    在my.cnf里面的mysqld选项组里面加看看.
      

  3.   

    ->delimiter //
    ->CREATE PROCEDURE dorepeat(p1 INT)
      -> BEGIN
      -> SET @x = 0;
      -> end
    ->//
      

  4.   

    代码1 没问题了 代码3 还是报错 mysql.ini 内没有那个log_bin_trust_routine_creators 
      

  5.   

    set GLOBAL log_bin_trust_routine_creators=1;
    注意你的拼写错误log_bin_trust_function_creators
      

  6.   

    log_bin_trust_function_creators参数缺省0,是不允许function的同步的