I am having difficulty connecting to my database from a Ruby script. I receive an “access denied” message from mysql whenever I try to run the script. I am able to access the database from PHP using the same server name, user and password, although those scripts are being run from the web rather than the command line.
The script is being run from a telnet session.
The user name is configured to allow access from a host of “%.dreamhost.com”. I also tried adding a host of “%”, but that does not make a difference.
The script is (2 lines):
my= Mysql.real_connect(‘mysql.mydomain.org’,‘myuser’,‘mypass’, ‘mydatabasename’)
The message I get upon running the script is:
test.rb:2:in `real_connect’: Access denied for user ‘myuser’@‘snapple.dreamhost.com’ (using password: YES) (Mysql::Error)
Sometimes an IP address is shown rather than ‘snapple.dreamhost.com’.