1、没有在数据库建立远程登陆账号


2、配置my.cnf
如果在mysql配置文件中有skip-networking就不能远程登陆即使建立了远程账号
#
Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
给指定数据表建立用户远程访问,并指定权限
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON TableName.* TO 'uname'@'%' IDENTIFIED BY 'pwd';
flush privileges;