this is work for me.
- try your code with mysql server on localhost
if it works fine then try connect to mysql server on real server.
with :
on your code
``- change server = localhost to server = ipOfServer
ex
server = 192.168.1.1
on server
- change bind-ipaddress = ipOfServer
ex
bind-ipaddress = 192.168.1.1
- create user on mysql like this
GRANT ALL ON nameOfDatabase.* TO nameOfUser@'ipOfYourClient' IDENTIFIED BY 'xxx';
ex
GRANT ALL ON myDb.* TO myName@'192.168.1.100' IDENTIFIED BY 'xxx';
the last line is very important, i hope this help