0

Hi i have a requirement where i need to connect to remote mysql server. My application shall be running on local machine and my mysql will be running on remote server.I have tried the following code:

DB = 'gts'
DB_HOST = 'ps95074.dreamhost.com'
DB_USER = 'root'
DB_PASSWORD = 'dbadminpassword'
conn = MySQLdb.Connection(db=DB, host=DB_HOST, user=DB_USER,passwd=DB_PASSWORD)
cursor = conn.cursor()

But i am getting the following error

OperationalError: (2005, "Unknown MySQL server host 'ps95074.dreamhost.com' (1)")

Instead if i use

DB_HOST='localhost'

Everything works fine. How can same be possible with remote host.Any help shall be appreciated.

3
  • See this? ubuntuforums.org/showthread.php?t=434155 Maybe a similar issue. You probably need to open a ticket with DreamHost, they may need to install the module or opening the connection. Commented Apr 26, 2012 at 9:02
  • 2
    This is unrelated to programming, belongs on Dreamhost support forum. Commented Apr 26, 2012 at 9:10
  • Since he's connecting as root he might have a dedicated/virtual server. In this case it would belong on serverfault.com Commented Apr 26, 2012 at 9:11

1 Answer 1

2

Check your firewall. That server is online and available from any machines:

> mysql -h ps95074.dreamhost.com
ERROR 1045 (28000): Access denied for user 'myuser'@'myhost' (using password: NO)

However, even if you can connect chances are good that your database user only allows local connections.

Update: I just tried it again and now it also fails using the commandline client. So clearly something is wrong with your server.

Sign up to request clarification or add additional context in comments.

1 Comment

i am using ubuntu 11.10 and there is no firewall installed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.