0

If I list my the mysql port I get...

sudo lsof -i -P | grep -i "listen"
...
mysqld     1468   marklocklear   10u  IPv4 0xa20755c85d1b929      0t0    TCP localhost:8889 (LISTEN)

I have a ruby script where I am trying to connect to mysql and I have...

con = Mysql.new 'localhost:8889', 'root', 'password', 'brewery'

I am getting the error...

script.rb:4:in `new': Unknown MySQL server host 'localhost:8889' (0) (Mysql::Error)

I have also tried all manner of localhost, 127.0.0.1 in addtion to adding ports. I am running MAMP Pro on Mac if that makes a difference.

1 Answer 1

1

On Ruby the port should be the fifth argument. Try:

con = Mysql.new 'localhost', 'root', 'password', 'brewery', 8889

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

1 Comment

You rock dude! I was wondering if you could specify a port as an argument, but could not find any documentation anywhere.

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.