MYSQL匯入預存程序無法執行問題解決辦法

來源:互聯網
上載者:User

通過mysql匯入的資料庫,當裡面有預存程序的時候,匯入後預存程序是無法用程式使用了,找了很久原因,最後發現是許可權問題。

1、我們要用查看資料庫裡面的預存程序:在mysql裡面輸入

mysql> show function status;

運行後的結果如圖所示:

2、修改對應預存程序的Definer和Security_type這兩個欄位的值
加入我們程式連結資料庫的帳戶是leiming,連結資料庫的地址是127.0.0.1
我們需要輸入

mysql> update mysql.proc set Definer='leiming@127.0.0.1';

然後修改Security_type欄位:

mysql> update mysql.proc set Security_type='INVOKER';

這裡這裡我們是修改的所有的預存程序,當然你要修改你對應的那個預存程序,只需要加上where條件即可。

ps MYSQL匯入預存程序報錯

今天向mysql匯入預存程序的時候報錯,錯誤如下:

you *might* want to use the less safe log_bin_trust_function_creators variable
 
處理這個問題,只需要進入mysql,然後輸入:

mysql> SET GLOBAL log_bin_trust_function_creators = 1;
 
退出,重新匯入預存程序,成功!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.