登录MySQL:

mysql -u root -p

 

新建远程用户:

CREATE USER 'myusername' IDENTIFIED BY 'mypassword';

授权:

grant all on *.* to john@'101.102.103.104' identified by 'mypassword';
flush privileges;

101.102.103.104是你的外网ip

现在,你就可以用客户端从远程访问了