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

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

语句如下:

  
  
  
  
  1. USE test  
  2. delimiter //  
  3. create procedure createuser()  
  4. BEGIN  
  5. DECLARE a INT default 8000;  
  6. while a < 10000 do  
  7. insert into t (id,pw) values (a,md5('xxxxxx'));  
  8. set aa = a + 1;  
  9. END WHILE;  
  10. END;// 

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

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

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

 

  
  
  
  
  1. [root@zj6 ~]# /usr/local/mysql/bin/mysql_upgrade   
  2. Looking for 'mysql' as: /usr/local/mysql/bin/mysql  
  3. Looking for 'mysqlcheck' as: /usr/local/mysql/bin/mysqlcheck  
  4. Running 'mysqlcheck' with connection arguments: '--port=9188' '--socket=/var/lib/mysql/mysql.sock'   
  5. Running 'mysqlcheck' with connection arguments: '--port=9188' '--socket=/var/lib/mysql/mysql.sock'   
  6. ZION_GAME_DB.BADUser                               OK  
  7. ZION_GAME_DB.MAPOwnerGuild                         OK  
  8. ZION_GAME_DB.actionlimit                           OK  
  9. ZION_GAME_DB.billinfo                              OK  
  10. ZION_GAME_DB.completemission                       OK  
  11. ZION_GAME_DB.currentmission                        OK  
  12. ZION_GAME_DB.email                                 OK  
  13. ZION_GAME_DB.emailitems                            OK  
  14. ZION_GAME_DB.equipitems                            OK  
  15. ZION_GAME_DB.familyinfo                            OK  
  16. ZION_GAME_DB.familymember                          OK  
  17. ZION_GAME_DB.familymission                         OK  
  18. ZION_GAME_DB.groupdata                             OK  
  19. ZION_GAME_DB.invenitems                            OK  
  20. ZION_GAME_DB.loopmission                           OK  
  21. ZION_GAME_DB.microcosm                             OK  
  22. ZION_GAME_DB.pet                                   OK  
  23. ZION_GAME_DB.safegarbage                           OK  
  24. ZION_GAME_DB.sale                                  OK  
  25. ZION_GAME_DB.saleprice                             OK  
  26. ZION_GAME_DB.signpost                              OK  
  27. ZION_GAME_DB.titledata                             OK  
  28. ZION_GAME_DB.userfriend                            OK  
  29. ZION_GAME_DB.usergarbage                           OK  
  30. ZION_GAME_DB.userinfo                              OK  
  31. ZION_GAME_DB.userskills                            OK  
  32. ZION_GAME_DB.usersubinfo                           OK  
  33. ZION_GAME_DB.usertable                             OK  
  34. ZION_LOG_DB.BillItemLog                            OK  
  35. ZION_LOG_DB.DeleteLog                              OK  
  36. ZION_LOG_DB.GarbageLog                             OK  
  37. ZION_LOG_DB.GarbageMoneyLog                        OK  
  38. ZION_LOG_DB.ItemLog                                OK  
  39. ZION_LOG_DB.LevelItemLog                           OK  
  40. ZION_LOG_DB.LevelLog                               OK  
  41. ZION_LOG_DB.LoginLog                               OK  
  42. ZION_LOG_DB.MoneyLog                               OK  
  43. ZION_LOG_DB.MyShopLog                              OK  
  44. ZION_LOG_DB.StressLog                              OK  
  45. ZION_LOG_DB.deluserinfo                            OK  
  46. ZION_LOG_DB.delusertable                           OK  
  47. mysql.columns_priv                                 OK  
  48. mysql.db                                           OK  
  49. mysql.event                                        OK  
  50. mysql.func                                         OK  
  51. mysql.general_log  
  52. Error    : You can't use locks with log tables.  
  53. status   : OK  
  54. mysql.help_category                                OK  
  55. mysql.help_keyword                                 OK  
  56. mysql.help_relation                                OK  
  57. mysql.help_topic                                   OK  
  58. mysql.host                                         OK  
  59. mysql.ndb_binlog_index                             OK  
  60. mysql.plugin                                       OK  
  61. mysql.proc                                         OK  
  62. mysql.procs_priv                                   OK  
  63. mysql.servers                                      OK  
  64. mysql.slow_log  
  65. Error    : You can't use locks with log tables.  
  66. status   : OK  
  67. mysql.tables_priv                                  OK  
  68. mysql.time_zone                                    OK  
  69. mysql.time_zone_leap_second                        OK  
  70. mysql.time_zone_name                               OK  
  71. mysql.time_zone_transition                         OK  
  72. mysql.time_zone_transition_type                    OK  
  73. mysql.user                                         OK  
  74. test.t                                             OK  
  75. Running 'mysql_fix_privilege_tables'...  
  76. OK 

 

你可能感兴趣的:(数据库,mysql,error,职场,休闲,(HY000),1307)