mysql无法创建存储过程问题 ERROR 1..
时间:2010-09-08 来源:fenghao.cn
今天由于需要批量生成一些游戏账号,所以打算用存储过程来实现,这样速度会快很多。结果却是用了大量时间,主要原因是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
相关阅读 更多 +