mysql无法创建存储过程问题 ERROR 1307 (HY000)

引用:http://linuxguest.blog.51cto.com/195664/389169

今天由于需要批量生成一些游戏账号,所以打算用存储过程来实现,这样速度会快很多。结果却是用了大量时间,主要原因是mysql server不知道出了点什么问题,运行创建procedure的语句,一直报错。

语句如下:

USE test  
delimiter //  
create procedure createuser()  
BEGIN  
DECLARE a INT default 8000;  
while a < 10000 do  
insert into t (id,pw) values (a,md5('xxxxxx'));  
set aa = a + 1;  
END WHILE;  
END;// 

  

错误提示 ERROR 1307 (HY000): Failed to CREATE PROCEDURE createuser

搞了很久,我跑到mysql5.0的服务器执行,能够通过,难道是语法问题?我去查了5.1的手册,没有问题。有用了其他5.1的机器测试,可以通过。

最后再mysql官方找到了这样的解决方案,执行 /usr/local/mysql/bin/mysql_upgrade工具,对表进行检查,检查结果如下,并未发现什么错误,但是可以创建存储过程了。

 

[root@zj6 ~]# /usr/local/mysql/bin/mysql_upgrade   
Looking for 'mysql' as: /usr/local/mysql/bin/mysql  
Looking for 'mysqlcheck' as: /usr/local/mysql/bin/mysqlcheck  
Running 'mysqlcheck' with connection arguments: '--port=9188' '--socket=/var/lib/mysql/mysql.sock'   
Running 'mysqlcheck' with connection arguments: '--port=9188' '--socket=/var/lib/mysql/mysql.sock'   
ZION_GAME_DB.BADUser                               OK  
ZION_GAME_DB.MAPOwnerGuild                         OK  
ZION_GAME_DB.actionlimit                           OK  
ZION_GAME_DB.billinfo                              OK  
ZION_GAME_DB.completemission                       OK  
ZION_GAME_DB.currentmission                        OK  
ZION_GAME_DB.email                                 OK  
ZION_GAME_DB.emailitems                            OK  
ZION_GAME_DB.equipitems                            OK  
ZION_GAME_DB.familyinfo                            OK  
ZION_GAME_DB.familymember                          OK  
ZION_GAME_DB.familymission                         OK  
ZION_GAME_DB.groupdata                             OK  
ZION_GAME_DB.invenitems                            OK  
ZION_GAME_DB.loopmission                           OK  
ZION_GAME_DB.microcosm                             OK  
ZION_GAME_DB.pet                                   OK  
ZION_GAME_DB.safegarbage                           OK  
ZION_GAME_DB.sale                                  OK  
ZION_GAME_DB.saleprice                             OK  
ZION_GAME_DB.signpost                              OK  
ZION_GAME_DB.titledata                             OK  
ZION_GAME_DB.userfriend                            OK  
ZION_GAME_DB.usergarbage                           OK  
ZION_GAME_DB.userinfo                              OK  
ZION_GAME_DB.userskills                            OK  
ZION_GAME_DB.usersubinfo                           OK  
ZION_GAME_DB.usertable                             OK  
ZION_LOG_DB.BillItemLog                            OK  
ZION_LOG_DB.DeleteLog                              OK  
ZION_LOG_DB.GarbageLog                             OK  
ZION_LOG_DB.GarbageMoneyLog                        OK  
ZION_LOG_DB.ItemLog                                OK  
ZION_LOG_DB.LevelItemLog                           OK  
ZION_LOG_DB.LevelLog                               OK  
ZION_LOG_DB.LoginLog                               OK  
ZION_LOG_DB.MoneyLog                               OK  
ZION_LOG_DB.MyShopLog                              OK  
ZION_LOG_DB.StressLog                              OK  
ZION_LOG_DB.deluserinfo                            OK  
ZION_LOG_DB.delusertable                           OK  
mysql.columns_priv                                 OK  
mysql.db                                           OK  
mysql.event                                        OK  
mysql.func                                         OK  
mysql.general_log  
Error    : You can't use locks with log tables.  
status   : OK  
mysql.help_category                                OK  
mysql.help_keyword                                 OK  
mysql.help_relation                                OK  
mysql.help_topic                                   OK  
mysql.host                                         OK  
mysql.ndb_binlog_index                             OK  
mysql.plugin                                       OK  
mysql.proc                                         OK  
mysql.procs_priv                                   OK  
mysql.servers                                      OK  
mysql.slow_log  
Error    : You can't use locks with log tables.  
status   : OK  
mysql.tables_priv                                  OK  
mysql.time_zone                                    OK  
mysql.time_zone_leap_second                        OK  
mysql.time_zone_name                               OK  
mysql.time_zone_transition                         OK  
mysql.time_zone_transition_type                    OK  
mysql.user                                         OK  
test.t                                             OK  
Running 'mysql_fix_privilege_tables'...  
OK 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值