Ubuntu(kali)开启mysql远程连接

Linux 默认关闭mysql的远程连接,编辑 /etc/mysql/my.cnf 文件,

把里面的 bind-address = 127.0.0.1 改成 bind-address = 0.0.0.0,

然后重启mysql服务,输入命令: /etc/init.d/mysql restart ,

接下来,创建并赋予远程登录mysql的用户和权限,

授权格式:grant all privileges on 数据库.* to 用户名@localhost(ip) identified by '密码';

输入命令:grant all privileges on *.* to 'myuser'@'%' identified by 'root' with grant option;

如果myuser用户不存在,则默认创建myuser用户,*.* 为授予 myuser用户的所有权限,

'myuser'@'%' 为允许myuser从任何地方远程访问, root 为 myuser用户远程访问mysql数据库的密码,

最后刷新下表权限,输入命令:flush privileges;

结束。。。。。。

原文地址:https://www.cnblogs.com/homeways/p/5405521.html