mysql資料匯出許可權問題,mysql資料匯出許可權

來源:互聯網
上載者:User

mysql資料匯出許可權問題,mysql資料匯出許可權

mysql資料匯出的方法有很多,例如mysqldump, mysql -e 'sql' > file, 這些都可以很方便的匯出資料,可是在使用普通使用者匯出資料的時候,出現了問題。

1
select * into outfile "file_path" from my_table

上面的語句也是mysql匯出資料的一種方式,在使用普通使用者執行語句時,出現了一下錯誤:

1
ERROR 1045 (28000): Access denied for user 'my_user'@'%' (using password: YES)

之前已經對該使用者在對應的資料庫上執行了授權,如下:

1
grant all on my_database.* to my_user ;

上面語句可以看出,已經把所有的許可權賦予了my_user,可是問題依舊存在。問題到底出現在什麼地方呢?google了一下後發現mysql有單獨的file許可權,需要單獨賦予,同時file是一個全域許可權,不能夠僅僅將單個資料庫的檔案許可權賦予使用者。找到原因後,下面就將檔案許可權賦予相應使用者:

1
grant file on *.* to my_user ;

再次執行匯出語句,成功執行。

更多文章請前往小胖軒.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.