解决不能访问远程mysql的问题

一般是没有给用户访问权限

给用户test_user授权,让他可以从外部登陆和本地登陆
注意:@左边是用户名,右边是域名、IP和%,表示可以访问mysql的域名和IP,%表示外部任何地址都能访问。

 
mysql> grant all privileges on *.* to 'test_user'@'localhost' identified by 'test_user';  
Query OK, 0 rows affected (0.00 sec)  
mysql> grant all privileges on *.* to 'test_user'@'%' identified by 'test_user';  
Query OK, 0 rows affected (0.00 sec)  
mysql> select user,host,password from mysql.user;  
原文地址:https://www.cnblogs.com/yansum/p/5858182.html