Jonjilla
Jonjilla

Reputation: 463

julia mysql.jl use non default port

I'm trying to connect to a MySQL database using the mySQl.jl package. it seems to work fine when I'm using the standard mySQL port 3306, but I don't see where to specify a database on a different port. How is that accomplished?

Upvotes: 1

Views: 191

Answers (1)

Dan Getz
Dan Getz

Reputation: 18217

From the help doc of mysql_connect (get it with ?mysql_connect at the REPL):

mysql_connect(host::String, user::String, passwd::String, 
  db::String = ""; port::Int64 = MYSQL_DEFAULT_PORT, 
  socket::String = MYSQL_DEFAULT_SOCKET, opts = Dict()) 

Connect to a MySQL database.

So just add a named parameter port= after the database name parameter. For example:

mysql_connect("localhost", "john", "password", "my_db", port=1234)

Upvotes: 2

Related Questions