远程访问ubuntu下mysql的问题
生活随笔
收集整理的這篇文章主要介紹了
远程访问ubuntu下mysql的问题
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
ubuntu下mysql不能用IP地址遠(yuǎn)程訪問(wèn)的問(wèn)題解決
方法1:
1.mysql>grant all privileges on *.* to 'root'@'%' identified by 'root';
? ?(%) 表示所有ip
? ? 第1個(gè)root表示賬戶
? ? 第2個(gè)root表示密碼
2.mysql>flush privileges;
3.停止并重啟mysql服務(wù)。
?
停止命令:
service mysql stop?
啟動(dòng)命令:
service mysql start?
查看狀態(tài):
service mysql status?
如果以上操作還是不能訪問(wèn),那么應(yīng)該是mysql沒(méi)有允許遠(yuǎn)程訪問(wèn)。
修改配置文件:
?
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
?
然后重啟服務(wù)即可訪問(wèn)了。
轉(zhuǎn)載于:https://www.cnblogs.com/fwl8888/p/9508892.html
總結(jié)
以上是生活随笔為你收集整理的远程访问ubuntu下mysql的问题的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: CentOS7.2最小化安装后系统优化
- 下一篇: mongodb笔记(三)