第一步,修改配置文件:

vim /etc/mysql/my.cnf

找到

bind-address = 127.0.0.1

改为:

bind-address = 0.0.0.0
#允许任意ip地址访问

也可以指定IP地址。

重启MySQL:

sudo /etc/init.d/mysqld restart

第二步,修改数据库配置:

授权root用户进行远程连接

grant all privileges on *.* to root@"%" identified by "password" with grant option;
flush privileges;

第二行命令使设置生效。

以上是云栖社区小编为您精心准备的的内容,在云栖社区的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索mysql , ubuntu 远程访问 ubuntu mysql远程访问、mysql 开放远程访问、ubuntu mysql远程连接、ubuntu mysql外网访问、ubuntu mysql 远程,以便于您获取更多的相关知识。

相关文章:

  • 2021-12-19
  • 2021-12-19
  • 2021-12-19
  • 2021-12-19
猜你喜欢
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
  • 2021-07-09
相关资源
相似解决方案