Heim >Datenbank >MySQL-Tutorial >授权远程连接MySQL(Linux)_MySQL
MySQL远程访问的命令 格式: mysql -h主机地址 -u用户名 -p用户密码
首先在目标服务器上(115.159.66.51)修改mysql的my.cnf文件:
数据库):
grant all privileges on haibao.* to ‘root’@’115.159.66.51’ identified by ‘xiongchao’ with grant option;
赋予任何主机以root的身份访问数据权限(注:访问haibao数据库):
grant all privileges on haibao.* to ‘root’@’%’ identified by ‘xiongchao’ with grant option;
修改生效:
flush privileges;