0

I am trying to connect to a remote db on '1and1' and through Php mysqli I receive this error:

php_network_getaddresses: getaddrinfo failed: Name or service not known

also trying to connect via ssh I have this error:

ssh: Could not resolve hostname db661101787.db.1and1.com: Name or service not known

I tried with DIG command in shell and the response I receive is:

; <<>> DiG 9.10.3-P4-Ubuntu <<>> db661101787.db.1and1.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 15841
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;db661101787.db.1and1.com.  IN  A

;; AUTHORITY SECTION:
1and1.com.      329 IN  SOA rns.ui-dns.de. dnsadmin.1und1.de. 2013087505 10800 3600 604800 600

 ;; Query time: 61 msec
 ;; SERVER: 127.0.1.1#53(127.0.1.1)
 ;; WHEN: Mon Apr 03 22:47:32 CEST 2017
 ;; MSG SIZE  rcvd: 117

I really don't have idea which could be the problem.

Stefano Maglione
  • 3,946
  • 11
  • 49
  • 96
  • Are you able to resolve that hostname from any other computer? Are you certain you've typed the hostname correctly? – Quietust Apr 03 '17 at 20:56

1 Answers1

1

That hostname doesn't exist, at least not on the public internet. It's possible that your provider has special internal DNS servers that do provide answers, Amazon EC2 works this way, so if that's the case you must use those servers.

If you're trying to access this database server from outside your provider's local network that may not work. It's a best practice to never expose MySQL to the public internet, the risks are too high.

tadman
  • 208,517
  • 23
  • 234
  • 262
  • Is a db connected to a website, I need to connect to it to develop the application. Maybe they don't allow connection outside of their network because the on-line website works fine, is it only when I try to connect from my pc. – Stefano Maglione Apr 03 '17 at 21:04
  • It's highly probable this is not exposed to the public internet, so if you do need to access it and you have SSH access to your server, use port forwarding. – tadman Apr 03 '17 at 21:05