解決mysql創(chuàng)建數據庫后出現:Access denied for user 'root'@'%' to database 'xxx'的問題
更新時間:2017年05月02日 14:39:26 作者:浮云中的毛驢
這篇文章主要給大家介紹了如何解決mysql在創(chuàng)建數據庫后出現:Access denied for user 'root'@'%' to database 'xxx'的錯誤提示,文中介紹的非常詳細,需要的朋友可以參考借鑒,下面來一起看看吧。
前言
最近在工作中遇到一個問題,在創(chuàng)建數據庫后連接數據庫的時候居然報錯了,錯誤代碼是Access denied for user 'root'@'%' to database 'xxx',通過查找相關的資料終于解決了這個問題,所以想著總結下來分享給有需要的朋友們參考學習,下面來一起看看吧。
解決過程
1、創(chuàng)建數據庫
create database mytest;
2.連接數據庫,報以下錯:
Access denied for user 'root'@'%' to database 'mytest'
原因:創(chuàng)建完數據庫后,需要進行授權,在本地訪問一般不會存在這個問題。
3.授權數據庫操作
grant all on xxx.* to 'root'@'%' identified by 'password' with grant option;
其中:xxx代表創(chuàng)建的數據庫; password為用戶密碼,在此為root的密碼。
總結
以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作能帶來一定的幫助,如果有疑問大家可以留言交流,謝謝大家對腳本之家的支持。
您可能感興趣的文章:
- MySQL8.0登錄時出現Access?denied?for?user?‘root‘@‘localhost‘?(using?password:?YES)?拒絕訪問的完美解決
- 解決MySQL登錄報錯1045-Access?denied?for?user?'root'@' '(using?password:YES)
- 解決Mysql:ERROR?1045?(28000):Access?denied?for?user?‘root‘@‘localhost‘?(using?password:?NO)的方法
- 解決mysql:ERROR 1045 (28000): Access denied for user ''root''@''localhost'' (using password: NO/YES)
- 解決mysql登錄錯誤:''Access denied for user ''root''@''localhost''
- ubuntu18.0.4安裝mysql并解決ERROR 1698 (28000): Access denied for user ''''root''''@''''localhost''''
- win10下MySQL 8.0登錄Access denied for user‘root’@‘localhost’ (using password: YES)問題的解決方法
- 解決mysql ERROR 1045 (28000)-- Access denied for user問題
- mysql Access denied for user ‘root’@’localhost’ (using password: YES)解決方法
- MySQL登錄時出現 Access denied for user ‘root‘@‘xxx.xxx.xxx.xxx‘ (using password: YES) 的原因及解決辦法
相關文章
MySQL報錯Expression #1 of SELECT list 
這篇文章主要介紹了MySQL報錯Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-09-09