You should only be using 127.0.0.1 if the frontend and backend are on the same machine. If they are on the same machine, then it should already know where the backend is. If that is failing it means the backend probably isn't running, which is most often caused by not having run mythtv-setup yet.
If they are on different machines, then you need to go to the backend and find the username/password combination. This will be located in the /etc/mythtv/mysql.txt file. (username should be mythtv, password will be something that was generated). On the backend, you will also need to run the Mythbuntu Control Centre and activate the mythtv service (allowing remote machines to connect to this backend). Again you will need to run mythtv-setup and go though the steps, make sure you use the actual machine IP though and not the loopback address.
You can verify if the backend is running or not with 'sudo service mythtv-backend status'