mysql無法建立儲存過程問題 ERROR 1307 (HY000)

一隻小螞蟻吆發表於2020-04-06

引用: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 

 

相關文章