简体   繁体   中英

mysql connect to remote DB

I have a cluster witht a database saved on the master. I would like to connect from the workers to the db.

Here what I did on the master:

bomble@master:~$ mysql -u root
mysql>  GRANT ALL ON ChemAlive_DB.* TO root@worker1 ;

And on the worker1:

bomble@worker1:~$mysql -u root  -h xx.xx.xxx.xxx

I also tried:

bomble@worker1:~$ mysql -u bomble -h xx.xx.xxx.xxx

In both case I get:

ERROR 2003 (HY000): Can't connect to MySQL server on 'xx.xx.xxx.xxx' (110)

Ping is working but not telnet:

bomble@worker1:~$ ping xx.xx.xxx.xxx
PING xx.xx.xxx.xxx (xx.xx.xxx.xxx) 56(84) bytes of data.
64 bytes from 10.0.0.254: icmp_seq=1 ttl=64 time=1.04 ms
64 bytes from 10.0.0.254: icmp_seq=2 ttl=64 time=0.939 ms
64 bytes from 10.0.0.254: icmp_seq=3 ttl=64 time=0.887 ms

--- xx.xx.xxx.xxx ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 0.887/0.956/1.044/0.074 ms
bomble@worker1:~$ telnet xx.xx.xxx.xxx
Trying xx.xx.xxx.xxx...
telnet: Unable to connect to remote host: Connection refused

How should I proceed?

Check your config, maybe bind-address = 127.0.0.1 is not commented If you use Debian or Ubuntu run the command vim /etc/mysql/my.cnf and comment bind-address = 127.0.0.1 using the # symbol, after restart your mysql server once. If is not helped, check skip-external-locking (for remote connected must be not commented)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM