Trevor
Trevor

Reputation: 63

How to connect to MySQL on 3307 port in ruby dbi

In Ruby

db = DBI.connect("DBI:Mysql:database=db1:host=dbhostname:port=3307", "username", "password")

isn't working for me

using the same details in a direct mysql connection in the command line does...?

What am I missing to get the connection on port 3307 ???

I get the error:

Access denied for user 'username'@'localhost' (using password: YES) (DBI::DatabaseError)

Upvotes: 1

Views: 548

Answers (1)

Trevor
Trevor

Reputation: 63

changed order

DBI:Mysql:host=hostname;database=dbname;port=3307 worked for reason I don't really know.

Upvotes: 2

Related Questions