Mysql添加遠端存取資料庫許可權

來源:互聯網
上載者:User

標籤:justify   資料庫   color   

@font-face {  font-family: "宋體";}@font-face {  font-family: "Cambria Math";}@font-face {  font-family: "@宋體";}@font-face {  font-family: "Calibri";}@font-face {  font-family: "Helvetica Neue";}p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0 0 0; text-align: justify; font-size: 14px; font-family: Calibri; }h3 { margin: 17px 0; text-align: justify; line-height: 172%; page-break-after: avoid; font-size: 21px; font-family: Calibri; font-weight: bold; }a:link, span.MsoHyperlink { color: blue; text-decoration: underline; }a:visited, span.MsoHyperlinkFollowed { color: rgb(149, 79, 114); text-decoration: underline; }p { margin-right: 0; margin-left: 0; font-size: 16px; font-family: Calibri; }.MsoChpDefault { font-size: 13px; }div.WordSection1 {  }ol { margin-bottom: 0; }ul { margin-bottom: 0; }

一、MySQL 可以用localhost 串連,但不能用IP串連的問題(資料庫遠端存取許可權)

如果在部署項目的時候,探索資料庫不能遠程通過Navicat訪問,或者在程式的設定檔中修改好資料庫IP地址,但是無法訪問的情況,嘗試一下將設定檔改成localhost再次訪問,此時如果改成localhost可以訪問,那麼,需要執行以下SQL語句,開啟當前登入賬戶遠程登入許可權。

1.以root使用者登陸mysql資料庫。

2.執行一下命令分配新使用者:

grant all privileges on *.* to ‘使用者名稱‘@‘IP地址‘ identified by ‘密碼‘;

‘all privileges ‘:所有許可權 也可以寫成 select ,update等。
*.* 所有庫的所有表 如 databasename.*。
IP  資料庫所在的IP。(‘%‘表示所有ip)
identified by ‘密碼’ 表示通過密碼串連。

3.執行完上述命令後用下面的命令重新整理一下許可權

flush privileges;


Mysql添加遠端存取資料庫許可權

聯繫我們

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