生活随笔
收集整理的這篇文章主要介紹了
mysql无法创建存储过程问题 ERROR 1307 (HY000)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
今天由于需要批量生成一些游戲賬號,所以打算用存儲過程來實現,這樣速度會快很多。結果卻是用了大量時間,主要原因是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? ?
轉載于:https://blog.51cto.com/linuxguest/389169
總結
以上是生活随笔為你收集整理的mysql无法创建存储过程问题 ERROR 1307 (HY000)的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。