先进阿里云控制台,安全组规则打开请允许入方向的3306端口TCP连接
然后再进操作系统
解决mysql不能使用IP链接的问题
1) 修改%xampp%\mysql\bin\my.ini文件,搜索
bind-address=“127.0.0.1”
改成
bind-address=“0.0.0.0”
2) 修改%xampp%\phpMyAdmin\config.inc.php文件,搜索:
/* Authentication type and info */
$cfg[‘Servers’][$i][‘auth_type’] =‘config’;
$cfg[‘Servers’][$i][‘user’] =‘root’;
$cfg[‘Servers’][$i][‘password’] =”;
$cfg[‘Servers’][$i][‘extension’] =‘mysql’;
$cfg[‘Servers’][$i][‘AllowNoPassword’] = true;
改成:
/* Authentication type and info */
$cfg[‘Servers’][$i][‘auth_type’] =‘cookie’;
$cfg[‘Servers’][$i][‘user’] =‘root’;
$cfg[‘Servers’][$i][‘password’] =‘root’;
$cfg[‘Servers’][$i][‘extension’] =‘mysql’;
$cfg[‘Servers’][$i][‘AllowNoPassword’] = true;
3) 启动mysql、apache,登录phpMyAdmin。在“权限”部分添加一个root@%用户,内容参照 root@localhost 的设置;两者的区别就是主机字段,一个写%,一个写localhost;
xampp下mysql开启远端连接
1、进入phpmyadmin管理界面首页,点击“权限”后,再“添加新用户”,用户名:root(随意),主机:%(必须是%),对应的密码可以设置可以不设置,即可开通远程连接;2、或者用工具Navicat链接到本地数据,点击“管理用户”,后添加用户,同上操作即可开通远端连接。