遠程訪問ubuntu下mysql的問題
阿新 • • 發佈:2018-08-21
span grant not res pat oca 查看 修改配置 vim
ubuntu下mysql不能用IP地址遠程訪問的問題解決
方法1:
1.mysql>grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘root‘;
(%) 表示所有ip
第1個root表示賬戶
第2個root表示密碼
2.mysql>flush privileges;
3.停止並重啟mysql服務。
停止命令:
service mysql stop
啟動命令:
service mysql start
查看狀態:
service mysql status
如果以上操作還是不能訪問,那麽應該是mysql沒有允許遠程訪問。
修改配置文件:
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
將bind-address = 127.0.0.1註釋掉(即在行首加#),如下:
代碼如下:# Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. # bind-address = 127.0.0.1
然後重啟服務即可訪問了。
遠程訪問ubuntu下mysql的問題