1、別人在用自己的tomcat訪問我留的查詢接口時,出現Cannot create PoolableConnectionFactory (null, message from server: "Host 'admin-PC' is not allowed to connect to this MySQL server")這個問題
解決辦法:
mysql -u root -p
mysql>use mysql;
mysql>select 'host' from user where user='root';
mysql>update user set host = '%' where user ='root';
mysql>flush privileges;
mysql>select 'host' from user where user='root';
第一句是以權限用戶root登錄
第二句:選擇mysql庫
第三句:查看mysql庫中的user表的host值(即可進行連接訪問的主機/IP名稱)
第四句:修改host值(以通配符%的內容增加主機/IP地址),當然也可以直接增加IP地址
第五句:刷新MySQL的系統權限相關表
第六句:再重新查看user表時,有修改。。
重啟重啟mysql!!!!
啟動服務命令
net start mysql
關閉服務命令
net stop mysql
