Home  >  Article  >  Database  >  授权远程连接MySQL(Linux)_MySQL

授权远程连接MySQL(Linux)_MySQL

WBOY
WBOYOriginal
2016-06-01 12:59:54969browse

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;

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn