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;