I use phpmyadmin to connect to a remote server for Windows machine. I have to use the IP address and not the computer name.
Is it possible to use the computer name to configure a connection to a remote computer?
Yes, it is possible to use the computer's name as long as it resolves properly either through DNS or has an entry in the /etc/hosts
file.
For example, if the computer name is sql
, you could connect to it using "sql" as the MySQL host to connect to if your DNS pointed sql.yourdomain.com
to the IP address of the MySQL server and you had search yourdomain.com
and domain yourdomain.com
lines in /etc/resolv.conf
. If you're using Ubuntu Desktop, you should set this in the "Additional search domains" setting in Network Manager.
If you are not/cannot use DNS, you can add a line like so to your /etc/hosts
file:
x.x.x.x sql
where x.x.x.x
is the IP address of your MySQL server.
The major drawback with going the /etc/hosts
route is that if you have multiple machines it can be pretty inconvenient to manage the hosts files on all of them (which is one of the reasons DNS was created in the first place).
I would definitely recommend going the DNS route.