Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to create a shorter name for my Mysql database endpoint to be accessed from linux box. Clearly said, my mysql end point is and I would like to create a shorter name, let's say mybenchdb, so I could use:

mysql -hmybenchdb 

instead of:


EDIT: actually I'm using percona toolkit to benchmark rds and compare it to mysql hosted on ec2. The command line is as follows:

pt-upgrade mysql-slow.log.1 h=host1

so what I would like to do is shorten the rds endpoint I'm passing as parameter for this command.

share|improve this question
Why not just use the IP address? – John Gardeniers Aug 12 '12 at 6:20
@JohnGardeniers AWS RDSes can change IPs, without warning. – ceejayoz Dec 15 '12 at 3:24
I'm trying to do the sam thing and I can't find a way, did you find something? Sorry for not comenting, I don't have enough reputation. – Jordi Casals Jul 19 '14 at 23:27

You can setup a local DNS server to resolve it to a shorter name. If you are connecting from a bash shell, you could also do,

$ export mybenchdb=""
$ mysql -h$mybenchdb

Add the export to .profile or .bash_profile and it should be permanent.

share|improve this answer
thanks Chida ! please see my recent edit – PapelPincel Aug 10 '12 at 11:05
It should work with this: export mybenchdb="" pt-upgrade mysql-slow.log.1 h=host1 h=$mybenchdb – Frederik Nielsen Aug 10 '12 at 11:19
that's exactly what I did, but the problem is that the mysql endpoint is showing in pt-upgrade results – PapelPincel Aug 10 '12 at 11:37
Adding an entry to the hosts file or setting a search base in the hosts.conf is probably more sensible than trying to modify the DNS server - you'll break other stuff if you claim to have authoritative records for a domain you don't really control. – symcbean Aug 10 '12 at 11:39
@symcbean Except on AWS RDS, the IP of your RDS can change on its own. – ceejayoz Dec 15 '12 at 3:25
up vote 2 down vote accepted

This is how I solved this problem:

  1. Get the public IP address of RDS endpoint

    $ nslookup
    Address: 10.271.12.X
  2. Add this IP address along with your favourite alias name to /etc/hosts file

    10.271.12.X  mybenchdb
share|improve this answer
AWS RDSes can change IPs, without warning. – ceejayoz Dec 15 '12 at 3:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.