Ubuntu14.04 安装MySQL无法连接

xiaoxiao2021-02-28  59

1、修改配置文件:sudo gedit /etc/mysql/my.cnf 查找到bind-address,将 bind-address=127.0.0.1 修改为 bind-address = 0.0.0.0 ,以允许任何IP来访问MySQL服务。 2、重启MySQL服务:sudo /etc/init.d/mysql restart 3、登录MySQL数据库,给需要远程访问的用户授权: mysql> grant all privileges on test.* to root@"%" identified by "root" with grant option; 本次授权root用户远程访问test数据库的权限,如果你想授权所有数据库,则用*来代替test,就表明全部数据库。 4、刷新配置,使权限立即生效: mysql> flush privileges; 这时,通过物理主机的MySQL客户端就可以正常登录了。
转载请注明原文地址: https://www.6miu.com/read-2619452.html

最新回复(0)